libc++ inttypes.h: define __STDC_CONSTANT_MACROS and __STDC_LIMIT_MACROS
Before transitively including the base version of inttypes.h, define __STDC_CONSTANT_MACROS and __STDC_LIMIT_MACROS, because the base inttypes.h directly includes sys/stdint.h, instead of going through the 'regular' stdint.h. The libc++ version of the latter does define those macros, to ensure things like UINT64_C() and SIZE_MAX are defined even in C++98 or C++03. MFC after: 3 days
This commit is contained in:
@@ -241,12 +241,19 @@ uintmax_t wcstoumax(const wchar_t* restrict nptr, wchar_t** restrict endptr, int
|
||||
# pragma GCC system_header
|
||||
#endif
|
||||
|
||||
/* C99 stdlib (e.g. glibc < 2.18) does not provide format macros needed
|
||||
for C++11 unless __STDC_FORMAT_MACROS is defined
|
||||
/* C99 stdlib (e.g. glibc < 2.18) does not provide macros needed
|
||||
for C++11 unless __STDC_CONSTANT_MACROS, __STDC_FORMAT_MACROS
|
||||
and __STDC_LIMIT_MACROS are defined
|
||||
*/
|
||||
#if defined(__cplusplus) && !defined(__STDC_CONSTANT_MACROS)
|
||||
# define __STDC_CONSTANT_MACROS
|
||||
#endif
|
||||
#if defined(__cplusplus) && !defined(__STDC_FORMAT_MACROS)
|
||||
# define __STDC_FORMAT_MACROS
|
||||
#endif
|
||||
#if defined(__cplusplus) && !defined(__STDC_LIMIT_MACROS)
|
||||
# define __STDC_LIMIT_MACROS
|
||||
#endif
|
||||
|
||||
#if __has_include_next(<inttypes.h>)
|
||||
# include_next <inttypes.h>
|
||||
|
||||
Reference in New Issue
Block a user