From 9f6fb41fb056ee5dd63b7968eab0280dc02af1cc Mon Sep 17 00:00:00 2001 From: Flavio Cruz Date: Mon, 26 Dec 2022 19:15:38 -0500 Subject: Fix inttypes.h format constants for uintptr_t and intptr_t. The format constants are not correct for 32 bits and there was duplication for PRIx* constants (replaced with octal constants). Fixed a few format warnings too. Message-Id: --- include/inttypes.h | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'include') diff --git a/include/inttypes.h b/include/inttypes.h index ebafb67a..353984a0 100644 --- a/include/inttypes.h +++ b/include/inttypes.h @@ -25,38 +25,40 @@ #ifdef __x86_64__ #define __64PREFIX "l" +#define __PTRPREFIX "l" #else #define __64PREFIX "ll" +#define __PTRPREFIX #endif #define PRId8 "d" #define PRId16 "d" #define PRId32 "d" #define PRId64 __64PREFIX"d" -#define PRIdPTR __64PREFIX"d" +#define PRIdPTR __PTRPREFIX"d" #define PRIi8 "i" #define PRIi16 "i" #define PRIi32 "i" #define PRIi64 __64PREFIX"i" -#define PRIiPTR __64PREFIX"i" +#define PRIiPTR __PTRPREFIX"i" #define PRIu8 "u" #define PRIu16 "u" #define PRIu32 "u" #define PRIu64 __64PREFIX"u" -#define PRIuPTR __64PREFIX"u" +#define PRIuPTR __PTRPREFIX"u" #define PRIx8 "x" #define PRIx16 "x" #define PRIx32 "x" #define PRIx64 __64PREFIX"x" -#define PRIxPTR __64PREFIX"x" +#define PRIxPTR __PTRPREFIX"x" -#define PRIx8 "x" -#define PRIx16 "x" -#define PRIx32 "x" -#define PRIx64 __64PREFIX"x" -#define PRIxPTR __64PREFIX"x" +#define PRIo8 "o" +#define PRIo16 "o" +#define PRIo32 "o" +#define PRIo64 __64PREFIX"o" +#define PRIoPTR __PTRPREFIX"o" #endif /* _INTTYPES_H_ */ -- cgit v1.2.3