diff options
author | Chris Lattner <sabre@nondot.org> | 2009-04-18 19:11:11 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-04-18 19:11:11 +0000 |
commit | ca93195baf1076ee6232a722f5ea5e580fc67a4f (patch) | |
tree | 0cc428aa081613ca0cb172f83eb7d8e8b8c81ffb | |
parent | b3dcc744b3a9898c5ac8770cfb2bae346c4bf0b5 (diff) |
glibc plays some weird games with multiple different definitions of
int8_t and games it with strange *_defined macros. Emulate its weirdness
for better compatibility with linux etc. Problem pointed out by anders
johnson.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69458 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Headers/stdint.h | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/lib/Headers/stdint.h b/lib/Headers/stdint.h index 6e39dfa749..46eff354ed 100644 --- a/lib/Headers/stdint.h +++ b/lib/Headers/stdint.h @@ -34,22 +34,32 @@ * Since we only support pow-2 targets, these map directly to exact width types. */ +#ifndef __int8_t_defined /* glibc does weird things with sys/types.h */ +#define __int8_t_defined typedef signed __INT8_TYPE__ int8_t; +typedef __INT16_TYPE__ int16_t; +typedef __INT32_TYPE__ int32_t; +#ifdef __INT64_TYPE__ +typedef __INT64_TYPE__ int64_t; +#endif +#endif + typedef unsigned __INT8_TYPE__ uint8_t; typedef int8_t int_least8_t; typedef uint8_t uint_least8_t; typedef int8_t int_fast8_t; typedef uint8_t uint_fast8_t; -typedef __INT16_TYPE__ int16_t; typedef unsigned __INT16_TYPE__ uint16_t; typedef int16_t int_least16_t; typedef uint16_t uint_least16_t; typedef int16_t int_fast16_t; typedef uint16_t uint_fast16_t; -typedef __INT32_TYPE__ int32_t; +#ifndef __uint32_t_defined /* more glibc compatibility */ +#define __uint32_t_defined typedef unsigned __INT32_TYPE__ uint32_t; +#endif typedef int32_t int_least32_t; typedef uint32_t uint_least32_t; typedef int32_t int_fast32_t; @@ -59,7 +69,6 @@ typedef uint32_t uint_fast32_t; * typedefs if there is something to typedef them to. */ #ifdef __INT64_TYPE__ -typedef __INT64_TYPE__ int64_t; typedef unsigned __INT64_TYPE__ uint64_t; typedef int64_t int_least64_t; typedef uint64_t uint_least64_t; |