mirror of
https://github.com/fluencelabs/musl
synced 2025-04-25 15:22:15 +00:00
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.
This commit is contained in:
parent
b7d3210196
commit
4ecf33614b
@ -24,8 +24,10 @@ uintmax_t wcstoumax(const wchar_t *__restrict, wchar_t **__restrict, int);
|
|||||||
|
|
||||||
#if UINTPTR_MAX == UINT64_MAX
|
#if UINTPTR_MAX == UINT64_MAX
|
||||||
#define __PRI64 "l"
|
#define __PRI64 "l"
|
||||||
|
#define __PRIPTR "l"
|
||||||
#else
|
#else
|
||||||
#define __PRI64 "ll"
|
#define __PRI64 "ll"
|
||||||
|
#define __PRIPTR ""
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define PRId8 "d"
|
#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 PRIXMAX __PRI64 "X"
|
#define PRIXMAX __PRI64 "X"
|
||||||
|
|
||||||
#define PRIdPTR "ld"
|
#define PRIdPTR __PRIPTR "d"
|
||||||
#define PRIiPTR "li"
|
#define PRIiPTR __PRIPTR "i"
|
||||||
#define PRIoPTR "lo"
|
#define PRIoPTR __PRIPTR "o"
|
||||||
#define PRIuPTR "lu"
|
#define PRIuPTR __PRIPTR "u"
|
||||||
#define PRIxPTR "lx"
|
#define PRIxPTR __PRIPTR "x"
|
||||||
#define PRIXPTR "lX"
|
#define PRIXPTR __PRIPTR "X"
|
||||||
|
|
||||||
#define SCNd8 "hhd"
|
#define SCNd8 "hhd"
|
||||||
#define SCNd16 "hd"
|
#define SCNd16 "hd"
|
||||||
@ -213,11 +215,11 @@ uintmax_t wcstoumax(const wchar_t *__restrict, wchar_t **__restrict, int);
|
|||||||
#define SCNuMAX __PRI64 "u"
|
#define SCNuMAX __PRI64 "u"
|
||||||
#define SCNxMAX __PRI64 "x"
|
#define SCNxMAX __PRI64 "x"
|
||||||
|
|
||||||
#define SCNdPTR "ld"
|
#define SCNdPTR __PRIPTR "d"
|
||||||
#define SCNiPTR "li"
|
#define SCNiPTR __PRIPTR "i"
|
||||||
#define SCNoPTR "lo"
|
#define SCNoPTR __PRIPTR "o"
|
||||||
#define SCNuPTR "lu"
|
#define SCNuPTR __PRIPTR "u"
|
||||||
#define SCNxPTR "lx"
|
#define SCNxPTR __PRIPTR "x"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user