diff options
Diffstat (limited to 'newlib/libc')
-rw-r--r-- | newlib/libc/include/inttypes.h | 1 | ||||
-rw-r--r-- | newlib/libc/include/sys/config.h | 26 |
2 files changed, 27 insertions, 0 deletions
diff --git a/newlib/libc/include/inttypes.h b/newlib/libc/include/inttypes.h index 39bf13511..52b2d845c 100644 --- a/newlib/libc/include/inttypes.h +++ b/newlib/libc/include/inttypes.h @@ -14,6 +14,7 @@ #define _INTTYPES_H #include <newlib.h> +#include <sys/config.h> #include <sys/_intsup.h> #include <stdint.h> #define __need_wchar_t diff --git a/newlib/libc/include/sys/config.h b/newlib/libc/include/sys/config.h index 5297befe5..04f1e3abf 100644 --- a/newlib/libc/include/sys/config.h +++ b/newlib/libc/include/sys/config.h @@ -287,4 +287,30 @@ #define _MB_EXTENDED_CHARSETS_WINDOWS 1 #endif +/* Determine how uintptr_t is defined by gcc for this target. This + is used to determine the correct printf() constant in inttypes.h */ +#pragma push_macro("signed") +#pragma push_macro("int") +#pragma push_macro("long") +#undef signed +#undef int +#undef long +#define signed +0 +#define int +0 +#define long +1 +#if __INTPTR_TYPE__ == 2 +#define _UINTPTR_EQ_ULONGLONG +#elif __INTPTR_TYPE__ == 1 +#define _UINTPTR_EQ_ULONG +#elif __INTPTR_TYPE__ == 0 +/* Nothing to define because intptr_t is safe to print as an int. */ +#else +#error "Unable to determine type definition of uintptr_t" +#endif +#undef long +#undef int +#undef signed +#pragma pop_macro("signed") +#pragma pop_macro("int") +#pragma pop_macro("long") #endif /* __SYS_CONFIG_H__ */ |