diff options
author | Rich Felker <dalias@aerifal.cx> | 2013-10-30 14:52:55 -0400 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2013-10-30 14:52:55 -0400 |
commit | 4ecf33614bead27801080442d9190e81aff78432 (patch) | |
tree | 2b65c4190ef4293cb5bfdbbf4a5e3eafdc5c6e09 /include | |
parent | b7d3210196ff3508601a9f57ad18315eb25f7330 (diff) | |
download | musl-4ecf33614bead27801080442d9190e81aff78432.tar.gz musl-4ecf33614bead27801080442d9190e81aff78432.tar.bz2 musl-4ecf33614bead27801080442d9190e81aff78432.tar.xz musl-4ecf33614bead27801080442d9190e81aff78432.zip |
fix inttypes.h PRI and SCN macros for [u]intptr_t types
while using "l" unconditionally gave the right behavior due to
matching sizes/representations, it was technically UB and produced
compiler warnings with format string checking.
Diffstat (limited to 'include')
-rw-r--r-- | include/inttypes.h | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/include/inttypes.h b/include/inttypes.h index c51769fa..61dcb727 100644 --- a/include/inttypes.h +++ b/include/inttypes.h @@ -24,8 +24,10 @@ uintmax_t wcstoumax(const wchar_t *__restrict, wchar_t **__restrict, int); #if UINTPTR_MAX == UINT64_MAX #define __PRI64 "l" +#define __PRIPTR "l" #else #define __PRI64 "ll" +#define __PRIPTR "" #endif #define PRId8 "d" @@ -125,12 +127,12 @@ uintmax_t wcstoumax(const wchar_t *__restrict, wchar_t **__restrict, int); #define PRIxMAX __PRI64 "x" #define PRIXMAX __PRI64 "X" -#define PRIdPTR "ld" -#define PRIiPTR "li" -#define PRIoPTR "lo" -#define PRIuPTR "lu" -#define PRIxPTR "lx" -#define PRIXPTR "lX" +#define PRIdPTR __PRIPTR "d" +#define PRIiPTR __PRIPTR "i" +#define PRIoPTR __PRIPTR "o" +#define PRIuPTR __PRIPTR "u" +#define PRIxPTR __PRIPTR "x" +#define PRIXPTR __PRIPTR "X" #define SCNd8 "hhd" #define SCNd16 "hd" @@ -213,11 +215,11 @@ uintmax_t wcstoumax(const wchar_t *__restrict, wchar_t **__restrict, int); #define SCNuMAX __PRI64 "u" #define SCNxMAX __PRI64 "x" -#define SCNdPTR "ld" -#define SCNiPTR "li" -#define SCNoPTR "lo" -#define SCNuPTR "lu" -#define SCNxPTR "lx" +#define SCNdPTR __PRIPTR "d" +#define SCNiPTR __PRIPTR "i" +#define SCNoPTR __PRIPTR "o" +#define SCNuPTR __PRIPTR "u" +#define SCNxPTR __PRIPTR "x" #ifdef __cplusplus } |