summaryrefslogtreecommitdiffstats
path: root/clang/test/Preprocessor/stdint.c
diff options
context:
space:
mode:
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>2017-04-27 21:49:45 +0000
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>2017-04-27 21:49:45 +0000
commite77a3aff6f92d39aba5404827817a52dc6a2c1d7 (patch)
treefa69afc53bcbfb3532fbceb690b1c789d9c23260 /clang/test/Preprocessor/stdint.c
parentcfc1f6a6ee41dba700ef8e0955b17883b1a1edb1 (diff)
downloadbcm5719-llvm-e77a3aff6f92d39aba5404827817a52dc6a2c1d7.tar.gz
bcm5719-llvm-e77a3aff6f92d39aba5404827817a52dc6a2c1d7.zip
Headers: Make the type of SIZE_MAX the same as size_t
size_t is usually defined as unsigned long, but on 64-bit platforms, stdint.h currently defines SIZE_MAX using "ull" (unsigned long long). Although this is the same width, it doesn't necessarily have the same alignment or calling convention. It also triggers printf warnings when using the format flag "%zu" to print SIZE_MAX. This changes SIZE_MAX to reuse the compiler-provided __SIZE_MAX__, and provides similar fixes for the other integers: - INTPTR_MIN - INTPTR_MAX - UINTPTR_MAX - PTRDIFF_MIN - PTRDIFF_MAX - INTMAX_MIN - INTMAX_MAX - UINTMAX_MAX - INTMAX_C() - UINTMAX_C() ... and fixes the typedefs for intptr_t and uintptr_t to use __INTPTR_TYPE__ and __UINTPTR_TYPE__ instead of int32_t, effectively reverting r89224, r89226, and r89237 (r89221 already having been effectively reverted). We can probably also kill __INTPTR_WIDTH__, __INTMAX_WIDTH__, and __UINTMAX_WIDTH__ in a follow-up, but I was hesitant to delete all the per-target CHECK lines in this commit since those might serve their own purpose. rdar://problem/11811377 llvm-svn: 301593
Diffstat (limited to 'clang/test/Preprocessor/stdint.c')
-rw-r--r--clang/test/Preprocessor/stdint.c105
1 files changed, 55 insertions, 50 deletions
diff --git a/clang/test/Preprocessor/stdint.c b/clang/test/Preprocessor/stdint.c
index 28ccfef9f48..01b0da71862 100644
--- a/clang/test/Preprocessor/stdint.c
+++ b/clang/test/Preprocessor/stdint.c
@@ -28,8 +28,8 @@
// ARM:typedef int8_t int_fast8_t;
// ARM:typedef uint8_t uint_fast8_t;
//
-// ARM:typedef int32_t intptr_t;
-// ARM:typedef uint32_t uintptr_t;
+// ARM:typedef long int intptr_t;
+// ARM:typedef long unsigned int uintptr_t;
//
// ARM:typedef long long int intmax_t;
// ARM:typedef long long unsigned int uintmax_t;
@@ -74,9 +74,9 @@
// ARM:INT_FAST64_MAX_ 9223372036854775807LL
// ARM:UINT_FAST64_MAX_ 18446744073709551615ULL
//
-// ARM:INTPTR_MIN_ (-2147483647 -1)
-// ARM:INTPTR_MAX_ 2147483647
-// ARM:UINTPTR_MAX_ 4294967295U
+// ARM:INTPTR_MIN_ (-2147483647L -1)
+// ARM:INTPTR_MAX_ 2147483647L
+// ARM:UINTPTR_MAX_ 4294967295UL
// ARM:PTRDIFF_MIN_ (-2147483647 -1)
// ARM:PTRDIFF_MAX_ 2147483647
// ARM:SIZE_MAX_ 4294967295U
@@ -136,8 +136,8 @@
// I386:typedef int8_t int_fast8_t;
// I386:typedef uint8_t uint_fast8_t;
//
-// I386:typedef int32_t intptr_t;
-// I386:typedef uint32_t uintptr_t;
+// I386:typedef int intptr_t;
+// I386:typedef unsigned int uintptr_t;
//
// I386:typedef long long int intmax_t;
// I386:typedef long long unsigned int uintmax_t;
@@ -243,8 +243,8 @@
// MIPS:typedef int8_t int_fast8_t;
// MIPS:typedef uint8_t uint_fast8_t;
//
-// MIPS:typedef int32_t intptr_t;
-// MIPS:typedef uint32_t uintptr_t;
+// MIPS:typedef long int intptr_t;
+// MIPS:typedef long unsigned int uintptr_t;
//
// MIPS:typedef long long int intmax_t;
// MIPS:typedef long long unsigned int uintmax_t;
@@ -289,9 +289,9 @@
// MIPS:INT_FAST64_MAX_ 9223372036854775807LL
// MIPS:UINT_FAST64_MAX_ 18446744073709551615ULL
//
-// MIPS:INTPTR_MIN_ (-2147483647 -1)
-// MIPS:INTPTR_MAX_ 2147483647
-// MIPS:UINTPTR_MAX_ 4294967295U
+// MIPS:INTPTR_MIN_ (-2147483647L -1)
+// MIPS:INTPTR_MAX_ 2147483647L
+// MIPS:UINTPTR_MAX_ 4294967295UL
// MIPS:PTRDIFF_MIN_ (-2147483647 -1)
// MIPS:PTRDIFF_MAX_ 2147483647
// MIPS:SIZE_MAX_ 4294967295U
@@ -350,8 +350,8 @@
// MIPS64:typedef int8_t int_fast8_t;
// MIPS64:typedef uint8_t uint_fast8_t;
//
-// MIPS64:typedef int64_t intptr_t;
-// MIPS64:typedef uint64_t uintptr_t;
+// MIPS64:typedef long int intptr_t;
+// MIPS64:typedef long unsigned int uintptr_t;
//
// MIPS64:typedef long int intmax_t;
// MIPS64:typedef long unsigned int uintmax_t;
@@ -450,8 +450,8 @@
// MSP430:typedef int8_t int_fast8_t;
// MSP430:typedef uint8_t uint_fast8_t;
//
-// MSP430:typedef int16_t intptr_t;
-// MSP430:typedef uint16_t uintptr_t;
+// MSP430:typedef int intptr_t;
+// MSP430:typedef unsigned int uintptr_t;
//
// MSP430:typedef long long int intmax_t;
// MSP430:typedef long long unsigned int uintmax_t;
@@ -557,8 +557,8 @@
// PPC64:typedef int8_t int_fast8_t;
// PPC64:typedef uint8_t uint_fast8_t;
//
-// PPC64:typedef int64_t intptr_t;
-// PPC64:typedef uint64_t uintptr_t;
+// PPC64:typedef long int intptr_t;
+// PPC64:typedef long unsigned int uintptr_t;
//
// PPC64:typedef long int intmax_t;
// PPC64:typedef long unsigned int uintmax_t;
@@ -664,8 +664,8 @@
// PPC64-NETBSD:typedef int8_t int_fast8_t;
// PPC64-NETBSD:typedef uint8_t uint_fast8_t;
//
-// PPC64-NETBSD:typedef int64_t intptr_t;
-// PPC64-NETBSD:typedef uint64_t uintptr_t;
+// PPC64-NETBSD:typedef long int intptr_t;
+// PPC64-NETBSD:typedef long unsigned int uintptr_t;
//
// PPC64-NETBSD:typedef long long int intmax_t;
// PPC64-NETBSD:typedef long long unsigned int uintmax_t;
@@ -710,12 +710,12 @@
// PPC64-NETBSD:INT_FAST64_MAX_ 9223372036854775807LL
// PPC64-NETBSD:UINT_FAST64_MAX_ 18446744073709551615ULL
//
-// PPC64-NETBSD:INTPTR_MIN_ (-9223372036854775807LL -1)
-// PPC64-NETBSD:INTPTR_MAX_ 9223372036854775807LL
-// PPC64-NETBSD:UINTPTR_MAX_ 18446744073709551615ULL
-// PPC64-NETBSD:PTRDIFF_MIN_ (-9223372036854775807LL -1)
-// PPC64-NETBSD:PTRDIFF_MAX_ 9223372036854775807LL
-// PPC64-NETBSD:SIZE_MAX_ 18446744073709551615ULL
+// PPC64-NETBSD:INTPTR_MIN_ (-9223372036854775807L -1)
+// PPC64-NETBSD:INTPTR_MAX_ 9223372036854775807L
+// PPC64-NETBSD:UINTPTR_MAX_ 18446744073709551615UL
+// PPC64-NETBSD:PTRDIFF_MIN_ (-9223372036854775807L -1)
+// PPC64-NETBSD:PTRDIFF_MAX_ 9223372036854775807L
+// PPC64-NETBSD:SIZE_MAX_ 18446744073709551615UL
//
// PPC64-NETBSD:INTMAX_MIN_ (-9223372036854775807LL -1)
// PPC64-NETBSD:INTMAX_MAX_ 9223372036854775807LL
@@ -772,8 +772,8 @@
// PPC:typedef int8_t int_fast8_t;
// PPC:typedef uint8_t uint_fast8_t;
//
-// PPC:typedef int32_t intptr_t;
-// PPC:typedef uint32_t uintptr_t;
+// PPC:typedef long int intptr_t;
+// PPC:typedef long unsigned int uintptr_t;
//
// PPC:typedef long long int intmax_t;
// PPC:typedef long long unsigned int uintmax_t;
@@ -818,12 +818,12 @@
// PPC:INT_FAST64_MAX_ 9223372036854775807LL
// PPC:UINT_FAST64_MAX_ 18446744073709551615ULL
//
-// PPC:INTPTR_MIN_ (-2147483647 -1)
-// PPC:INTPTR_MAX_ 2147483647
-// PPC:UINTPTR_MAX_ 4294967295U
-// PPC:PTRDIFF_MIN_ (-2147483647 -1)
-// PPC:PTRDIFF_MAX_ 2147483647
-// PPC:SIZE_MAX_ 4294967295U
+// PPC:INTPTR_MIN_ (-2147483647L -1)
+// PPC:INTPTR_MAX_ 2147483647L
+// PPC:UINTPTR_MAX_ 4294967295UL
+// PPC:PTRDIFF_MIN_ (-2147483647L -1)
+// PPC:PTRDIFF_MAX_ 2147483647L
+// PPC:SIZE_MAX_ 4294967295UL
//
// PPC:INTMAX_MIN_ (-9223372036854775807LL -1)
// PPC:INTMAX_MAX_ 9223372036854775807LL
@@ -879,8 +879,8 @@
// S390X:typedef int8_t int_fast8_t;
// S390X:typedef uint8_t uint_fast8_t;
//
-// S390X:typedef int64_t intptr_t;
-// S390X:typedef uint64_t uintptr_t;
+// S390X:typedef long int intptr_t;
+// S390X:typedef long unsigned int uintptr_t;
//
// S390X:typedef long int intmax_t;
// S390X:typedef long unsigned int uintmax_t;
@@ -986,8 +986,8 @@
// SPARC:typedef int8_t int_fast8_t;
// SPARC:typedef uint8_t uint_fast8_t;
//
-// SPARC:typedef int32_t intptr_t;
-// SPARC:typedef uint32_t uintptr_t;
+// SPARC:typedef int intptr_t;
+// SPARC:typedef unsigned int uintptr_t;
//
// SPARC:typedef long long int intmax_t;
// SPARC:typedef long long unsigned int uintmax_t;
@@ -1086,8 +1086,8 @@
// TCE:typedef int8_t int_fast8_t;
// TCE:typedef uint8_t uint_fast8_t;
//
-// TCE:typedef int32_t intptr_t;
-// TCE:typedef uint32_t uintptr_t;
+// TCE:typedef int intptr_t;
+// TCE:typedef unsigned int uintptr_t;
//
// TCE:typedef long int intmax_t;
// TCE:typedef long unsigned int uintmax_t;
@@ -1139,9 +1139,9 @@
// TCE:PTRDIFF_MAX_ 2147483647
// TCE:SIZE_MAX_ 4294967295U
//
-// TCE:INTMAX_MIN_ (-2147483647 -1)
-// TCE:INTMAX_MAX_ 2147483647
-// TCE:UINTMAX_MAX_ 4294967295U
+// TCE:INTMAX_MIN_ (-2147483647L -1)
+// TCE:INTMAX_MAX_ 2147483647L
+// TCE:UINTMAX_MAX_ 4294967295UL
//
// TCE:SIG_ATOMIC_MIN_ (-2147483647 -1)
// TCE:SIG_ATOMIC_MAX_ 2147483647
@@ -1194,8 +1194,8 @@
// X86_64:typedef int8_t int_fast8_t;
// X86_64:typedef uint8_t uint_fast8_t;
//
-// X86_64:typedef int64_t intptr_t;
-// X86_64:typedef uint64_t uintptr_t;
+// X86_64:typedef long int intptr_t;
+// X86_64:typedef long unsigned int uintptr_t;
//
// X86_64:typedef long int intmax_t;
// X86_64:typedef long unsigned int uintmax_t;
@@ -1314,8 +1314,8 @@
// XCORE:typedef int8_t int_fast8_t;
// XCORE:typedef uint8_t uint_fast8_t;
//
-// XCORE:typedef int32_t intptr_t;
-// XCORE:typedef uint32_t uintptr_t;
+// XCORE:typedef int intptr_t;
+// XCORE:typedef unsigned int uintptr_t;
//
// XCORE:typedef long long int intmax_t;
// XCORE:typedef long long unsigned int uintmax_t;
@@ -1398,9 +1398,14 @@
// the identifiers used in the operations (int, uint, _t, INT, UINT, _MIN,
// _MAX, and _C(v)) are themselves macros.
//
-// RUN: %clang_cc1 -E -ffreestanding -U__UINTMAX_TYPE__ -U__INTMAX_TYPE__ -Dint=a -Duint=b -D_t=c -DINT=d -DUINT=e -D_MIN=f -D_MAX=g '-D_C(v)=h' -triple=i386-none-none %s | FileCheck -check-prefix JOIN %s
-// JOIN:typedef int32_t intptr_t;
-// JOIN:typedef uint32_t uintptr_t;
+// RUN: %clang_cc1 -E -ffreestanding \
+// RUN: -U__UINTPTR_TYPE__ -U__INTPTR_TYPE__ \
+// RUN: -U__UINTMAX_TYPE__ -U__INTMAX_TYPE__ \
+// RUN: -Dint=a -Duint=b -D_t=c -DINT=d -DUINT=e -D_MIN=f -D_MAX=g \
+// RUN: '-D_C(v)=h' -triple=i386-none-none %s \
+// RUN: | FileCheck -check-prefix JOIN %s
+// JOIN:typedef __INTPTR_TYPE__ intptr_t;
+// JOIN:typedef __UINTPTR_TYPE__ uintptr_t;
// JOIN:typedef __INTMAX_TYPE__ intmax_t;
// JOIN:typedef __UINTMAX_TYPE__ uintmax_t;
// JOIN:INTPTR_MIN_ (-2147483647 -1)
OpenPOWER on IntegriCloud