diff options
Diffstat (limited to 'newlib/libc/include/sys/_intsup.h')
-rw-r--r-- | newlib/libc/include/sys/_intsup.h | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/newlib/libc/include/sys/_intsup.h b/newlib/libc/include/sys/_intsup.h index 7c3bc01cb..6c53641a5 100644 --- a/newlib/libc/include/sys/_intsup.h +++ b/newlib/libc/include/sys/_intsup.h @@ -33,4 +33,39 @@ #define __have_long32 1 #endif +/* Determine how intptr_t and int32_t are defined by gcc for this target. This + is used to determine the correct printf() constant in inttypes.h and other + constants in stdint.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 _INTPTR_EQ_LONGLONG +#elif __INTPTR_TYPE__ == 1 +#define _INTPTR_EQ_LONG +#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 intptr_t" +#endif +#if __INT32_TYPE__ == 1 +#define _INT32_EQ_LONG +#elif __INT32_TYPE__ == 0 +/* Nothing to define because int32_t is safe to print as an int. */ +#else +#error "Unable to determine type definition of int32_t" +#endif +#undef long +#undef int +#undef signed +#pragma pop_macro("signed") +#pragma pop_macro("int") +#pragma pop_macro("long") + #endif /* _SYS__INTSUP_H */ |