diff options
author | Joel Sherrill <joel.sherrill@oarcorp.com> | 2015-03-18 15:44:41 -0500 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2015-04-23 21:57:06 +0200 |
commit | 380c00f1756b457db87e703cf05240e4e67c1438 (patch) | |
tree | adde8b9cd99f6623fe5004abd04e513885a7d161 /newlib/libc | |
parent | dd3d3b10e224947832cd2c9d3997935136c79fdc (diff) | |
download | cygnal-380c00f1756b457db87e703cf05240e4e67c1438.tar.gz cygnal-380c00f1756b457db87e703cf05240e4e67c1438.tar.bz2 cygnal-380c00f1756b457db87e703cf05240e4e67c1438.zip |
Change from configure time to compile time probe for intptr_t definition.
2015-03-23 Joel Sherrill <joel.sherrill@oarcorp.com
* configure.in: Delete logic to determine _UINTPTR_EQ_ULONGLONG
and _UINTPTR_EQ_ULONG at configuration time.
*libc/include/sys/config.h: Add logic to determine
_UINTPTR_EQ_ULONGLONG and _UINTPTR_EQ_ULONG at compilation time.
* libc/include/inttypes.h: Add include of <sys/config.h>.
* configure: Regenerated.
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__ */ |