diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2015-04-29 13:06:45 +0200 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2015-04-29 13:07:17 +0200 |
commit | 6109eadff58d1fb7052e45c9d44ebc256a9bc5d1 (patch) | |
tree | 90624bfe00e4dc3be0ed8311870c6baa6d936a02 /newlib/libc/include/sys | |
parent | 49c051c13352cd2fd2131a379d51a4a63c09283e (diff) | |
download | cygnal-6109eadff58d1fb7052e45c9d44ebc256a9bc5d1.tar.gz cygnal-6109eadff58d1fb7052e45c9d44ebc256a9bc5d1.tar.bz2 cygnal-6109eadff58d1fb7052e45c9d44ebc256a9bc5d1.zip |
Improve check for int32_t being long or int
* libc/include/sys/config.h: Move evaluation of _UINTPTR_EQ_ULONG and
_UINTPTR_EQ_ULONGLONG from here...
* libc/include/sys/_intsup.h: ...to here. Rename to _INTPTR_EQ_LONG
and _INTPTR_EQ_LONGLONG to refer to signed base type. Add test for
base type of int32_t and set _INT32_EQ_LONG accordingly.
* libc/include/stdint.h: Change checks for __have_long32 to checks
for _INT32_EQ_LONG.
* libc/include/inttypes.h: Ditto. Accommodate aforementioned name
change.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Diffstat (limited to 'newlib/libc/include/sys')
-rw-r--r-- | newlib/libc/include/sys/_intsup.h | 35 | ||||
-rw-r--r-- | newlib/libc/include/sys/config.h | 26 |
2 files changed, 35 insertions, 26 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 */ diff --git a/newlib/libc/include/sys/config.h b/newlib/libc/include/sys/config.h index 04f1e3abf..5297befe5 100644 --- a/newlib/libc/include/sys/config.h +++ b/newlib/libc/include/sys/config.h @@ -287,30 +287,4 @@ #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__ */ |