diff options
Diffstat (limited to 'test/Preprocessor')
31 files changed, 1853 insertions, 107 deletions
diff --git a/test/Preprocessor/_Pragma.c b/test/Preprocessor/_Pragma.c index 0a83b14..15725a4 100644 --- a/test/Preprocessor/_Pragma.c +++ b/test/Preprocessor/_Pragma.c @@ -5,6 +5,9 @@ _Pragma ("GCC system_header") // expected-warning {{system_header ignored in ma // rdar://6880630 _Pragma("#define macro") // expected-warning {{unknown pragma ignored}} +_Pragma("") // expected-warning {{unknown pragma ignored}} +_Pragma("message(\"foo \\\\\\\\ bar\")") // expected-warning {{foo \\ bar}} + #ifdef macro #error #define invalid #endif diff --git a/test/Preprocessor/aarch64-target-features.c b/test/Preprocessor/aarch64-target-features.c index 8bb8427..9978f91 100644 --- a/test/Preprocessor/aarch64-target-features.c +++ b/test/Preprocessor/aarch64-target-features.c @@ -1,28 +1,33 @@ // RUN: %clang -target aarch64-none-linux-gnu -x c -E -dM %s -o - | FileCheck %s -// CHECK: __AARCH64EL__ -// CHECK-NOT: __AARCH_ADVSIMD_FP -// CHECK-NOT: __AARCH_FEATURE_ADVSIMD -// CHECK: __ARM_ACLE 101 + +// CHECK: __AARCH64EL__ 1 +// CHECK: __ARM_64BIT_STATE 1 +// CHECK: __ARM_ACLE 200 +// CHECK: __ARM_ALIGN_MAX_STACK_PWR 4 // CHECK: __ARM_ARCH 8 +// CHECK: __ARM_ARCH_ISA_A64 1 // CHECK: __ARM_ARCH_PROFILE 'A' // CHECK-NOT: __ARM_FEATURE_BIG_ENDIAN // CHECK: __ARM_FEATURE_CLZ 1 +// CHECK-NOT: __ARM_FEATURE_CRYPTO 1 +// CHECK: __ARM_FEATURE_DIV 1 // CHECK: __ARM_FEATURE_FMA 1 -// CHECK: __ARM_FEATURE_LDREX 0xf // CHECK: __ARM_FEATURE_UNALIGNED 1 // CHECK: __ARM_FP 0xe -// CHECK-NOT: __ARM_FP_FAST // CHECK: __ARM_FP16_FORMAT_IEEE 1 +// CHECK-NOT: __ARM_FP_FAST 1 // CHECK: __ARM_FP_FENV_ROUNDING 1 -// CHECK-NOT: __ARM_NEON_FP -// CHECK-NOT: __ARM_NEON -// CHECK: __ARM_SIZEOF_MINIMAL_ENUM 4 -// CHECK: __ARM_SIZEOF_WCHAR_T 4 -// CHECK: __aarch64__ +// CHECK-NOT: __ARM_NEON 1 +// CHECK-NOT: __ARM_NEON_FP 7 +// CHECK: __ARM_PCS_AAPCS64 1 +// CHECK-NOT: __ARM_SIZEOF_MINIMAL_ENUM 1 +// CHECK-NOT: __ARM_SIZEOF_WCHAR_T 2 +// RUN: %clang -target aarch64-none-linux-gnu -mfpu=crypto-neon-fp-armv8 -x c -E -dM %s -o - | FileCheck --check-prefix=CHECK-CRYPTO %s +// CHECK-CRYPTO: __ARM_FEATURE_CRYPTO 1 // RUN: %clang -target aarch64-none-linux-gnu -ffast-math -x c -E -dM %s -o - | FileCheck --check-prefix=CHECK-FASTMATH %s -// CHECK-FASTMATH: __ARM_FP_FAST +// CHECK-FASTMATH: __ARM_FP_FAST 1 // RUN: %clang -target aarch64-none-linux-gnu -fshort-wchar -x c -E -dM %s -o - | FileCheck --check-prefix=CHECK-SHORTWCHAR %s // CHECK-SHORTWCHAR: __ARM_SIZEOF_WCHAR_T 2 @@ -30,3 +35,6 @@ // RUN: %clang -target aarch64-none-linux-gnu -fshort-enums -x c -E -dM %s -o - | FileCheck --check-prefix=CHECK-SHORTENUMS %s // CHECK-SHORTENUMS: __ARM_SIZEOF_MINIMAL_ENUM 1 +// RUN: %clang -target aarch64-none-linux-gnu -mfpu=neon -x c -E -dM %s -o - | FileCheck --check-prefix=CHECK-NEON %s +// CHECK-NEON: __ARM_NEON 1 +// CHECK-NEON: __ARM_NEON_FP 7 diff --git a/test/Preprocessor/arm-target-features.c b/test/Preprocessor/arm-target-features.c new file mode 100644 index 0000000..ae93a3d --- /dev/null +++ b/test/Preprocessor/arm-target-features.c @@ -0,0 +1,157 @@ +// RUN: %clang -target armv8a-none-linux-gnu -x c -E -dM %s -o - | FileCheck %s +// CHECK: __ARMEL__ 1 +// CHECK: __ARM_ARCH 8 +// CHECK: __ARM_ARCH_8A__ 1 +// CHECK: __ARM_FEATURE_CRC32 1 + +// RUN: %clang -target armv7a-none-linux-gnu -x c -E -dM %s -o - | FileCheck --check-prefix=CHECK-V7 %s +// CHECK-V7: __ARMEL__ 1 +// CHECK-V7: __ARM_ARCH 7 +// CHECK-V7: __ARM_ARCH_7A__ 1 +// CHECK-NOT-V7: __ARM_FEATURE_CRC32 + +// RUN: %clang -target armv8a -mfloat-abi=hard -x c -E -dM %s | FileCheck --check-prefix=CHECK-V8-BAREHF %s +// CHECK-V8-BAREHF: __ARMEL__ 1 +// CHECK-V8-BAREHF: __ARM_ARCH 8 +// CHECK-V8-BAREHF: __ARM_ARCH_8A__ 1 +// CHECK-V8-BAREHF: __ARM_FEATURE_CRC32 1 +// CHECK-V8-BAREHF: __ARM_NEON__ 1 +// CHECK-V8-BAREHF: __VFP_FP__ 1 + +// RUN: %clang -target armv8a -mfloat-abi=hard -mfpu=fp-armv8 -x c -E -dM %s | FileCheck --check-prefix=CHECK-V8-BAREHF-FP %s +// CHECK-V8-BAREHF-FP-NOT: __ARM_NEON__ 1 +// CHECK-V8-BAREHF-FP: __VFP_FP__ 1 + +// RUN: %clang -target armv8a -mfloat-abi=hard -mfpu=neon-fp-armv8 -x c -E -dM %s | FileCheck --check-prefix=CHECK-V8-BAREHF-NEON-FP %s +// RUN: %clang -target armv8a -mfloat-abi=hard -mfpu=crypto-neon-fp-armv8 -x c -E -dM %s | FileCheck --check-prefix=CHECK-V8-BAREHF-NEON-FP %s +// CHECK-V8-BAREHF-NEON-FP: __ARM_NEON__ 1 +// CHECK-V8-BAREHF-NEON-FP: __VFP_FP__ 1 + +// RUN: %clang -target armv8a -mnocrc -x c -E -dM %s | FileCheck --check-prefix=CHECK-V8-NOCRC %s +// CHECK-V8-NOCRC-NOT: __ARM_FEATURE_CRC32 1 + +// Check that -mhwdiv works properly for armv8/thumbv8 (enabled by default). + +// RUN: %clang -target armv8 -x c -E -dM %s -o - | FileCheck --check-prefix=ARMV8 %s +// ARMV8:#define __ARM_ARCH_EXT_IDIV__ 1 + +// RUN: %clang -target armv8 -mthumb -x c -E -dM %s -o - | FileCheck --check-prefix=THUMBV8 %s +// THUMBV8:#define __ARM_ARCH_EXT_IDIV__ 1 + +// RUN: %clang -target armv8-eabi -x c -E -dM %s -o - | FileCheck --check-prefix=ARMV8-EABI %s +// ARMV8-EABI:#define __ARM_ARCH_EXT_IDIV__ 1 + +// RUN: %clang -target armv8-eabi -mthumb -x c -E -dM %s -o - | FileCheck --check-prefix=THUMBV8-EABI %s +// THUMBV8-EABI:#define __ARM_ARCH_EXT_IDIV__ 1 + +// RUN: %clang -target armv8 -mhwdiv=none -x c -E -dM %s -o - | FileCheck --check-prefix=NONEHWDIV-ARMV8 %s +// NONEHWDIV-ARMV8-NOT:#define __ARM_ARCH_EXT_IDIV__ + +// RUN: %clang -target armv8 -mthumb -mhwdiv=none -x c -E -dM %s -o - | FileCheck --check-prefix=NONEHWDIV-THUMBV8 %s +// NONEHWDIV-THUMBV8-NOT:#define __ARM_ARCH_EXT_IDIV__ + +// RUN: %clang -target armv8 -mhwdiv=thumb -x c -E -dM %s -o - | FileCheck --check-prefix=THUMBHWDIV-ARMV8 %s +// THUMBHWDIV-ARMV8-NOT:#define __ARM_ARCH_EXT_IDIV__ + +// RUN: %clang -target armv8 -mthumb -mhwdiv=arm -x c -E -dM %s -o - | FileCheck --check-prefix=ARMHWDIV-THUMBV8 %s +// ARMHWDIV-THUMBV8-NOT:#define __ARM_ARCH_EXT_IDIV__ + +// RUN: %clang -target armv8a -x c -E -dM %s -o - | FileCheck --check-prefix=ARMV8A %s +// ARMV8A:#define __ARM_ARCH_EXT_IDIV__ 1 + +// RUN: %clang -target armv8a -mthumb -x c -E -dM %s -o - | FileCheck --check-prefix=THUMBV8A %s +// THUMBV8A:#define __ARM_ARCH_EXT_IDIV__ 1 + +// RUN: %clang -target armv8a-eabi -x c -E -dM %s -o - | FileCheck --check-prefix=ARMV8A-EABI %s +// ARMV8A-EABI:#define __ARM_ARCH_EXT_IDIV__ 1 + +// RUN: %clang -target armv8a-eabi -x c -E -dM %s -o - | FileCheck --check-prefix=THUMBV8A-EABI %s +// THUMBV8A-EABI:#define __ARM_ARCH_EXT_IDIV__ 1 + + +// Test that -mhwdiv has the right effect for a target CPU which has hwdiv enabled by default. +// RUN: %clang -target armv7 -mcpu=cortex-a15 -x c -E -dM %s -o - | FileCheck --check-prefix=DEFAULTHWDIV-ARM %s +// DEFAULTHWDIV-ARM:#define __ARM_ARCH_EXT_IDIV__ 1 + +// RUN: %clang -target armv7 -mthumb -mcpu=cortex-a15 -x c -E -dM %s -o - | FileCheck --check-prefix=DEFAULTHWDIV-THUMB %s +// DEFAULTHWDIV-THUMB:#define __ARM_ARCH_EXT_IDIV__ 1 + +// RUN: %clang -target armv7 -mcpu=cortex-a15 -mhwdiv=arm -x c -E -dM %s -o - | FileCheck --check-prefix=ARMHWDIV-ARM %s +// ARMHWDIV-ARM:#define __ARM_ARCH_EXT_IDIV__ 1 + +// RUN: %clang -target armv7 -mthumb -mcpu=cortex-a15 -mhwdiv=thumb -x c -E -dM %s -o - | FileCheck --check-prefix=THUMBHWDIV-THUMB %s +// THUMBHWDIV-THUMB:#define __ARM_ARCH_EXT_IDIV__ 1 + +// RUN: %clang -target arm -mcpu=cortex-a15 -mhwdiv=thumb -x c -E -dM %s -o - | FileCheck --check-prefix=DEFAULTHWDIV-THUMBHWDIV-ARM %s +// DEFAULTHWDIV-THUMBHWDIV-ARM-NOT:#define __ARM_ARCH_EXT_IDIV__ + +// RUN: %clang -target arm -mthumb -mcpu=cortex-a15 -mhwdiv=arm -x c -E -dM %s -o - | FileCheck --check-prefix=DEFAULTHWDIV-ARMHWDIV-THUMB %s +// DEFAULTHWDIV-ARMHWDIV-THUMB-NOT:#define __ARM_ARCH_EXT_IDIV__ + +// RUN: %clang -target arm -mcpu=cortex-a15 -mhwdiv=none -x c -E -dM %s -o - | FileCheck --check-prefix=DEFAULTHWDIV-NONEHWDIV-ARM %s +// DEFAULTHWDIV-NONEHWDIV-ARM-NOT:#define __ARM_ARCH_EXT_IDIV__ + +// RUN: %clang -target arm -mthumb -mcpu=cortex-a15 -mhwdiv=none -x c -E -dM %s -o - | FileCheck --check-prefix=DEFAULTHWDIV-NONEHWDIV-THUMB %s +// DEFAULTHWDIV-NONEHWDIV-THUMB-NOT:#define __ARM_ARCH_EXT_IDIV__ + +// FIXME: add check for further predefines +// Test whether predefines are as expected when targeting cortex-a5. +// RUN: %clang -target armv7 -mcpu=cortex-a5 -x c -E -dM %s -o - | FileCheck --check-prefix=A5-ARM %s +// A5-ARM-NOT:#define __ARM_ARCH_EXT_IDIV__ + +// RUN: %clang -target armv7 -mthumb -mcpu=cortex-a5 -x c -E -dM %s -o - | FileCheck --check-prefix=A5-THUMB %s +// A5-THUMB-NOT:#define __ARM_ARCH_EXT_IDIV__ + +// Test whether predefines are as expected when targeting cortex-a8. +// RUN: %clang -target armv7 -mcpu=cortex-a8 -x c -E -dM %s -o - | FileCheck --check-prefix=A8-ARM %s +// A8-ARM-NOT:#define __ARM_ARCH_EXT_IDIV__ + +// RUN: %clang -target armv7 -mthumb -mcpu=cortex-a8 -x c -E -dM %s -o - | FileCheck --check-prefix=A8-THUMB %s +// A8-THUMB-NOT:#define __ARM_ARCH_EXT_IDIV__ + +// Test whether predefines are as expected when targeting cortex-a9. +// RUN: %clang -target armv7 -mcpu=cortex-a9 -x c -E -dM %s -o - | FileCheck --check-prefix=A9-ARM %s +// A9-ARM-NOT:#define __ARM_ARCH_EXT_IDIV__ + +// RUN: %clang -target armv7 -mthumb -mcpu=cortex-a9 -x c -E -dM %s -o - | FileCheck --check-prefix=A9-THUMB %s +// A9-THUMB-NOT:#define __ARM_ARCH_EXT_IDIV__ + +// Test whether predefines are as expected when targeting cortex-a15. +// RUN: %clang -target armv7 -mcpu=cortex-a15 -x c -E -dM %s -o - | FileCheck --check-prefix=A15-ARM %s +// A15-ARM:#define __ARM_ARCH_EXT_IDIV__ 1 + +// RUN: %clang -target armv7 -mthumb -mcpu=cortex-a15 -x c -E -dM %s -o - | FileCheck --check-prefix=A15-THUMB %s +// A15-THUMB:#define __ARM_ARCH_EXT_IDIV__ 1 + +// Test whether predefines are as expected when targeting swift. +// RUN: %clang -target armv7s -mcpu=swift -x c -E -dM %s -o - | FileCheck --check-prefix=SWIFT-ARM %s +// SWIFT-ARM:#define __ARM_ARCH_EXT_IDIV__ 1 + +// RUN: %clang -target armv7s -mthumb -mcpu=swift -x c -E -dM %s -o - | FileCheck --check-prefix=SWIFT-THUMB %s +// SWIFT-THUMB:#define __ARM_ARCH_EXT_IDIV__ 1 + +// Test whether predefines are as expected when targeting cortex-a53. +// RUN: %clang -target armv8 -mcpu=cortex-a53 -x c -E -dM %s -o - | FileCheck --check-prefix=A53-ARM %s +// A53-ARM:#define __ARM_ARCH_EXT_IDIV__ 1 + +// RUN: %clang -target armv8 -mthumb -mcpu=cortex-a53 -x c -E -dM %s -o - | FileCheck --check-prefix=A53-THUMB %s +// A53-THUMB:#define __ARM_ARCH_EXT_IDIV__ 1 + +// Test whether predefines are as expected when targeting cortex-r5. +// RUN: %clang -target armv7 -mcpu=cortex-r5 -x c -E -dM %s -o - | FileCheck --check-prefix=R5-ARM %s +// R5-ARM:#define __ARM_ARCH_EXT_IDIV__ 1 + +// RUN: %clang -target armv7 -mthumb -mcpu=cortex-r5 -x c -E -dM %s -o - | FileCheck --check-prefix=R5-THUMB %s +// R5-THUMB:#define __ARM_ARCH_EXT_IDIV__ 1 + +// Test whether predefines are as expected when targeting cortex-m0. +// RUN: %clang -target armv7 -mthumb -mcpu=cortex-m0 -x c -E -dM %s -o - | FileCheck --check-prefix=M0-THUMB %s +// M0-THUMB-NOT:#define __ARM_ARCH_EXT_IDIV__ + +// Test whether predefines are as expected when targeting cortex-m3. +// RUN: %clang -target armv7 -mthumb -mcpu=cortex-m3 -x c -E -dM %s -o - | FileCheck --check-prefix=M3-THUMB %s +// M3-THUMB:#define __ARM_ARCH_EXT_IDIV__ 1 + +// Test whether predefines are as expected when targeting cortex-m4. +// RUN: %clang -target armv7 -mthumb -mcpu=cortex-m4 -x c -E -dM %s -o - | FileCheck --check-prefix=M4-THUMB %s +// M4-THUMB:#define __ARM_ARCH_EXT_IDIV__ 1 diff --git a/test/Preprocessor/assembler-with-cpp.c b/test/Preprocessor/assembler-with-cpp.c index a9c4294..f03cb06 100644 --- a/test/Preprocessor/assembler-with-cpp.c +++ b/test/Preprocessor/assembler-with-cpp.c @@ -72,8 +72,15 @@ 11: T11(b) // CHECK-Identifiers-True: 11: #0 +// Universal character names can specify basic ascii and control characters +12: \u0020\u0030\u0080\u0000 +// CHECK-Identifiers-False: 12: \u0020\u0030\u0080\u0000 // This should not crash // rdar://8823139 # ## // CHECK-Identifiers-False: # ## + +#define X(a) # # # 1 +X(1) +// CHECK-Identifiers-False: # # # 1 diff --git a/test/Preprocessor/feature_tests.c b/test/Preprocessor/feature_tests.c index 19d8046..5a2c300 100644 --- a/test/Preprocessor/feature_tests.c +++ b/test/Preprocessor/feature_tests.c @@ -11,6 +11,7 @@ #if !__has_builtin(__builtin_huge_val) || \ !__has_builtin(__builtin_shufflevector) || \ + !__has_builtin(__builtin_convertvector) || \ !__has_builtin(__builtin_trap) || \ !__has_builtin(__c11_atomic_init) || \ !__has_feature(attribute_analyzer_noreturn) || \ diff --git a/test/Preprocessor/has_attribute.c b/test/Preprocessor/has_attribute.c index 711cf67..555c2b3 100644 --- a/test/Preprocessor/has_attribute.c +++ b/test/Preprocessor/has_attribute.c @@ -34,3 +34,7 @@ int has_something_we_dont_have(); static int constFunction() __attribute__((const)); #endif +// CHECK: has_no_volatile_attribute +#if !__has_attribute(volatile) +int has_no_volatile_attribute(); +#endif diff --git a/test/Preprocessor/hash_line.c b/test/Preprocessor/hash_line.c index 64edae0..c4de9f0 100644 --- a/test/Preprocessor/hash_line.c +++ b/test/Preprocessor/hash_line.c @@ -1,11 +1,12 @@ // The 1 and # should not go on the same line. // RUN: %clang_cc1 -E %s | FileCheck --strict-whitespace %s -// CHECK-NOT: 1{{.*}}# // CHECK: {{^1$}} -// CHECK-NOT: 1{{.*}}# -// CHECK: {{^ #$}} -// CHECK-NOT: 1{{.*}}# -1 +// CHECK-NEXT: {{^ #$}} +// CHECK-NEXT: {{^2$}} +// CHECK-NEXT: {{^ #$}} #define EMPTY +#define IDENTITY(X) X +1 EMPTY # - +2 +IDENTITY() # diff --git a/test/Preprocessor/ifdef-recover.c b/test/Preprocessor/ifdef-recover.c index 51d06d1..3d652dc 100644 --- a/test/Preprocessor/ifdef-recover.c +++ b/test/Preprocessor/ifdef-recover.c @@ -1,4 +1,4 @@ -/* RUN: %clang_cc1 -E %s 2>&1 >/dev/null | grep error: | count 3 +/* RUN: not %clang_cc1 -E %s 2>&1 >/dev/null | grep error: | count 3 */ #ifdef diff --git a/test/Preprocessor/init.c b/test/Preprocessor/init.c index 9671f7e..8486e94 100644 --- a/test/Preprocessor/init.c +++ b/test/Preprocessor/init.c @@ -49,6 +49,14 @@ // C99:#define __STRICT_ANSI__ 1 // // +// RUN: %clang_cc1 -std=c11 -E -dM < /dev/null | FileCheck -check-prefix C11 %s +// +// C11:#define __STDC_UTF_16__ 1 +// C11:#define __STDC_UTF_32__ 1 +// C11:#define __STDC_VERSION__ 201112L +// C11:#define __STRICT_ANSI__ 1 +// +// // RUN: %clang_cc1 -E -dM < /dev/null | FileCheck -check-prefix COMMON %s // // COMMON:#define __CONSTANT_CFSTRINGS__ 1 @@ -144,7 +152,7 @@ // NONFRAGILE:#define __OBJC2__ 1 // // -// RUN: %clang_cc1 -O0 -E -dM < /dev/null | FileCheck -check-prefix O0 %s +// RUN: %clang_cc1 -E -dM < /dev/null | FileCheck -check-prefix O0 %s // // O0:#define __NO_INLINE__ 1 // O0-NOT:#define __OPTIMIZE_SIZE__ @@ -504,6 +512,33 @@ // ARMEABIHARDFP:#define __arm 1 // ARMEABIHARDFP:#define __arm__ 1 +// RUN: %clang -target arm -arch armv7s -x c -E -dM %s -o - | FileCheck --check-prefix=ARM-DARWIN-NO-EABI %s +// RUN: %clang -target arm -arch armv6m -x c -E -dM %s -o - | FileCheck --check-prefix=ARM-DARWIN-NO-EABI %s +// RUN: %clang -target arm -arch armv7m -x c -E -dM %s -o - | FileCheck --check-prefix=ARM-DARWIN-NO-EABI %s +// RUN: %clang -target arm -arch armv7em -x c -E -dM %s -o - | FileCheck --check-prefix=ARM-DARWIN-NO-EABI %s +// RUN: %clang -target thumbv7-apple-darwin-eabi -arch armv7 -x c -E -dM %s -o - | FileCheck --check-prefix=ARM-DARWIN-NO-EABI %s +// ARM-DARWIN-NO-EABI-NOT: #define __ARM_EABI__ 1 + +// Check that -mhwdiv works properly for targets which don't have the hwdiv feature enabled by default. + +// RUN: %clang -target arm -mhwdiv=arm -x c -E -dM %s -o - | FileCheck --check-prefix=ARMHWDIV-ARM %s +// ARMHWDIV-ARM:#define __ARM_ARCH_EXT_IDIV__ 1 + +// RUN: %clang -target arm -mthumb -mhwdiv=thumb -x c -E -dM %s -o - | FileCheck --check-prefix=THUMBHWDIV-THUMB %s +// THUMBHWDIV-THUMB:#define __ARM_ARCH_EXT_IDIV__ 1 + +// RUN: %clang -target arm -x c -E -dM %s -o - | FileCheck --check-prefix=ARM-FALSE %s +// ARM-FALSE-NOT:#define __ARM_ARCH_EXT_IDIV__ + +// RUN: %clang -target arm -mthumb -x c -E -dM %s -o - | FileCheck --check-prefix=THUMB-FALSE %s +// THUMB-FALSE-NOT:#define __ARM_ARCH_EXT_IDIV__ + +// RUN: %clang -target arm -mhwdiv=thumb -x c -E -dM %s -o - | FileCheck --check-prefix=THUMBHWDIV-ARM-FALSE %s +// THUMBHWDIV-ARM-FALSE-NOT:#define __ARM_ARCH_EXT_IDIV__ + +// RUN: %clang -target arm -mthumb -mhwdiv=arm -x c -E -dM %s -o - | FileCheck --check-prefix=ARMHWDIV-THUMB-FALSE %s +// ARMHWDIV-THUMB-FALSE-NOT:#define __ARM_ARCH_EXT_IDIV__ + // // RUN: %clang_cc1 -E -dM -ffreestanding -triple=i386-none-none < /dev/null | FileCheck -check-prefix I386 %s // @@ -701,6 +736,112 @@ // I386-LINUX:#define __i386__ 1 // I386-LINUX:#define i386 1 // +// RUN: %clang_cc1 -E -dM -ffreestanding -triple=i386-netbsd < /dev/null | FileCheck -check-prefix I386-NETBSD %s +// +// I386-NETBSD-NOT:#define _LP64 +// I386-NETBSD:#define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__ +// I386-NETBSD:#define __CHAR16_TYPE__ unsigned short +// I386-NETBSD:#define __CHAR32_TYPE__ unsigned int +// I386-NETBSD:#define __CHAR_BIT__ 8 +// I386-NETBSD:#define __DBL_DENORM_MIN__ 4.9406564584124654e-324 +// I386-NETBSD:#define __DBL_DIG__ 15 +// I386-NETBSD:#define __DBL_EPSILON__ 2.2204460492503131e-16 +// I386-NETBSD:#define __DBL_HAS_DENORM__ 1 +// I386-NETBSD:#define __DBL_HAS_INFINITY__ 1 +// I386-NETBSD:#define __DBL_HAS_QUIET_NAN__ 1 +// I386-NETBSD:#define __DBL_MANT_DIG__ 53 +// I386-NETBSD:#define __DBL_MAX_10_EXP__ 308 +// I386-NETBSD:#define __DBL_MAX_EXP__ 1024 +// I386-NETBSD:#define __DBL_MAX__ 1.7976931348623157e+308 +// I386-NETBSD:#define __DBL_MIN_10_EXP__ (-307) +// I386-NETBSD:#define __DBL_MIN_EXP__ (-1021) +// I386-NETBSD:#define __DBL_MIN__ 2.2250738585072014e-308 +// I386-NETBSD:#define __DECIMAL_DIG__ 21 +// I386-NETBSD:#define __FLT_DENORM_MIN__ 1.40129846e-45F +// I386-NETBSD:#define __FLT_DIG__ 6 +// I386-NETBSD:#define __FLT_EPSILON__ 1.19209290e-7F +// I386-NETBSD:#define __FLT_EVAL_METHOD__ 2 +// I386-NETBSD:#define __FLT_HAS_DENORM__ 1 +// I386-NETBSD:#define __FLT_HAS_INFINITY__ 1 +// I386-NETBSD:#define __FLT_HAS_QUIET_NAN__ 1 +// I386-NETBSD:#define __FLT_MANT_DIG__ 24 +// I386-NETBSD:#define __FLT_MAX_10_EXP__ 38 +// I386-NETBSD:#define __FLT_MAX_EXP__ 128 +// I386-NETBSD:#define __FLT_MAX__ 3.40282347e+38F +// I386-NETBSD:#define __FLT_MIN_10_EXP__ (-37) +// I386-NETBSD:#define __FLT_MIN_EXP__ (-125) +// I386-NETBSD:#define __FLT_MIN__ 1.17549435e-38F +// I386-NETBSD:#define __FLT_RADIX__ 2 +// I386-NETBSD:#define __INT16_TYPE__ short +// I386-NETBSD:#define __INT32_TYPE__ int +// I386-NETBSD:#define __INT64_C_SUFFIX__ LL +// I386-NETBSD:#define __INT64_TYPE__ long long int +// I386-NETBSD:#define __INT8_TYPE__ char +// I386-NETBSD:#define __INTMAX_MAX__ 9223372036854775807LL +// I386-NETBSD:#define __INTMAX_TYPE__ long long int +// I386-NETBSD:#define __INTMAX_WIDTH__ 64 +// I386-NETBSD:#define __INTPTR_TYPE__ int +// I386-NETBSD:#define __INTPTR_WIDTH__ 32 +// I386-NETBSD:#define __INT_MAX__ 2147483647 +// I386-NETBSD:#define __LDBL_DENORM_MIN__ 3.64519953188247460253e-4951L +// I386-NETBSD:#define __LDBL_DIG__ 18 +// I386-NETBSD:#define __LDBL_EPSILON__ 1.08420217248550443401e-19L +// I386-NETBSD:#define __LDBL_HAS_DENORM__ 1 +// I386-NETBSD:#define __LDBL_HAS_INFINITY__ 1 +// I386-NETBSD:#define __LDBL_HAS_QUIET_NAN__ 1 +// I386-NETBSD:#define __LDBL_MANT_DIG__ 64 +// I386-NETBSD:#define __LDBL_MAX_10_EXP__ 4932 +// I386-NETBSD:#define __LDBL_MAX_EXP__ 16384 +// I386-NETBSD:#define __LDBL_MAX__ 1.18973149535723176502e+4932L +// I386-NETBSD:#define __LDBL_MIN_10_EXP__ (-4931) +// I386-NETBSD:#define __LDBL_MIN_EXP__ (-16381) +// I386-NETBSD:#define __LDBL_MIN__ 3.36210314311209350626e-4932L +// I386-NETBSD:#define __LITTLE_ENDIAN__ 1 +// I386-NETBSD:#define __LONG_LONG_MAX__ 9223372036854775807LL +// I386-NETBSD:#define __LONG_MAX__ 2147483647L +// I386-NETBSD-NOT:#define __LP64__ +// I386-NETBSD:#define __NO_MATH_INLINES 1 +// I386-NETBSD:#define __POINTER_WIDTH__ 32 +// I386-NETBSD:#define __PTRDIFF_TYPE__ int +// I386-NETBSD:#define __PTRDIFF_WIDTH__ 32 +// I386-NETBSD:#define __REGISTER_PREFIX__ +// I386-NETBSD:#define __SCHAR_MAX__ 127 +// I386-NETBSD:#define __SHRT_MAX__ 32767 +// I386-NETBSD:#define __SIG_ATOMIC_WIDTH__ 32 +// I386-NETBSD:#define __SIZEOF_DOUBLE__ 8 +// I386-NETBSD:#define __SIZEOF_FLOAT__ 4 +// I386-NETBSD:#define __SIZEOF_INT__ 4 +// I386-NETBSD:#define __SIZEOF_LONG_DOUBLE__ 12 +// I386-NETBSD:#define __SIZEOF_LONG_LONG__ 8 +// I386-NETBSD:#define __SIZEOF_LONG__ 4 +// I386-NETBSD:#define __SIZEOF_POINTER__ 4 +// I386-NETBSD:#define __SIZEOF_PTRDIFF_T__ 4 +// I386-NETBSD:#define __SIZEOF_SHORT__ 2 +// I386-NETBSD:#define __SIZEOF_SIZE_T__ 4 +// I386-NETBSD:#define __SIZEOF_WCHAR_T__ 4 +// I386-NETBSD:#define __SIZEOF_WINT_T__ 4 +// I386-NETBSD:#define __SIZE_MAX__ 4294967295U +// I386-NETBSD:#define __SIZE_TYPE__ unsigned int +// I386-NETBSD:#define __SIZE_WIDTH__ 32 +// I386-NETBSD:#define __UINTMAX_TYPE__ long long unsigned int +// I386-NETBSD:#define __USER_LABEL_PREFIX__ +// I386-NETBSD:#define __WCHAR_MAX__ 2147483647 +// I386-NETBSD:#define __WCHAR_TYPE__ int +// I386-NETBSD:#define __WCHAR_WIDTH__ 32 +// I386-NETBSD:#define __WINT_TYPE__ int +// I386-NETBSD:#define __WINT_WIDTH__ 32 +// I386-NETBSD:#define __i386 1 +// I386-NETBSD:#define __i386__ 1 +// I386-NETBSD:#define i386 1 +// +// RUN: %clang_cc1 -E -dM -ffreestanding -triple=i386-netbsd -target-feature +sse2 < /dev/null | FileCheck -check-prefix I386-NETBSD-SSE %s +// I386-NETBSD-SSE:#define __FLT_EVAL_METHOD__ 0 +// RUN: %clang_cc1 -E -dM -ffreestanding -triple=i386-netbsd6 < /dev/null | FileCheck -check-prefix I386-NETBSD6 %s +// I386-NETBSD6:#define __FLT_EVAL_METHOD__ 1 +// RUN: %clang_cc1 -E -dM -ffreestanding -triple=i386-netbsd6 -target-feature +sse2 < /dev/null | FileCheck -check-prefix I386-NETBSD6-SSE %s +// I386-NETBSD6-SSE:#define __FLT_EVAL_METHOD__ 1 + +// // RUN: %clang_cc1 -E -dM -ffreestanding -triple=mips-none-none < /dev/null | FileCheck -check-prefix MIPS32BE %s // // MIPS32BE:#define MIPSEB 1 @@ -709,6 +850,7 @@ // MIPS32BE:#define _MIPSEB 1 // MIPS32BE:#define _MIPS_ARCH "mips32" // MIPS32BE:#define _MIPS_ARCH_MIPS32 1 +// MIPS32BE:#define _MIPS_FPSET 16 // MIPS32BE:#define _MIPS_SIM _ABIO32 // MIPS32BE:#define _MIPS_SZINT 32 // MIPS32BE:#define _MIPS_SZLONG 32 @@ -813,6 +955,7 @@ // MIPS32BE:#define __llvm__ 1 // MIPS32BE:#define __mips 1 // MIPS32BE:#define __mips__ 1 +// MIPS32BE:#define __mips_fpr 32 // MIPS32BE:#define __mips_hard_float 1 // MIPS32BE:#define __mips_o32 1 // MIPS32BE:#define _mips 1 @@ -826,6 +969,7 @@ // MIPS32EL:#define _MIPSEL 1 // MIPS32EL:#define _MIPS_ARCH "mips32" // MIPS32EL:#define _MIPS_ARCH_MIPS32 1 +// MIPS32EL:#define _MIPS_FPSET 16 // MIPS32EL:#define _MIPS_SIM _ABIO32 // MIPS32EL:#define _MIPS_SZINT 32 // MIPS32EL:#define _MIPS_SZLONG 32 @@ -927,6 +1071,7 @@ // MIPS32EL:#define __llvm__ 1 // MIPS32EL:#define __mips 1 // MIPS32EL:#define __mips__ 1 +// MIPS32EL:#define __mips_fpr 32 // MIPS32EL:#define __mips_hard_float 1 // MIPS32EL:#define __mips_o32 1 // MIPS32EL:#define _mips 1 @@ -940,6 +1085,7 @@ // MIPS64BE:#define _MIPSEB 1 // MIPS64BE:#define _MIPS_ARCH "mips64" // MIPS64BE:#define _MIPS_ARCH_MIPS64 1 +// MIPS64BE:#define _MIPS_FPSET 32 // MIPS64BE:#define _MIPS_SIM _ABI64 // MIPS64BE:#define _MIPS_SZINT 32 // MIPS64BE:#define _MIPS_SZLONG 64 @@ -1043,6 +1189,7 @@ // MIPS64BE:#define __mips64 1 // MIPS64BE:#define __mips64__ 1 // MIPS64BE:#define __mips__ 1 +// MIPS64BE:#define __mips_fpr 64 // MIPS64BE:#define __mips_hard_float 1 // MIPS64BE:#define __mips_n64 1 // MIPS64BE:#define _mips 1 @@ -1056,6 +1203,7 @@ // MIPS64EL:#define _MIPSEL 1 // MIPS64EL:#define _MIPS_ARCH "mips64" // MIPS64EL:#define _MIPS_ARCH_MIPS64 1 +// MIPS64EL:#define _MIPS_FPSET 32 // MIPS64EL:#define _MIPS_SIM _ABI64 // MIPS64EL:#define _MIPS_SZINT 32 // MIPS64EL:#define _MIPS_SZLONG 64 @@ -1159,6 +1307,7 @@ // MIPS64EL:#define __mips64 1 // MIPS64EL:#define __mips64__ 1 // MIPS64EL:#define __mips__ 1 +// MIPS64EL:#define __mips_fpr 64 // MIPS64EL:#define __mips_hard_float 1 // MIPS64EL:#define __mips_n64 1 // MIPS64EL:#define _mips 1 @@ -1224,6 +1373,46 @@ // MIPS-DSPR2:#define __mips_dsp_rev 2 // MIPS-DSPR2:#define __mips_dspr2 1 // +// RUN: %clang_cc1 -target-feature +msa \ +// RUN: -E -dM -triple=mips-none-none < /dev/null \ +// RUN: | FileCheck -check-prefix MIPS-MSA %s +// MIPS-MSA:#define __mips_msa 1 +// +// RUN: %clang_cc1 -target-feature +nan2008 \ +// RUN: -E -dM -triple=mips-none-none < /dev/null \ +// RUN: | FileCheck -check-prefix MIPS-NAN2008 %s +// MIPS-NAN2008:#define __mips_nan2008 1 +// +// RUN: %clang_cc1 -target-feature -fp64 \ +// RUN: -E -dM -triple=mips-none-none < /dev/null \ +// RUN: | FileCheck -check-prefix MIPS32-MFP32 %s +// MIPS32-MFP32:#define _MIPS_FPSET 16 +// MIPS32-MFP32:#define __mips_fpr 32 +// +// RUN: %clang_cc1 -target-feature +fp64 \ +// RUN: -E -dM -triple=mips-none-none < /dev/null \ +// RUN: | FileCheck -check-prefix MIPS32-MFP64 %s +// MIPS32-MFP64:#define _MIPS_FPSET 32 +// MIPS32-MFP64:#define __mips_fpr 64 +// +// RUN: %clang_cc1 -target-feature +single-float \ +// RUN: -E -dM -triple=mips-none-none < /dev/null \ +// RUN: | FileCheck -check-prefix MIPS32-MFP32SF %s +// MIPS32-MFP32SF:#define _MIPS_FPSET 32 +// MIPS32-MFP32SF:#define __mips_fpr 32 +// +// RUN: %clang_cc1 -target-feature +fp64 \ +// RUN: -E -dM -triple=mips64-none-none < /dev/null \ +// RUN: | FileCheck -check-prefix MIPS64-MFP64 %s +// MIPS64-MFP64:#define _MIPS_FPSET 32 +// MIPS64-MFP64:#define __mips_fpr 64 +// +// RUN: %clang_cc1 -target-feature -fp64 -target-feature +single-float \ +// RUN: -E -dM -triple=mips64-none-none < /dev/null \ +// RUN: | FileCheck -check-prefix MIPS64-NOMFP64 %s +// MIPS64-NOMFP64:#define _MIPS_FPSET 32 +// MIPS64-NOMFP64:#define __mips_fpr 32 +// // RUN: %clang_cc1 -E -dM -ffreestanding -triple=msp430-none-none < /dev/null | FileCheck -check-prefix MSP430 %s // // MSP430:#define MSP430 1 @@ -1265,10 +1454,10 @@ // MSP430:#define __INT32_C_SUFFIX__ L // MSP430:#define __INT32_TYPE__ long int // MSP430:#define __INT8_TYPE__ char -// MSP430:#define __INTMAX_MAX__ 2147483647L -// MSP430:#define __INTMAX_TYPE__ long int -// MSP430:#define __INTMAX_WIDTH__ 32 -// MSP430:#define __INTPTR_TYPE__ short +// MSP430:#define __INTMAX_MAX__ 9223372036854775807LL +// MSP430:#define __INTMAX_TYPE__ long long int +// MSP430:#define __INTMAX_WIDTH__ 64 +// MSP430:#define __INTPTR_TYPE__ int // MSP430:#define __INTPTR_WIDTH__ 16 // MSP430:#define __INT_MAX__ 32767 // MSP430:#define __LDBL_DENORM_MIN__ 4.9406564584124654e-324L @@ -1309,7 +1498,7 @@ // MSP430:#define __SIZE_MAX__ 65535U // MSP430:#define __SIZE_TYPE__ unsigned int // MSP430:#define __SIZE_WIDTH__ 16 -// MSP430:#define __UINTMAX_TYPE__ long unsigned int +// MSP430:#define __UINTMAX_TYPE__ long long unsigned int // MSP430:#define __USER_LABEL_PREFIX__ _ // MSP430:#define __WCHAR_MAX__ 32767 // MSP430:#define __WCHAR_TYPE__ int @@ -1585,6 +1774,7 @@ // PPC603E:#define __NATURAL_ALIGNMENT__ 1 // PPC603E:#define __POINTER_WIDTH__ 32 // PPC603E:#define __POWERPC__ 1 +// PPC603E:#define __PPC__ 1 // PPC603E:#define __PTRDIFF_TYPE__ long int // PPC603E:#define __PTRDIFF_WIDTH__ 32 // PPC603E:#define __REGISTER_PREFIX__ @@ -1694,6 +1884,8 @@ // PPC64:#define __NATURAL_ALIGNMENT__ 1 // PPC64:#define __POINTER_WIDTH__ 64 // PPC64:#define __POWERPC__ 1 +// PPC64:#define __PPC64__ 1 +// PPC64:#define __PPC__ 1 // PPC64:#define __PTRDIFF_TYPE__ long int // PPC64:#define __PTRDIFF_WIDTH__ 64 // PPC64:#define __REGISTER_PREFIX__ @@ -1725,6 +1917,119 @@ // PPC64:#define __ppc64__ 1 // PPC64:#define __ppc__ 1 // +// RUN: %clang_cc1 -E -dM -ffreestanding -triple=powerpc64le-none-none -target-cpu pwr7 -fno-signed-char < /dev/null | FileCheck -check-prefix PPC64LE %s +// +// PPC64LE:#define _ARCH_PPC 1 +// PPC64LE:#define _ARCH_PPC64 1 +// PPC64LE:#define _ARCH_PPCGR 1 +// PPC64LE:#define _ARCH_PPCSQ 1 +// PPC64LE:#define _ARCH_PWR4 1 +// PPC64LE:#define _ARCH_PWR5 1 +// PPC64LE:#define _ARCH_PWR5X 1 +// PPC64LE:#define _ARCH_PWR6 1 +// PPC64LE:#define _ARCH_PWR6X 1 +// PPC64LE:#define _ARCH_PWR7 1 +// PPC64LE:#define _LITTLE_ENDIAN 1 +// PPC64LE:#define _LP64 1 +// PPC64LE:#define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__ +// PPC64LE:#define __CHAR16_TYPE__ unsigned short +// PPC64LE:#define __CHAR32_TYPE__ unsigned int +// PPC64LE:#define __CHAR_BIT__ 8 +// PPC64LE:#define __CHAR_UNSIGNED__ 1 +// PPC64LE:#define __DBL_DENORM_MIN__ 4.9406564584124654e-324 +// PPC64LE:#define __DBL_DIG__ 15 +// PPC64LE:#define __DBL_EPSILON__ 2.2204460492503131e-16 +// PPC64LE:#define __DBL_HAS_DENORM__ 1 +// PPC64LE:#define __DBL_HAS_INFINITY__ 1 +// PPC64LE:#define __DBL_HAS_QUIET_NAN__ 1 +// PPC64LE:#define __DBL_MANT_DIG__ 53 +// PPC64LE:#define __DBL_MAX_10_EXP__ 308 +// PPC64LE:#define __DBL_MAX_EXP__ 1024 +// PPC64LE:#define __DBL_MAX__ 1.7976931348623157e+308 +// PPC64LE:#define __DBL_MIN_10_EXP__ (-307) +// PPC64LE:#define __DBL_MIN_EXP__ (-1021) +// PPC64LE:#define __DBL_MIN__ 2.2250738585072014e-308 +// PPC64LE:#define __DECIMAL_DIG__ 33 +// PPC64LE:#define __FLT_DENORM_MIN__ 1.40129846e-45F +// PPC64LE:#define __FLT_DIG__ 6 +// PPC64LE:#define __FLT_EPSILON__ 1.19209290e-7F +// PPC64LE:#define __FLT_EVAL_METHOD__ 0 +// PPC64LE:#define __FLT_HAS_DENORM__ 1 +// PPC64LE:#define __FLT_HAS_INFINITY__ 1 +// PPC64LE:#define __FLT_HAS_QUIET_NAN__ 1 +// PPC64LE:#define __FLT_MANT_DIG__ 24 +// PPC64LE:#define __FLT_MAX_10_EXP__ 38 +// PPC64LE:#define __FLT_MAX_EXP__ 128 +// PPC64LE:#define __FLT_MAX__ 3.40282347e+38F +// PPC64LE:#define __FLT_MIN_10_EXP__ (-37) +// PPC64LE:#define __FLT_MIN_EXP__ (-125) +// PPC64LE:#define __FLT_MIN__ 1.17549435e-38F +// PPC64LE:#define __FLT_RADIX__ 2 +// PPC64LE:#define __INT16_TYPE__ short +// PPC64LE:#define __INT32_TYPE__ int +// PPC64LE:#define __INT64_C_SUFFIX__ L +// PPC64LE:#define __INT64_TYPE__ long int +// PPC64LE:#define __INT8_TYPE__ char +// PPC64LE:#define __INTMAX_MAX__ 9223372036854775807L +// PPC64LE:#define __INTMAX_TYPE__ long int +// PPC64LE:#define __INTMAX_WIDTH__ 64 +// PPC64LE:#define __INTPTR_TYPE__ long int +// PPC64LE:#define __INTPTR_WIDTH__ 64 +// PPC64LE:#define __INT_MAX__ 2147483647 +// PPC64LE:#define __LDBL_DENORM_MIN__ 4.94065645841246544176568792868221e-324L +// PPC64LE:#define __LDBL_DIG__ 31 +// PPC64LE:#define __LDBL_EPSILON__ 4.94065645841246544176568792868221e-324L +// PPC64LE:#define __LDBL_HAS_DENORM__ 1 +// PPC64LE:#define __LDBL_HAS_INFINITY__ 1 +// PPC64LE:#define __LDBL_HAS_QUIET_NAN__ 1 +// PPC64LE:#define __LDBL_MANT_DIG__ 106 +// PPC64LE:#define __LDBL_MAX_10_EXP__ 308 +// PPC64LE:#define __LDBL_MAX_EXP__ 1024 +// PPC64LE:#define __LDBL_MAX__ 1.79769313486231580793728971405301e+308L +// PPC64LE:#define __LDBL_MIN_10_EXP__ (-291) +// PPC64LE:#define __LDBL_MIN_EXP__ (-968) +// PPC64LE:#define __LDBL_MIN__ 2.00416836000897277799610805135016e-292L +// PPC64LE:#define __LITTLE_ENDIAN__ 1 +// PPC64LE:#define __LONG_DOUBLE_128__ 1 +// PPC64LE:#define __LONG_LONG_MAX__ 9223372036854775807LL +// PPC64LE:#define __LONG_MAX__ 9223372036854775807L +// PPC64LE:#define __LP64__ 1 +// PPC64LE:#define __NATURAL_ALIGNMENT__ 1 +// PPC64LE:#define __POINTER_WIDTH__ 64 +// PPC64LE:#define __POWERPC__ 1 +// PPC64LE:#define __PPC64__ 1 +// PPC64LE:#define __PPC__ 1 +// PPC64LE:#define __PTRDIFF_TYPE__ long int +// PPC64LE:#define __PTRDIFF_WIDTH__ 64 +// PPC64LE:#define __REGISTER_PREFIX__ +// PPC64LE:#define __SCHAR_MAX__ 127 +// PPC64LE:#define __SHRT_MAX__ 32767 +// PPC64LE:#define __SIG_ATOMIC_WIDTH__ 32 +// PPC64LE:#define __SIZEOF_DOUBLE__ 8 +// PPC64LE:#define __SIZEOF_FLOAT__ 4 +// PPC64LE:#define __SIZEOF_INT__ 4 +// PPC64LE:#define __SIZEOF_LONG_DOUBLE__ 16 +// PPC64LE:#define __SIZEOF_LONG_LONG__ 8 +// PPC64LE:#define __SIZEOF_LONG__ 8 +// PPC64LE:#define __SIZEOF_POINTER__ 8 +// PPC64LE:#define __SIZEOF_PTRDIFF_T__ 8 +// PPC64LE:#define __SIZEOF_SHORT__ 2 +// PPC64LE:#define __SIZEOF_SIZE_T__ 8 +// PPC64LE:#define __SIZEOF_WCHAR_T__ 4 +// PPC64LE:#define __SIZEOF_WINT_T__ 4 +// PPC64LE:#define __SIZE_MAX__ 18446744073709551615UL +// PPC64LE:#define __SIZE_TYPE__ long unsigned int +// PPC64LE:#define __SIZE_WIDTH__ 64 +// PPC64LE:#define __UINTMAX_TYPE__ long unsigned int +// PPC64LE:#define __USER_LABEL_PREFIX__ _ +// PPC64LE:#define __WCHAR_MAX__ 2147483647 +// PPC64LE:#define __WCHAR_TYPE__ int +// PPC64LE:#define __WCHAR_WIDTH__ 32 +// PPC64LE:#define __WINT_TYPE__ int +// PPC64LE:#define __WINT_WIDTH__ 32 +// PPC64LE:#define __ppc64__ 1 +// PPC64LE:#define __ppc__ 1 +// // RUN: %clang_cc1 -E -dM -ffreestanding -triple=powerpc64-none-none -target-cpu a2q -fno-signed-char < /dev/null | FileCheck -check-prefix PPCA2Q %s // // PPCA2Q:#define _ARCH_A2 1 @@ -1957,6 +2262,8 @@ // PPC64-LINUX:#define __NATURAL_ALIGNMENT__ 1 // PPC64-LINUX:#define __POINTER_WIDTH__ 64 // PPC64-LINUX:#define __POWERPC__ 1 +// PPC64-LINUX:#define __PPC64__ 1 +// PPC64-LINUX:#define __PPC__ 1 // PPC64-LINUX:#define __PTRDIFF_TYPE__ long int // PPC64-LINUX:#define __PTRDIFF_WIDTH__ 64 // PPC64-LINUX:#define __REGISTER_PREFIX__ @@ -2062,6 +2369,7 @@ // PPC:#define __NATURAL_ALIGNMENT__ 1 // PPC:#define __POINTER_WIDTH__ 32 // PPC:#define __POWERPC__ 1 +// PPC:#define __PPC__ 1 // PPC:#define __PTRDIFF_TYPE__ long int // PPC:#define __PTRDIFF_WIDTH__ 32 // PPC:#define __REGISTER_PREFIX__ @@ -2163,6 +2471,7 @@ // PPC-LINUX:#define __NATURAL_ALIGNMENT__ 1 // PPC-LINUX:#define __POINTER_WIDTH__ 32 // PPC-LINUX:#define __POWERPC__ 1 +// PPC-LINUX:#define __PPC__ 1 // PPC-LINUX:#define __PTRDIFF_TYPE__ int // PPC-LINUX:#define __PTRDIFF_WIDTH__ 32 // PPC-LINUX:#define __REGISTER_PREFIX__ @@ -2195,6 +2504,113 @@ // PPC-LINUX:#define __powerpc__ 1 // PPC-LINUX:#define __ppc__ 1 // +// RUN: %clang_cc1 -E -dM -ffreestanding -triple=powerpc-apple-darwin8 < /dev/null | FileCheck -check-prefix PPC-DARWIN %s +// +// PPC-DARWIN:#define _ARCH_PPC 1 +// PPC-DARWIN:#define _BIG_ENDIAN 1 +// PPC-DARWIN:#define __BIG_ENDIAN__ 1 +// PPC-DARWIN:#define __BYTE_ORDER__ __ORDER_BIG_ENDIAN__ +// PPC-DARWIN:#define __CHAR16_TYPE__ unsigned short +// PPC-DARWIN:#define __CHAR32_TYPE__ unsigned int +// PPC-DARWIN:#define __CHAR_BIT__ 8 +// PPC-DARWIN:#define __DBL_DENORM_MIN__ 4.9406564584124654e-324 +// PPC-DARWIN:#define __DBL_DIG__ 15 +// PPC-DARWIN:#define __DBL_EPSILON__ 2.2204460492503131e-16 +// PPC-DARWIN:#define __DBL_HAS_DENORM__ 1 +// PPC-DARWIN:#define __DBL_HAS_INFINITY__ 1 +// PPC-DARWIN:#define __DBL_HAS_QUIET_NAN__ 1 +// PPC-DARWIN:#define __DBL_MANT_DIG__ 53 +// PPC-DARWIN:#define __DBL_MAX_10_EXP__ 308 +// PPC-DARWIN:#define __DBL_MAX_EXP__ 1024 +// PPC-DARWIN:#define __DBL_MAX__ 1.7976931348623157e+308 +// PPC-DARWIN:#define __DBL_MIN_10_EXP__ (-307) +// PPC-DARWIN:#define __DBL_MIN_EXP__ (-1021) +// PPC-DARWIN:#define __DBL_MIN__ 2.2250738585072014e-308 +// PPC-DARWIN:#define __DECIMAL_DIG__ 33 +// PPC-DARWIN:#define __FLT_DENORM_MIN__ 1.40129846e-45F +// PPC-DARWIN:#define __FLT_DIG__ 6 +// PPC-DARWIN:#define __FLT_EPSILON__ 1.19209290e-7F +// PPC-DARWIN:#define __FLT_EVAL_METHOD__ 0 +// PPC-DARWIN:#define __FLT_HAS_DENORM__ 1 +// PPC-DARWIN:#define __FLT_HAS_INFINITY__ 1 +// PPC-DARWIN:#define __FLT_HAS_QUIET_NAN__ 1 +// PPC-DARWIN:#define __FLT_MANT_DIG__ 24 +// PPC-DARWIN:#define __FLT_MAX_10_EXP__ 38 +// PPC-DARWIN:#define __FLT_MAX_EXP__ 128 +// PPC-DARWIN:#define __FLT_MAX__ 3.40282347e+38F +// PPC-DARWIN:#define __FLT_MIN_10_EXP__ (-37) +// PPC-DARWIN:#define __FLT_MIN_EXP__ (-125) +// PPC-DARWIN:#define __FLT_MIN__ 1.17549435e-38F +// PPC-DARWIN:#define __FLT_RADIX__ 2 +// PPC-DARWIN:#define __INT16_TYPE__ short +// PPC-DARWIN:#define __INT32_TYPE__ int +// PPC-DARWIN:#define __INT64_C_SUFFIX__ LL +// PPC-DARWIN:#define __INT64_TYPE__ long long int +// PPC-DARWIN:#define __INT8_TYPE__ char +// PPC-DARWIN:#define __INTMAX_MAX__ 9223372036854775807LL +// PPC-DARWIN:#define __INTMAX_TYPE__ long long int +// PPC-DARWIN:#define __INTMAX_WIDTH__ 64 +// PPC-DARWIN:#define __INTPTR_TYPE__ long int +// PPC-DARWIN:#define __INTPTR_WIDTH__ 32 +// PPC-DARWIN:#define __INT_MAX__ 2147483647 +// PPC-DARWIN:#define __LDBL_DENORM_MIN__ 4.94065645841246544176568792868221e-324L +// PPC-DARWIN:#define __LDBL_DIG__ 31 +// PPC-DARWIN:#define __LDBL_EPSILON__ 4.94065645841246544176568792868221e-324L +// PPC-DARWIN:#define __LDBL_HAS_DENORM__ 1 +// PPC-DARWIN:#define __LDBL_HAS_INFINITY__ 1 +// PPC-DARWIN:#define __LDBL_HAS_QUIET_NAN__ 1 +// PPC-DARWIN:#define __LDBL_MANT_DIG__ 106 +// PPC-DARWIN:#define __LDBL_MAX_10_EXP__ 308 +// PPC-DARWIN:#define __LDBL_MAX_EXP__ 1024 +// PPC-DARWIN:#define __LDBL_MAX__ 1.79769313486231580793728971405301e+308L +// PPC-DARWIN:#define __LDBL_MIN_10_EXP__ (-291) +// PPC-DARWIN:#define __LDBL_MIN_EXP__ (-968) +// PPC-DARWIN:#define __LDBL_MIN__ 2.00416836000897277799610805135016e-292L +// PPC-DARWIN:#define __LONG_DOUBLE_128__ 1 +// PPC-DARWIN:#define __LONG_LONG_MAX__ 9223372036854775807LL +// PPC-DARWIN:#define __LONG_MAX__ 2147483647L +// PPC-DARWIN:#define __MACH__ 1 +// PPC-DARWIN:#define __NATURAL_ALIGNMENT__ 1 +// PPC-DARWIN:#define __ORDER_BIG_ENDIAN__ 4321 +// PPC-DARWIN:#define __ORDER_LITTLE_ENDIAN__ 1234 +// PPC-DARWIN:#define __ORDER_PDP_ENDIAN__ 3412 +// PPC-DARWIN:#define __POINTER_WIDTH__ 32 +// PPC-DARWIN:#define __POWERPC__ 1 +// PPC-DARWIN:#define __PPC__ 1 +// PPC-DARWIN:#define __PTRDIFF_TYPE__ int +// PPC-DARWIN:#define __PTRDIFF_WIDTH__ 32 +// PPC-DARWIN:#define __REGISTER_PREFIX__ +// PPC-DARWIN:#define __SCHAR_MAX__ 127 +// PPC-DARWIN:#define __SHRT_MAX__ 32767 +// PPC-DARWIN:#define __SIG_ATOMIC_WIDTH__ 32 +// PPC-DARWIN:#define __SIZEOF_DOUBLE__ 8 +// PPC-DARWIN:#define __SIZEOF_FLOAT__ 4 +// PPC-DARWIN:#define __SIZEOF_INT__ 4 +// PPC-DARWIN:#define __SIZEOF_LONG_DOUBLE__ 16 +// PPC-DARWIN:#define __SIZEOF_LONG_LONG__ 8 +// PPC-DARWIN:#define __SIZEOF_LONG__ 4 +// PPC-DARWIN:#define __SIZEOF_POINTER__ 4 +// PPC-DARWIN:#define __SIZEOF_PTRDIFF_T__ 4 +// PPC-DARWIN:#define __SIZEOF_SHORT__ 2 +// PPC-DARWIN:#define __SIZEOF_SIZE_T__ 4 +// PPC-DARWIN:#define __SIZEOF_WCHAR_T__ 4 +// PPC-DARWIN:#define __SIZEOF_WINT_T__ 4 +// PPC-DARWIN:#define __SIZE_MAX__ 4294967295UL +// PPC-DARWIN:#define __SIZE_TYPE__ long unsigned int +// PPC-DARWIN:#define __SIZE_WIDTH__ 32 +// PPC-DARWIN:#define __STDC_HOSTED__ 0 +// PPC-DARWIN:#define __STDC_VERSION__ 199901L +// PPC-DARWIN:#define __STDC__ 1 +// PPC-DARWIN:#define __UINTMAX_TYPE__ long long unsigned int +// PPC-DARWIN:#define __USER_LABEL_PREFIX__ _ +// PPC-DARWIN:#define __WCHAR_MAX__ 2147483647 +// PPC-DARWIN:#define __WCHAR_TYPE__ int +// PPC-DARWIN:#define __WCHAR_WIDTH__ 32 +// PPC-DARWIN:#define __WINT_TYPE__ int +// PPC-DARWIN:#define __WINT_WIDTH__ 32 +// PPC-DARWIN:#define __powerpc__ 1 +// PPC-DARWIN:#define __ppc__ 1 +// // RUN: %clang_cc1 -E -dM -ffreestanding -triple=s390x-none-none -fno-signed-char < /dev/null | FileCheck -check-prefix S390X %s // // S390X:#define __CHAR16_TYPE__ unsigned short @@ -2688,9 +3104,141 @@ // X86_64-LINUX:#define __x86_64 1 // X86_64-LINUX:#define __x86_64__ 1 // +// RUN: %clang_cc1 -E -dM -ffreestanding -triple=x86_64-unknown-freebsd9.1 < /dev/null | FileCheck -check-prefix X86_64-FREEBSD %s +// +// X86_64-FREEBSD:#define __FreeBSD__ 9 +// X86_64-FREEBSD:#define __FreeBSD_cc_version 900001 +// X86_64-FREEBSD:#define __STDC_MB_MIGHT_NEQ_WC__ 1 +// +// RUN: %clang_cc1 -E -dM -ffreestanding -triple=x86_64-netbsd < /dev/null | FileCheck -check-prefix X86_64-NETBSD %s +// +// X86_64-NETBSD:#define _LP64 1 +// X86_64-NETBSD:#define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__ +// X86_64-NETBSD:#define __CHAR16_TYPE__ unsigned short +// X86_64-NETBSD:#define __CHAR32_TYPE__ unsigned int +// X86_64-NETBSD:#define __CHAR_BIT__ 8 +// X86_64-NETBSD:#define __DBL_DENORM_MIN__ 4.9406564584124654e-324 +// X86_64-NETBSD:#define __DBL_DIG__ 15 +// X86_64-NETBSD:#define __DBL_EPSILON__ 2.2204460492503131e-16 +// X86_64-NETBSD:#define __DBL_HAS_DENORM__ 1 +// X86_64-NETBSD:#define __DBL_HAS_INFINITY__ 1 +// X86_64-NETBSD:#define __DBL_HAS_QUIET_NAN__ 1 +// X86_64-NETBSD:#define __DBL_MANT_DIG__ 53 +// X86_64-NETBSD:#define __DBL_MAX_10_EXP__ 308 +// X86_64-NETBSD:#define __DBL_MAX_EXP__ 1024 +// X86_64-NETBSD:#define __DBL_MAX__ 1.7976931348623157e+308 +// X86_64-NETBSD:#define __DBL_MIN_10_EXP__ (-307) +// X86_64-NETBSD:#define __DBL_MIN_EXP__ (-1021) +// X86_64-NETBSD:#define __DBL_MIN__ 2.2250738585072014e-308 +// X86_64-NETBSD:#define __DECIMAL_DIG__ 21 +// X86_64-NETBSD:#define __FLT_DENORM_MIN__ 1.40129846e-45F +// X86_64-NETBSD:#define __FLT_DIG__ 6 +// X86_64-NETBSD:#define __FLT_EPSILON__ 1.19209290e-7F +// X86_64-NETBSD:#define __FLT_EVAL_METHOD__ 0 +// X86_64-NETBSD:#define __FLT_HAS_DENORM__ 1 +// X86_64-NETBSD:#define __FLT_HAS_INFINITY__ 1 +// X86_64-NETBSD:#define __FLT_HAS_QUIET_NAN__ 1 +// X86_64-NETBSD:#define __FLT_MANT_DIG__ 24 +// X86_64-NETBSD:#define __FLT_MAX_10_EXP__ 38 +// X86_64-NETBSD:#define __FLT_MAX_EXP__ 128 +// X86_64-NETBSD:#define __FLT_MAX__ 3.40282347e+38F +// X86_64-NETBSD:#define __FLT_MIN_10_EXP__ (-37) +// X86_64-NETBSD:#define __FLT_MIN_EXP__ (-125) +// X86_64-NETBSD:#define __FLT_MIN__ 1.17549435e-38F +// X86_64-NETBSD:#define __FLT_RADIX__ 2 +// X86_64-NETBSD:#define __INT16_TYPE__ short +// X86_64-NETBSD:#define __INT32_TYPE__ int +// X86_64-NETBSD:#define __INT64_C_SUFFIX__ L +// X86_64-NETBSD:#define __INT64_TYPE__ long int +// X86_64-NETBSD:#define __INT8_TYPE__ char +// X86_64-NETBSD:#define __INTMAX_MAX__ 9223372036854775807L +// X86_64-NETBSD:#define __INTMAX_TYPE__ long int +// X86_64-NETBSD:#define __INTMAX_WIDTH__ 64 +// X86_64-NETBSD:#define __INTPTR_TYPE__ long int +// X86_64-NETBSD:#define __INTPTR_WIDTH__ 64 +// X86_64-NETBSD:#define __INT_MAX__ 2147483647 +// X86_64-NETBSD:#define __LDBL_DENORM_MIN__ 3.64519953188247460253e-4951L +// X86_64-NETBSD:#define __LDBL_DIG__ 18 +// X86_64-NETBSD:#define __LDBL_EPSILON__ 1.08420217248550443401e-19L +// X86_64-NETBSD:#define __LDBL_HAS_DENORM__ 1 +// X86_64-NETBSD:#define __LDBL_HAS_INFINITY__ 1 +// X86_64-NETBSD:#define __LDBL_HAS_QUIET_NAN__ 1 +// X86_64-NETBSD:#define __LDBL_MANT_DIG__ 64 +// X86_64-NETBSD:#define __LDBL_MAX_10_EXP__ 4932 +// X86_64-NETBSD:#define __LDBL_MAX_EXP__ 16384 +// X86_64-NETBSD:#define __LDBL_MAX__ 1.18973149535723176502e+4932L +// X86_64-NETBSD:#define __LDBL_MIN_10_EXP__ (-4931) +// X86_64-NETBSD:#define __LDBL_MIN_EXP__ (-16381) +// X86_64-NETBSD:#define __LDBL_MIN__ 3.36210314311209350626e-4932L +// X86_64-NETBSD:#define __LITTLE_ENDIAN__ 1 +// X86_64-NETBSD:#define __LONG_LONG_MAX__ 9223372036854775807LL +// X86_64-NETBSD:#define __LONG_MAX__ 9223372036854775807L +// X86_64-NETBSD:#define __LP64__ 1 +// X86_64-NETBSD:#define __MMX__ 1 +// X86_64-NETBSD:#define __NO_MATH_INLINES 1 +// X86_64-NETBSD:#define __POINTER_WIDTH__ 64 +// X86_64-NETBSD:#define __PTRDIFF_TYPE__ long int +// X86_64-NETBSD:#define __PTRDIFF_WIDTH__ 64 +// X86_64-NETBSD:#define __REGISTER_PREFIX__ +// X86_64-NETBSD:#define __SCHAR_MAX__ 127 +// X86_64-NETBSD:#define __SHRT_MAX__ 32767 +// X86_64-NETBSD:#define __SIG_ATOMIC_WIDTH__ 32 +// X86_64-NETBSD:#define __SIZEOF_DOUBLE__ 8 +// X86_64-NETBSD:#define __SIZEOF_FLOAT__ 4 +// X86_64-NETBSD:#define __SIZEOF_INT__ 4 +// X86_64-NETBSD:#define __SIZEOF_LONG_DOUBLE__ 16 +// X86_64-NETBSD:#define __SIZEOF_LONG_LONG__ 8 +// X86_64-NETBSD:#define __SIZEOF_LONG__ 8 +// X86_64-NETBSD:#define __SIZEOF_POINTER__ 8 +// X86_64-NETBSD:#define __SIZEOF_PTRDIFF_T__ 8 +// X86_64-NETBSD:#define __SIZEOF_SHORT__ 2 +// X86_64-NETBSD:#define __SIZEOF_SIZE_T__ 8 +// X86_64-NETBSD:#define __SIZEOF_WCHAR_T__ 4 +// X86_64-NETBSD:#define __SIZEOF_WINT_T__ 4 +// X86_64-NETBSD:#define __SIZE_MAX__ 18446744073709551615UL +// X86_64-NETBSD:#define __SIZE_TYPE__ long unsigned int +// X86_64-NETBSD:#define __SIZE_WIDTH__ 64 +// X86_64-NETBSD:#define __SSE2_MATH__ 1 +// X86_64-NETBSD:#define __SSE2__ 1 +// X86_64-NETBSD:#define __SSE_MATH__ 1 +// X86_64-NETBSD:#define __SSE__ 1 +// X86_64-NETBSD:#define __UINTMAX_TYPE__ long unsigned int +// X86_64-NETBSD:#define __USER_LABEL_PREFIX__ +// X86_64-NETBSD:#define __WCHAR_MAX__ 2147483647 +// X86_64-NETBSD:#define __WCHAR_TYPE__ int +// X86_64-NETBSD:#define __WCHAR_WIDTH__ 32 +// X86_64-NETBSD:#define __WINT_TYPE__ int +// X86_64-NETBSD:#define __WINT_WIDTH__ 32 +// X86_64-NETBSD:#define __amd64 1 +// X86_64-NETBSD:#define __amd64__ 1 +// X86_64-NETBSD:#define __x86_64 1 +// X86_64-NETBSD:#define __x86_64__ 1 +// +// RUN: %clang_cc1 -E -dM -ffreestanding -triple=sparc64-none-none < /dev/null | FileCheck -check-prefix SPARCV9 %s +// SPARCV9:#define __INT64_TYPE__ long int +// SPARCV9:#define __INTMAX_TYPE__ long int +// SPARCV9:#define __INTPTR_TYPE__ long int +// SPARCV9:#define __LONG_MAX__ 9223372036854775807L +// SPARCV9:#define __LP64__ 1 +// SPARCV9:#define __SIZEOF_LONG__ 8 +// SPARCV9:#define __SIZEOF_POINTER__ 8 +// +// RUN: %clang_cc1 -E -dM -ffreestanding -triple=sparc64-none-openbsd < /dev/null | FileCheck -check-prefix SPARC64-OBSD %s +// SPARC64-OBSD:#define __INT64_TYPE__ long long int +// SPARC64-OBSD:#define __INTMAX_TYPE__ long long int +// SPARC64-OBSD:#define __UINTMAX_TYPE__ long long unsigned int +// +// RUN: %clang_cc1 -E -dM -ffreestanding -triple=x86_64-pc-kfreebsd-gnu < /dev/null | FileCheck -check-prefix KFREEBSD-DEFINE %s +// KFREEBSD-DEFINE:#define __FreeBSD_kernel__ 1 +// KFREEBSD-DEFINE:#define __GLIBC__ 1 +// +// RUN: %clang_cc1 -E -dM -ffreestanding -triple=i686-pc-kfreebsd-gnu < /dev/null | FileCheck -check-prefix KFREEBSDI686-DEFINE %s +// KFREEBSDI686-DEFINE:#define __FreeBSD_kernel__ 1 +// KFREEBSDI686-DEFINE:#define __GLIBC__ 1 +// // RUN: %clang_cc1 -x c++ -triple i686-pc-linux-gnu -fobjc-runtime=gcc -E -dM < /dev/null | FileCheck -check-prefix GNUSOURCE %s // GNUSOURCE:#define _GNU_SOURCE 1 -// +// // RUN: %clang_cc1 -x c++ -std=c++98 -fno-rtti -E -dM < /dev/null | FileCheck -check-prefix NORTTI %s // NORTTI: __GXX_ABI_VERSION // NORTTI-NOT:#define __GXX_RTTI @@ -2698,3 +3246,9 @@ // // RUN: %clang_cc1 -triple arm-linux-androideabi -E -dM < /dev/null | FileCheck -check-prefix ANDROID %s // ANDROID: __ANDROID__ 1 +// +// RUN: %clang_cc1 -E -dM -ffreestanding -triple=powerpc64-unknown-freebsd < /dev/null | FileCheck -check-prefix PPC64-FREEBSD %s +// PPC64-FREEBSD-NOT: #define __LONG_DOUBLE_128__ 1 +// +// RUN: %clang_cc1 -E -dM -ffreestanding -triple=xcore-none-none < /dev/null | FileCheck -check-prefix XCORE %s +// XCORE:#define __XS1B__ 1 diff --git a/test/Preprocessor/iwithprefix.c b/test/Preprocessor/iwithprefix.c index c11f36e..59935ac 100644 --- a/test/Preprocessor/iwithprefix.c +++ b/test/Preprocessor/iwithprefix.c @@ -4,13 +4,12 @@ // RUN: mkdir -p %t.tmps/first %t.tmps/second // RUN: %clang_cc1 -triple x86_64-unknown-unknown \ // RUN: -iprefix %t.tmps/ -iwithprefix second \ -// RUN: -isystem %t.tmps/first -v 2> %t.out -// RUN: cat %t.out -// RUN: FileCheck < %t.out %s +// RUN: -isystem %t.tmps/first -v %s 2> %t.out +// RUN: FileCheck %s < %t.out // CHECK: #include <...> search starts here: // CHECK: {{.*}}.tmps/first -// CHECK: /lib/clang/{{[.0-9]+}}/include +// CHECK: {{/|\\}}lib{{/|\\}}clang{{/|\\}}{{[.0-9]+}}{{/|\\}}include // CHECK: {{.*}}.tmps/second // CHECK-NOT: {{.*}}.tmps diff --git a/test/Preprocessor/line-directive-output.c b/test/Preprocessor/line-directive-output.c index bd3ea94..5c0aef8 100644 --- a/test/Preprocessor/line-directive-output.c +++ b/test/Preprocessor/line-directive-output.c @@ -73,3 +73,6 @@ extern int z; # 42 "A.c" # 44 "A.c" # 49 "A.c" + +// CHECK: # 50 "a\n.c" +# 50 "a\012.c" diff --git a/test/Preprocessor/line-directive.c b/test/Preprocessor/line-directive.c index ea0a36f..0dd658f 100644 --- a/test/Preprocessor/line-directive.c +++ b/test/Preprocessor/line-directive.c @@ -1,6 +1,6 @@ // RUN: %clang_cc1 -fsyntax-only -verify -pedantic %s -// RUN: %clang_cc1 -E %s 2>&1 | grep 'blonk.c:92:2: error: ABC' -// RUN: %clang_cc1 -E %s 2>&1 | grep 'blonk.c:93:2: error: DEF' +// RUN: not %clang_cc1 -E %s 2>&1 | grep 'blonk.c:92:2: error: ABC' +// RUN: not %clang_cc1 -E %s 2>&1 | grep 'blonk.c:93:2: error: DEF' #line 'a' // expected-error {{#line directive requires a positive integer argument}} #line 0 // expected-warning {{#line directive with zero argument is a GNU extension}} diff --git a/test/Preprocessor/macro_backslash.c b/test/Preprocessor/macro_backslash.c new file mode 100644 index 0000000..76f5d41 --- /dev/null +++ b/test/Preprocessor/macro_backslash.c @@ -0,0 +1,3 @@ +// RUN: %clang_cc1 -E %s -Dfoo='bar\' | FileCheck %s +// CHECK: TTA bar\ TTB +TTA foo TTB diff --git a/test/Preprocessor/macro_expand_empty.c b/test/Preprocessor/macro_expand_empty.c new file mode 100644 index 0000000..3fb6394 --- /dev/null +++ b/test/Preprocessor/macro_expand_empty.c @@ -0,0 +1,14 @@ +// RUN: %clang_cc1 -fsyntax-only %s +// Check that this doesn't crash + +#define IDENTITY1(x) x +#define IDENTITY2(x) IDENTITY1(x) IDENTITY1(x) IDENTITY1(x) IDENTITY1(x) +#define IDENTITY3(x) IDENTITY2(x) IDENTITY2(x) IDENTITY2(x) IDENTITY2(x) +#define IDENTITY4(x) IDENTITY3(x) IDENTITY3(x) IDENTITY3(x) IDENTITY3(x) +#define IDENTITY5(x) IDENTITY4(x) IDENTITY4(x) IDENTITY4(x) IDENTITY4(x) +#define IDENTITY6(x) IDENTITY5(x) IDENTITY5(x) IDENTITY5(x) IDENTITY5(x) +#define IDENTITY7(x) IDENTITY6(x) IDENTITY6(x) IDENTITY6(x) IDENTITY6(x) +#define IDENTITY8(x) IDENTITY7(x) IDENTITY7(x) IDENTITY7(x) IDENTITY7(x) +#define IDENTITY9(x) IDENTITY8(x) IDENTITY8(x) IDENTITY8(x) IDENTITY8(x) +#define IDENTITY0(x) IDENTITY9(x) IDENTITY9(x) IDENTITY9(x) IDENTITY9(x) +IDENTITY0() diff --git a/test/Preprocessor/macro_fn.c b/test/Preprocessor/macro_fn.c index fcdb90a..f21ef51 100644 --- a/test/Preprocessor/macro_fn.c +++ b/test/Preprocessor/macro_fn.c @@ -13,7 +13,8 @@ zero(1, 2, 3); /* expected-error {{too many arguments provided to function-li one() /* ok */ one(a) -one(a,) /* expected-error {{too many arguments provided to function-like macro invocation}} */ +one(a,) /* expected-error {{too many arguments provided to function-like macro invocation}} \ + expected-warning {{empty macro arguments are a C99 feature}}*/ one(a, b) /* expected-error {{too many arguments provided to function-like macro invocation}} */ two() /* expected-error {{too few arguments provided to function-like macro invocation}} */ @@ -25,7 +26,7 @@ two( , /* expected-warning {{empty macro arguments are a C99 feature}} */ , /* expected-warning {{empty macro arguments are a C99 feature}} \ expected-error {{too many arguments provided to function-like macro invocation}} */ - ) + ) /* expected-warning {{empty macro arguments are a C99 feature}} */ two(,) /* expected-warning 2 {{empty macro arguments are a C99 feature}} */ diff --git a/test/Preprocessor/macro_paste_bad.c b/test/Preprocessor/macro_paste_bad.c index 0a028a4..ec10006 100644 --- a/test/Preprocessor/macro_paste_bad.c +++ b/test/Preprocessor/macro_paste_bad.c @@ -32,3 +32,5 @@ XX // expected-error {{attempt to use a poisoned identifier}} #define VA __VA_ ## ARGS__ int VA; // expected-warning {{__VA_ARGS__ can only appear in the expansion of a C99 variadic macro}} +#define LOG_ON_ERROR(x) x ## #y; // expected-error {{'#' is not followed by a macro parameter}} +LOG_ON_ERROR(0); diff --git a/test/Preprocessor/macro_paste_bcpl_comment.c b/test/Preprocessor/macro_paste_bcpl_comment.c index fd07b1f..e915ca6 100644 --- a/test/Preprocessor/macro_paste_bcpl_comment.c +++ b/test/Preprocessor/macro_paste_bcpl_comment.c @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 %s -Eonly 2>&1 | grep error +// RUN: not %clang_cc1 %s -Eonly 2>&1 | grep error #define COMM1 / ## / COMM1 diff --git a/test/Preprocessor/macro_paste_empty.c b/test/Preprocessor/macro_paste_empty.c index 2e26f14..e9b50f0 100644 --- a/test/Preprocessor/macro_paste_empty.c +++ b/test/Preprocessor/macro_paste_empty.c @@ -1,13 +1,17 @@ -// RUN: %clang_cc1 -E %s | grep 'a:Y' -// RUN: %clang_cc1 -E %s | grep 'b:Y' -// RUN: %clang_cc1 -E %s | grep 'c:YY' +// RUN: %clang_cc1 -E %s | FileCheck --strict-whitespace %s #define FOO(X) X ## Y a:FOO() +// CHECK: a:Y #define FOO2(X) Y ## X b:FOO2() +// CHECK: b:Y #define FOO3(X) X ## Y ## X ## Y ## X ## X c:FOO3() +// CHECK: c:YY +#define FOO4(X, Y) X ## Y +d:FOO4(,FOO4(,)) +// CHECK: d:FOO4 diff --git a/test/Preprocessor/macro_paste_msextensions.c b/test/Preprocessor/macro_paste_msextensions.c index c5b4213..afdcdbd 100644 --- a/test/Preprocessor/macro_paste_msextensions.c +++ b/test/Preprocessor/macro_paste_msextensions.c @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -P -E -fms-extensions %s | FileCheck -strict-whitespace %s +// RUN: not %clang_cc1 -P -E -fms-extensions %s | FileCheck -strict-whitespace %s // This horrible stuff should preprocess into (other than whitespace): // int foo; diff --git a/test/Preprocessor/macro_with_initializer_list.cpp b/test/Preprocessor/macro_with_initializer_list.cpp new file mode 100644 index 0000000..287eeb4 --- /dev/null +++ b/test/Preprocessor/macro_with_initializer_list.cpp @@ -0,0 +1,182 @@ +// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s +// RUN: not %clang_cc1 -std=c++11 -fsyntax-only -fdiagnostics-parseable-fixits %s 2>&1 | FileCheck %s +namespace std { + template <class X> + class initializer_list { + public: + initializer_list(); + }; +} + +class Foo { +public: + Foo(); + Foo(std::initializer_list<int>); + bool operator==(const Foo); + Foo operator+(const Foo); +}; + +#define EQ(x,y) (void)(x == y) // expected-note 6{{defined here}} +void test_EQ() { + Foo F; + F = Foo{1,2}; + + EQ(F,F); + EQ(F,Foo()); + EQ(F,Foo({1,2,3})); + EQ(Foo({1,2,3}),F); + EQ((Foo{1,2,3}),(Foo{1,2,3})); + EQ(F, F + F); + EQ(F, Foo({1,2,3}) + Foo({1,2,3})); + EQ(F, (Foo{1,2,3} + Foo{1,2,3})); + + EQ(F,Foo{1,2,3}); + // expected-error@-1 {{too many arguments provided}} + // expected-note@-2 {{parentheses are required}} + EQ(Foo{1,2,3},F); + // expected-error@-1 {{too many arguments provided}} + // expected-note@-2 {{parentheses are required}} + EQ(Foo{1,2,3},Foo{1,2,3}); + // expected-error@-1 {{too many arguments provided}} + // expected-note@-2 {{parentheses are required}} + + EQ(Foo{1,2,3} + Foo{1,2,3}, F); + // expected-error@-1 {{too many arguments provided}} + // expected-note@-2 {{parentheses are required}} + EQ(F, Foo({1,2,3}) + Foo{1,2,3}); + // expected-error@-1 {{too many arguments provided}} + // expected-note@-2 {{parentheses are required}} + EQ(F, Foo{1,2,3} + Foo{1,2,3}); + // expected-error@-1 {{too many arguments provided}} + // expected-note@-2 {{parentheses are required}} +} + +// CHECK: fix-it:"{{.*}}macro_with_initializer_list.cpp":{33:8-33:8}:"(" +// CHECK: fix-it:"{{.*}}macro_with_initializer_list.cpp":{33:18-33:18}:")" + +// CHECK: fix-it:"{{.*}}macro_with_initializer_list.cpp":{36:6-36:6}:"(" +// CHECK: fix-it:"{{.*}}macro_with_initializer_list.cpp":{36:16-36:16}:")" + +// CHECK: fix-it:"{{.*}}macro_with_initializer_list.cpp":{39:6-39:6}:"(" +// CHECK: fix-it:"{{.*}}macro_with_initializer_list.cpp":{39:16-39:16}:")" +// CHECK: fix-it:"{{.*}}macro_with_initializer_list.cpp":{39:17-39:17}:"(" +// CHECK: fix-it:"{{.*}}macro_with_initializer_list.cpp":{39:27-39:27}:")" + +// CHECK: fix-it:"{{.*}}macro_with_initializer_list.cpp":{43:6-43:6}:"(" +// CHECK: fix-it:"{{.*}}macro_with_initializer_list.cpp":{43:29-43:29}:")" + +// CHECK: fix-it:"{{.*}}macro_with_initializer_list.cpp":{46:9-46:9}:"(" +// CHECK: fix-it:"{{.*}}macro_with_initializer_list.cpp":{46:34-46:34}:")" + +// CHECK: fix-it:"{{.*}}macro_with_initializer_list.cpp":{49:9-49:9}:"(" +// CHECK: fix-it:"{{.*}}macro_with_initializer_list.cpp":{49:32-49:32}:")" + +#define NE(x,y) (void)(x != y) // expected-note 6{{defined here}} +// Operator != isn't defined. This tests that the corrected macro arguments +// are used in the macro expansion. +void test_NE() { + Foo F; + + NE(F,F); + // expected-error@-1 {{invalid operands}} + NE(F,Foo()); + // expected-error@-1 {{invalid operands}} + NE(F,Foo({1,2,3})); + // expected-error@-1 {{invalid operands}} + NE((Foo{1,2,3}),(Foo{1,2,3})); + // expected-error@-1 {{invalid operands}} + + NE(F,Foo{1,2,3}); + // expected-error@-1 {{too many arguments provided}} + // expected-note@-2 {{parentheses are required}} + // expected-error@-3 {{invalid operands}} + NE(Foo{1,2,3},F); + // expected-error@-1 {{too many arguments provided}} + // expected-note@-2 {{parentheses are required}} + // expected-error@-3 {{invalid operands}} + NE(Foo{1,2,3},Foo{1,2,3}); + // expected-error@-1 {{too many arguments provided}} + // expected-note@-2 {{parentheses are required}} + // expected-error@-3 {{invalid operands}} + + NE(Foo{1,2,3} + Foo{1,2,3}, F); + // expected-error@-1 {{too many arguments provided}} + // expected-note@-2 {{parentheses are required}} + // expected-error@-3 {{invalid operands}} + NE(F, Foo({1,2,3}) + Foo{1,2,3}); + // expected-error@-1 {{too many arguments provided}} + // expected-note@-2 {{parentheses are required}} + // expected-error@-3 {{invalid operands}} + NE(F, Foo{1,2,3} + Foo{1,2,3}); + // expected-error@-1 {{too many arguments provided}} + // expected-note@-2 {{parentheses are required}} + // expected-error@-3 {{invalid operands}} +} + +// CHECK: fix-it:"{{.*}}macro_with_initializer_list.cpp":{89:8-89:8}:"(" +// CHECK: fix-it:"{{.*}}macro_with_initializer_list.cpp":{89:18-89:18}:")" + +// CHECK: fix-it:"{{.*}}macro_with_initializer_list.cpp":{93:6-93:6}:"(" +// CHECK: fix-it:"{{.*}}macro_with_initializer_list.cpp":{93:16-93:16}:")" + +// CHECK: fix-it:"{{.*}}macro_with_initializer_list.cpp":{97:6-97:6}:"(" +// CHECK: fix-it:"{{.*}}macro_with_initializer_list.cpp":{97:16-97:16}:")" +// CHECK: fix-it:"{{.*}}macro_with_initializer_list.cpp":{97:17-97:17}:"(" +// CHECK: fix-it:"{{.*}}macro_with_initializer_list.cpp":{97:27-97:27}:")" + +// CHECK: fix-it:"{{.*}}macro_with_initializer_list.cpp":{102:6-102:6}:"(" +// CHECK: fix-it:"{{.*}}macro_with_initializer_list.cpp":{102:29-102:29}:")" + +// CHECK: fix-it:"{{.*}}macro_with_initializer_list.cpp":{106:9-106:9}:"(" +// CHECK: fix-it:"{{.*}}macro_with_initializer_list.cpp":{106:34-106:34}:")" + +// CHECK: fix-it:"{{.*}}macro_with_initializer_list.cpp":{110:9-110:9}:"(" +// CHECK: fix-it:"{{.*}}macro_with_initializer_list.cpp":{110:32-110:32}:")" + +#define INIT(var, init) Foo var = init; // expected-note 3{{defined here}} +// Can't use an initializer list as a macro argument. The commas in the list +// will be interpretted as argument separaters and adding parenthesis will +// make it no longer an initializer list. +void test() { + INIT(a, Foo()); + INIT(b, Foo({1, 2, 3})); + INIT(c, Foo()); + + INIT(d, Foo{1, 2, 3}); + // expected-error@-1 {{too many arguments provided}} + // expected-note@-2 {{parentheses are required}} + + // Can't be fixed by parentheses. + INIT(e, {1, 2, 3}); + // expected-error@-1 {{too many arguments provided}} + // expected-error@-2 {{use of undeclared identifier}} + // expected-note@-3 {{cannot use initializer list at the beginning of a macro argument}} + + // Can't be fixed by parentheses. + INIT(e, {1, 2, 3} + {1, 2, 3}); + // expected-error@-1 {{too many arguments provided}} + // expected-error@-2 {{use of undeclared identifier}} + // expected-note@-3 {{cannot use initializer list at the beginning of a macro argument}} +} + +// CHECK: fix-it:"{{.*}}macro_with_initializer_list.cpp":{145:11-145:11}:"(" +// CHECK: fix-it:"{{.*}}macro_with_initializer_list.cpp":{145:23-145:23}:")" + +#define M(name,a,b,c,d,e,f,g,h,i,j,k,l) \ + Foo name = a + b + c + d + e + f + g + h + i + j + k + l; +// expected-note@-2 2{{defined here}} +void test2() { + M(F1, Foo(), Foo(), Foo(), Foo(), Foo(), Foo(), + Foo(), Foo(), Foo(), Foo(), Foo(), Foo()); + + M(F2, Foo{1,2,3}, Foo{1,2,3}, Foo{1,2,3}, Foo{1,2,3}, Foo{1,2,3}, Foo{1,2,3}, + Foo{1,2,3}, Foo{1,2,3}, Foo{1,2,3}, Foo{1,2,3}, Foo{1,2,3}, Foo{1,2,3}); + // expected-error@-2 {{too many arguments provided}} + // expected-note@-3 {{parentheses are required}} + + M(F3, {1,2,3}, {1,2,3}, {1,2,3}, {1,2,3}, {1,2,3}, {1,2,3}, + {1,2,3}, {1,2,3}, {1,2,3}, {1,2,3}, {1,2,3}, {1,2,3}); + // expected-error@-2 {{too many arguments provided}} + // expected-error@-3 {{use of undeclared identifier}} + // expected-note@-4 {{cannot use initializer list at the beginning of a macro argument}} +} diff --git a/test/Preprocessor/microsoft-ext.c b/test/Preprocessor/microsoft-ext.c index ec10374..b03f677 100644 --- a/test/Preprocessor/microsoft-ext.c +++ b/test/Preprocessor/microsoft-ext.c @@ -22,3 +22,15 @@ class GMOCK_ACTION_CLASS_(name, value_params) {\ ACTION_TEMPLATE(InvokeArgument, HAS_1_TEMPLATE_PARAMS(int, k), AND_2_VALUE_PARAMS(p0, p1)); + +// This tests compatibility with behaviour needed for type_traits in VS2012 +// Test based on _VARIADIC_EXPAND_0X macros in xstddef of VS2012 +#define _COMMA , + +#define MAKER(_arg1, _comma, _arg2) \ + void func(_arg1 _comma _arg2) {} +#define MAKE_FUNC(_makerP1, _makerP2, _arg1, _comma, _arg2) \ + _makerP1##_makerP2(_arg1, _comma, _arg2) + +MAKE_FUNC(MAK, ER, int a, _COMMA, int b); +// CHECK: void func(int a , int b) {} diff --git a/test/Preprocessor/optimize.c b/test/Preprocessor/optimize.c index 0167e70..d7da105 100644 --- a/test/Preprocessor/optimize.c +++ b/test/Preprocessor/optimize.c @@ -9,7 +9,7 @@ #endif #endif -// RUN: %clang_cc1 -Eonly %s -DOPT_O0 -O0 -verify +// RUN: %clang_cc1 -Eonly %s -DOPT_O0 -verify #ifdef OPT_O0 // expected-no-diagnostics #ifdef __OPTIMIZE__ diff --git a/test/Preprocessor/pragma_microsoft.c b/test/Preprocessor/pragma_microsoft.c index c0ddf74..e30069c 100644 --- a/test/Preprocessor/pragma_microsoft.c +++ b/test/Preprocessor/pragma_microsoft.c @@ -18,6 +18,11 @@ #pragma comment(user, "foo\abar\nbaz\tsome thing") +#pragma detect_mismatch("test", "1") +#pragma detect_mismatch() // expected-error {{expected string literal in pragma detect_mismatch}} +#pragma detect_mismatch("test") // expected-error {{pragma detect_mismatch is malformed; it requires two comma-separated string literals}} +#pragma detect_mismatch("test", 1) // expected-error {{expected string literal in pragma detect_mismatch}} +#pragma detect_mismatch("test", BAR) // __pragma @@ -82,3 +87,31 @@ void g() {} // Make sure that empty includes don't work #pragma include_alias("", "foo.h") // expected-error {{empty filename}} #pragma include_alias(<foo.h>, <>) // expected-error {{empty filename}} + +// Test that we ignore pragma warning. +#pragma warning(push) +#pragma warning(push, 1) +#pragma warning(disable : 4705) +#pragma warning(disable : 123 456 789 ; error : 321) +#pragma warning(once : 321) +#pragma warning(suppress : 321) +#pragma warning(default : 321) +#pragma warning(pop) + +#pragma warning(push, 0) +// FIXME: We could probably support pushing warning level 0. +#pragma warning(pop) + +#pragma warning // expected-warning {{expected '('}} +#pragma warning( // expected-warning {{expected 'push', 'pop', 'default', 'disable', 'error', 'once', 'suppress', 1, 2, 3, or 4}} +#pragma warning() // expected-warning {{expected 'push', 'pop', 'default', 'disable', 'error', 'once', 'suppress', 1, 2, 3, or 4}} +#pragma warning(push 4) // expected-warning {{expected ')'}} +#pragma warning(push // expected-warning {{expected ')'}} +#pragma warning(push, 5) // expected-warning {{requires a level between 0 and 4}} +#pragma warning(pop, 1) // expected-warning {{expected ')'}} +#pragma warning(push, 1) asdf // expected-warning {{extra tokens at end of #pragma warning directive}} +#pragma warning(disable 4705) // expected-warning {{expected ':'}} +#pragma warning(disable : 0) // expected-warning {{expected a warning number}} +#pragma warning(default 321) // expected-warning {{expected ':'}} +#pragma warning(asdf : 321) // expected-warning {{expected 'push', 'pop'}} +#pragma warning(push, -1) // expected-warning {{requires a level between 0 and 4}} diff --git a/test/Preprocessor/pragma_microsoft.cpp b/test/Preprocessor/pragma_microsoft.cpp new file mode 100644 index 0000000..e097d69 --- /dev/null +++ b/test/Preprocessor/pragma_microsoft.cpp @@ -0,0 +1,3 @@ +// RUN: %clang_cc1 %s -fsyntax-only -std=c++11 -verify -fms-extensions + +#pragma warning(push, 4_D) // expected-warning {{requires a level between 0 and 4}} diff --git a/test/Preprocessor/predefined-arch-macros.c b/test/Preprocessor/predefined-arch-macros.c index d0125cd..26298f9 100644 --- a/test/Preprocessor/predefined-arch-macros.c +++ b/test/Preprocessor/predefined-arch-macros.c @@ -1,6 +1,3 @@ -// These tests are generated by running utils/generate_arch_predefine_tests.sh -// to observe GCC's behavior (or some other system compiler's behavior). -// // Begin X86/GCC/Linux tests ---------------- // // RUN: %clang -march=i386 -m32 -E -dM %s -o - 2>&1 \ @@ -10,7 +7,7 @@ // CHECK_I386_M32: #define __i386__ 1 // CHECK_I386_M32: #define __tune_i386__ 1 // CHECK_I386_M32: #define i386 1 -// RUN: %clang -march=i386 -m64 -E -dM %s -o - 2>&1 \ +// RUN: not %clang -march=i386 -m64 -E -dM %s -o - 2>&1 \ // RUN: -target i386-unknown-linux \ // RUN: | FileCheck %s -check-prefix=CHECK_I386_M64 // CHECK_I386_M64: error: @@ -24,7 +21,7 @@ // CHECK_I486_M32: #define __i486__ 1 // CHECK_I486_M32: #define __tune_i486__ 1 // CHECK_I486_M32: #define i386 1 -// RUN: %clang -march=i486 -m64 -E -dM %s -o - 2>&1 \ +// RUN: not %clang -march=i486 -m64 -E -dM %s -o - 2>&1 \ // RUN: -target i386-unknown-linux \ // RUN: | FileCheck %s -check-prefix=CHECK_I486_M64 // CHECK_I486_M64: error: @@ -41,7 +38,7 @@ // CHECK_I586_M32: #define __tune_i586__ 1 // CHECK_I586_M32: #define __tune_pentium__ 1 // CHECK_I586_M32: #define i386 1 -// RUN: %clang -march=i586 -m64 -E -dM %s -o - 2>&1 \ +// RUN: not %clang -march=i586 -m64 -E -dM %s -o - 2>&1 \ // RUN: -target i386-unknown-linux \ // RUN: | FileCheck %s -check-prefix=CHECK_I586_M64 // CHECK_I586_M64: error: @@ -58,7 +55,7 @@ // CHECK_PENTIUM_M32: #define __tune_i586__ 1 // CHECK_PENTIUM_M32: #define __tune_pentium__ 1 // CHECK_PENTIUM_M32: #define i386 1 -// RUN: %clang -march=pentium -m64 -E -dM %s -o - 2>&1 \ +// RUN: not %clang -march=pentium -m64 -E -dM %s -o - 2>&1 \ // RUN: -target i386-unknown-linux \ // RUN: | FileCheck %s -check-prefix=CHECK_PENTIUM_M64 // CHECK_PENTIUM_M64: error: @@ -78,7 +75,7 @@ // CHECK_PENTIUM_MMX_M32: #define __tune_pentium__ 1 // CHECK_PENTIUM_MMX_M32: #define __tune_pentium_mmx__ 1 // CHECK_PENTIUM_MMX_M32: #define i386 1 -// RUN: %clang -march=pentium-mmx -m64 -E -dM %s -o - 2>&1 \ +// RUN: not %clang -march=pentium-mmx -m64 -E -dM %s -o - 2>&1 \ // RUN: -target i386-unknown-linux \ // RUN: | FileCheck %s -check-prefix=CHECK_PENTIUM_MMX_M64 // CHECK_PENTIUM_MMX_M64: error: @@ -93,7 +90,7 @@ // CHECK_WINCHIP_C6_M32: #define __i486__ 1 // CHECK_WINCHIP_C6_M32: #define __tune_i486__ 1 // CHECK_WINCHIP_C6_M32: #define i386 1 -// RUN: %clang -march=winchip-c6 -m64 -E -dM %s -o - 2>&1 \ +// RUN: not %clang -march=winchip-c6 -m64 -E -dM %s -o - 2>&1 \ // RUN: -target i386-unknown-linux \ // RUN: | FileCheck %s -check-prefix=CHECK_WINCHIP_C6_M64 // CHECK_WINCHIP_C6_M64: error: @@ -109,7 +106,7 @@ // CHECK_WINCHIP2_M32: #define __i486__ 1 // CHECK_WINCHIP2_M32: #define __tune_i486__ 1 // CHECK_WINCHIP2_M32: #define i386 1 -// RUN: %clang -march=winchip2 -m64 -E -dM %s -o - 2>&1 \ +// RUN: not %clang -march=winchip2 -m64 -E -dM %s -o - 2>&1 \ // RUN: -target i386-unknown-linux \ // RUN: | FileCheck %s -check-prefix=CHECK_WINCHIP2_M64 // CHECK_WINCHIP2_M64: error: @@ -125,7 +122,7 @@ // CHECK_C3_M32: #define __i486__ 1 // CHECK_C3_M32: #define __tune_i486__ 1 // CHECK_C3_M32: #define i386 1 -// RUN: %clang -march=c3 -m64 -E -dM %s -o - 2>&1 \ +// RUN: not %clang -march=c3 -m64 -E -dM %s -o - 2>&1 \ // RUN: -target i386-unknown-linux \ // RUN: | FileCheck %s -check-prefix=CHECK_C3_M64 // CHECK_C3_M64: error: @@ -145,7 +142,7 @@ // CHECK_C3_2_M32: #define __tune_pentium2__ 1 // CHECK_C3_2_M32: #define __tune_pentiumpro__ 1 // CHECK_C3_2_M32: #define i386 1 -// RUN: %clang -march=c3-2 -m64 -E -dM %s -o - 2>&1 \ +// RUN: not %clang -march=c3-2 -m64 -E -dM %s -o - 2>&1 \ // RUN: -target i386-unknown-linux \ // RUN: | FileCheck %s -check-prefix=CHECK_C3_2_M64 // CHECK_C3_2_M64: error: @@ -160,7 +157,7 @@ // CHECK_I686_M32: #define __pentiumpro 1 // CHECK_I686_M32: #define __pentiumpro__ 1 // CHECK_I686_M32: #define i386 1 -// RUN: %clang -march=i686 -m64 -E -dM %s -o - 2>&1 \ +// RUN: not %clang -march=i686 -m64 -E -dM %s -o - 2>&1 \ // RUN: -target i386-unknown-linux \ // RUN: | FileCheck %s -check-prefix=CHECK_I686_M64 // CHECK_I686_M64: error: @@ -177,7 +174,7 @@ // CHECK_PENTIUMPRO_M32: #define __tune_i686__ 1 // CHECK_PENTIUMPRO_M32: #define __tune_pentiumpro__ 1 // CHECK_PENTIUMPRO_M32: #define i386 1 -// RUN: %clang -march=pentiumpro -m64 -E -dM %s -o - 2>&1 \ +// RUN: not %clang -march=pentiumpro -m64 -E -dM %s -o - 2>&1 \ // RUN: -target i386-unknown-linux \ // RUN: | FileCheck %s -check-prefix=CHECK_PENTIUMPRO_M64 // CHECK_PENTIUMPRO_M64: error: @@ -196,7 +193,7 @@ // CHECK_PENTIUM2_M32: #define __tune_pentium2__ 1 // CHECK_PENTIUM2_M32: #define __tune_pentiumpro__ 1 // CHECK_PENTIUM2_M32: #define i386 1 -// RUN: %clang -march=pentium2 -m64 -E -dM %s -o - 2>&1 \ +// RUN: not %clang -march=pentium2 -m64 -E -dM %s -o - 2>&1 \ // RUN: -target i386-unknown-linux \ // RUN: | FileCheck %s -check-prefix=CHECK_PENTIUM2_M64 // CHECK_PENTIUM2_M64: error: @@ -217,7 +214,7 @@ // CHECK_PENTIUM3_M32: #define __tune_pentium3__ 1 // CHECK_PENTIUM3_M32: #define __tune_pentiumpro__ 1 // CHECK_PENTIUM3_M32: #define i386 1 -// RUN: %clang -march=pentium3 -m64 -E -dM %s -o - 2>&1 \ +// RUN: not %clang -march=pentium3 -m64 -E -dM %s -o - 2>&1 \ // RUN: -target i386-unknown-linux \ // RUN: | FileCheck %s -check-prefix=CHECK_PENTIUM3_M64 // CHECK_PENTIUM3_M64: error: @@ -236,7 +233,7 @@ // CHECK_PENTIUM3M_M32: #define __tune_i686__ 1 // CHECK_PENTIUM3M_M32: #define __tune_pentiumpro__ 1 // CHECK_PENTIUM3M_M32: #define i386 1 -// RUN: %clang -march=pentium3m -m64 -E -dM %s -o - 2>&1 \ +// RUN: not %clang -march=pentium3m -m64 -E -dM %s -o - 2>&1 \ // RUN: -target i386-unknown-linux \ // RUN: | FileCheck %s -check-prefix=CHECK_PENTIUM3M_M64 // CHECK_PENTIUM3M_M64: error: @@ -256,7 +253,7 @@ // CHECK_PENTIUM_M_M32: #define __tune_i686__ 1 // CHECK_PENTIUM_M_M32: #define __tune_pentiumpro__ 1 // CHECK_PENTIUM_M_M32: #define i386 1 -// RUN: %clang -march=pentium-m -m64 -E -dM %s -o - 2>&1 \ +// RUN: not %clang -march=pentium-m -m64 -E -dM %s -o - 2>&1 \ // RUN: -target i386-unknown-linux \ // RUN: | FileCheck %s -check-prefix=CHECK_PENTIUM_M_M64 // CHECK_PENTIUM_M_M64: error: @@ -273,7 +270,7 @@ // CHECK_PENTIUM4_M32: #define __pentium4__ 1 // CHECK_PENTIUM4_M32: #define __tune_pentium4__ 1 // CHECK_PENTIUM4_M32: #define i386 1 -// RUN: %clang -march=pentium4 -m64 -E -dM %s -o - 2>&1 \ +// RUN: not %clang -march=pentium4 -m64 -E -dM %s -o - 2>&1 \ // RUN: -target i386-unknown-linux \ // RUN: | FileCheck %s -check-prefix=CHECK_PENTIUM4_M64 // CHECK_PENTIUM4_M64: error: @@ -290,7 +287,7 @@ // CHECK_PENTIUM4M_M32: #define __pentium4__ 1 // CHECK_PENTIUM4M_M32: #define __tune_pentium4__ 1 // CHECK_PENTIUM4M_M32: #define i386 1 -// RUN: %clang -march=pentium4m -m64 -E -dM %s -o - 2>&1 \ +// RUN: not %clang -march=pentium4m -m64 -E -dM %s -o - 2>&1 \ // RUN: -target i386-unknown-linux \ // RUN: | FileCheck %s -check-prefix=CHECK_PENTIUM4M_M64 // CHECK_PENTIUM4M_M64: error: @@ -308,7 +305,7 @@ // CHECK_PRESCOTT_M32: #define __nocona__ 1 // CHECK_PRESCOTT_M32: #define __tune_nocona__ 1 // CHECK_PRESCOTT_M32: #define i386 1 -// RUN: %clang -march=prescott -m64 -E -dM %s -o - 2>&1 \ +// RUN: not %clang -march=prescott -m64 -E -dM %s -o - 2>&1 \ // RUN: -target i386-unknown-linux \ // RUN: | FileCheck %s -check-prefix=CHECK_PRESCOTT_M64 // CHECK_PRESCOTT_M64: error: @@ -509,6 +506,7 @@ // RUN: -target i386-unknown-linux \ // RUN: | FileCheck %s -check-prefix=CHECK_CORE_AVX2_M32 // CHECK_CORE_AVX2_M32: #define __AES__ 1 +// CHECK_CORE_AVX2_M32: #define __AVX2__ 1 // CHECK_CORE_AVX2_M32: #define __AVX__ 1 // CHECK_CORE_AVX2_M32: #define __BMI2__ 1 // CHECK_CORE_AVX2_M32: #define __BMI__ 1 @@ -536,6 +534,7 @@ // RUN: -target i386-unknown-linux \ // RUN: | FileCheck %s -check-prefix=CHECK_CORE_AVX2_M64 // CHECK_CORE_AVX2_M64: #define __AES__ 1 +// CHECK_CORE_AVX2_M64: #define __AVX2__ 1 // CHECK_CORE_AVX2_M64: #define __AVX__ 1 // CHECK_CORE_AVX2_M64: #define __BMI2__ 1 // CHECK_CORE_AVX2_M64: #define __BMI__ 1 @@ -563,6 +562,74 @@ // CHECK_CORE_AVX2_M64: #define __x86_64 1 // CHECK_CORE_AVX2_M64: #define __x86_64__ 1 // +// RUN: %clang -march=knl -m32 -E -dM %s -o - 2>&1 \ +// RUN: -target i386-unknown-linux \ +// RUN: | FileCheck %s -check-prefix=CHECK_KNL_M32 +// CHECK_KNL_M32: #define __AES__ 1 +// CHECK_KNL_M32: #define __AVX2__ 1 +// CHECK_KNL_M32: #define __AVX512CD__ 1 +// CHECK_KNL_M32: #define __AVX512ER__ 1 +// CHECK_KNL_M32: #define __AVX512F__ 1 +// CHECK_KNL_M32: #define __AVX512PF__ 1 +// CHECK_KNL_M32: #define __AVX__ 1 +// CHECK_KNL_M32: #define __BMI2__ 1 +// CHECK_KNL_M32: #define __BMI__ 1 +// CHECK_KNL_M32: #define __F16C__ 1 +// CHECK_KNL_M32: #define __FMA__ 1 +// CHECK_KNL_M32: #define __LZCNT__ 1 +// CHECK_KNL_M32: #define __MMX__ 1 +// CHECK_KNL_M32: #define __PCLMUL__ 1 +// CHECK_KNL_M32: #define __POPCNT__ 1 +// CHECK_KNL_M32: #define __RDRND__ 1 +// CHECK_KNL_M32: #define __RTM__ 1 +// CHECK_KNL_M32: #define __SSE2__ 1 +// CHECK_KNL_M32: #define __SSE3__ 1 +// CHECK_KNL_M32: #define __SSE4_1__ 1 +// CHECK_KNL_M32: #define __SSE4_2__ 1 +// CHECK_KNL_M32: #define __SSE__ 1 +// CHECK_KNL_M32: #define __SSSE3__ 1 +// CHECK_KNL_M32: #define __i386 1 +// CHECK_KNL_M32: #define __i386__ 1 +// CHECK_KNL_M32: #define __knl 1 +// CHECK_KNL_M32: #define __knl__ 1 +// CHECK_KNL_M32: #define __tune_knl__ 1 +// CHECK_KNL_M32: #define i386 1 +// RUN: %clang -march=knl -m64 -E -dM %s -o - 2>&1 \ +// RUN: -target i386-unknown-linux \ +// RUN: | FileCheck %s -check-prefix=CHECK_KNL_M64 +// CHECK_KNL_M64: #define __AES__ 1 +// CHECK_KNL_M64: #define __AVX2__ 1 +// CHECK_KNL_M64: #define __AVX512CD__ 1 +// CHECK_KNL_M64: #define __AVX512ER__ 1 +// CHECK_KNL_M64: #define __AVX512F__ 1 +// CHECK_KNL_M64: #define __AVX512PF__ 1 +// CHECK_KNL_M64: #define __AVX__ 1 +// CHECK_KNL_M64: #define __BMI2__ 1 +// CHECK_KNL_M64: #define __BMI__ 1 +// CHECK_KNL_M64: #define __F16C__ 1 +// CHECK_KNL_M64: #define __FMA__ 1 +// CHECK_KNL_M64: #define __LZCNT__ 1 +// CHECK_KNL_M64: #define __MMX__ 1 +// CHECK_KNL_M64: #define __PCLMUL__ 1 +// CHECK_KNL_M64: #define __POPCNT__ 1 +// CHECK_KNL_M64: #define __RDRND__ 1 +// CHECK_KNL_M64: #define __RTM__ 1 +// CHECK_KNL_M64: #define __SSE2_MATH__ 1 +// CHECK_KNL_M64: #define __SSE2__ 1 +// CHECK_KNL_M64: #define __SSE3__ 1 +// CHECK_KNL_M64: #define __SSE4_1__ 1 +// CHECK_KNL_M64: #define __SSE4_2__ 1 +// CHECK_KNL_M64: #define __SSE_MATH__ 1 +// CHECK_KNL_M64: #define __SSE__ 1 +// CHECK_KNL_M64: #define __SSSE3__ 1 +// CHECK_KNL_M64: #define __amd64 1 +// CHECK_KNL_M64: #define __amd64__ 1 +// CHECK_KNL_M64: #define __knl 1 +// CHECK_KNL_M64: #define __knl__ 1 +// CHECK_KNL_M64: #define __tune_knl__ 1 +// CHECK_KNL_M64: #define __x86_64 1 +// CHECK_KNL_M64: #define __x86_64__ 1 +// // RUN: %clang -march=atom -m32 -E -dM %s -o - 2>&1 \ // RUN: -target i386-unknown-linux \ // RUN: | FileCheck %s -check-prefix=CHECK_ATOM_M32 @@ -595,6 +662,42 @@ // CHECK_ATOM_M64: #define __x86_64 1 // CHECK_ATOM_M64: #define __x86_64__ 1 // +// RUN: %clang -march=slm -m32 -E -dM %s -o - 2>&1 \ +// RUN: -target i386-unknown-linux \ +// RUN: | FileCheck %s -check-prefix=CHECK_SLM_M32 +// CHECK_SLM_M32: #define __MMX__ 1 +// CHECK_SLM_M32: #define __SSE2__ 1 +// CHECK_SLM_M32: #define __SSE3__ 1 +// CHECK_SLM_M32: #define __SSE4_1__ 1 +// CHECK_SLM_M32: #define __SSE4_2__ 1 +// CHECK_SLM_M32: #define __SSE__ 1 +// CHECK_SLM_M32: #define __SSSE3__ 1 +// CHECK_SLM_M32: #define __i386 1 +// CHECK_SLM_M32: #define __i386__ 1 +// CHECK_SLM_M32: #define __slm 1 +// CHECK_SLM_M32: #define __slm__ 1 +// CHECK_SLM_M32: #define __tune_slm__ 1 +// CHECK_SLM_M32: #define i386 1 +// RUN: %clang -march=slm -m64 -E -dM %s -o - 2>&1 \ +// RUN: -target i386-unknown-linux \ +// RUN: | FileCheck %s -check-prefix=CHECK_SLM_M64 +// CHECK_SLM_M64: #define __MMX__ 1 +// CHECK_SLM_M64: #define __SSE2_MATH__ 1 +// CHECK_SLM_M64: #define __SSE2__ 1 +// CHECK_SLM_M64: #define __SSE3__ 1 +// CHECK_SLM_M64: #define __SSE4_1__ 1 +// CHECK_SLM_M64: #define __SSE4_2__ 1 +// CHECK_SLM_M64: #define __SSE_MATH__ 1 +// CHECK_SLM_M64: #define __SSE__ 1 +// CHECK_SLM_M64: #define __SSSE3__ 1 +// CHECK_SLM_M64: #define __amd64 1 +// CHECK_SLM_M64: #define __amd64__ 1 +// CHECK_SLM_M64: #define __slm 1 +// CHECK_SLM_M64: #define __slm__ 1 +// CHECK_SLM_M64: #define __tune_slm__ 1 +// CHECK_SLM_M64: #define __x86_64 1 +// CHECK_SLM_M64: #define __x86_64__ 1 +// // RUN: %clang -march=geode -m32 -E -dM %s -o - 2>&1 \ // RUN: -target i386-unknown-linux \ // RUN: | FileCheck %s -check-prefix=CHECK_GEODE_M32 @@ -607,7 +710,7 @@ // CHECK_GEODE_M32: #define __i386__ 1 // CHECK_GEODE_M32: #define __tune_geode__ 1 // CHECK_GEODE_M32: #define i386 1 -// RUN: %clang -march=geode -m64 -E -dM %s -o - 2>&1 \ +// RUN: not %clang -march=geode -m64 -E -dM %s -o - 2>&1 \ // RUN: -target i386-unknown-linux \ // RUN: | FileCheck %s -check-prefix=CHECK_GEODE_M64 // CHECK_GEODE_M64: error: @@ -622,7 +725,7 @@ // CHECK_K6_M32: #define __k6__ 1 // CHECK_K6_M32: #define __tune_k6__ 1 // CHECK_K6_M32: #define i386 1 -// RUN: %clang -march=k6 -m64 -E -dM %s -o - 2>&1 \ +// RUN: not %clang -march=k6 -m64 -E -dM %s -o - 2>&1 \ // RUN: -target i386-unknown-linux \ // RUN: | FileCheck %s -check-prefix=CHECK_K6_M64 // CHECK_K6_M64: error: @@ -640,7 +743,7 @@ // CHECK_K6_2_M32: #define __tune_k6_2__ 1 // CHECK_K6_2_M32: #define __tune_k6__ 1 // CHECK_K6_2_M32: #define i386 1 -// RUN: %clang -march=k6-2 -m64 -E -dM %s -o - 2>&1 \ +// RUN: not %clang -march=k6-2 -m64 -E -dM %s -o - 2>&1 \ // RUN: -target i386-unknown-linux \ // RUN: | FileCheck %s -check-prefix=CHECK_K6_2_M64 // CHECK_K6_2_M64: error: @@ -658,7 +761,7 @@ // CHECK_K6_3_M32: #define __tune_k6_3__ 1 // CHECK_K6_3_M32: #define __tune_k6__ 1 // CHECK_K6_3_M32: #define i386 1 -// RUN: %clang -march=k6-3 -m64 -E -dM %s -o - 2>&1 \ +// RUN: not %clang -march=k6-3 -m64 -E -dM %s -o - 2>&1 \ // RUN: -target i386-unknown-linux \ // RUN: | FileCheck %s -check-prefix=CHECK_K6_3_M64 // CHECK_K6_3_M64: error: @@ -675,7 +778,7 @@ // CHECK_ATHLON_M32: #define __i386__ 1 // CHECK_ATHLON_M32: #define __tune_athlon__ 1 // CHECK_ATHLON_M32: #define i386 1 -// RUN: %clang -march=athlon -m64 -E -dM %s -o - 2>&1 \ +// RUN: not %clang -march=athlon -m64 -E -dM %s -o - 2>&1 \ // RUN: -target i386-unknown-linux \ // RUN: | FileCheck %s -check-prefix=CHECK_ATHLON_M64 // CHECK_ATHLON_M64: error: @@ -692,7 +795,7 @@ // CHECK_ATHLON_TBIRD_M32: #define __i386__ 1 // CHECK_ATHLON_TBIRD_M32: #define __tune_athlon__ 1 // CHECK_ATHLON_TBIRD_M32: #define i386 1 -// RUN: %clang -march=athlon-tbird -m64 -E -dM %s -o - 2>&1 \ +// RUN: not %clang -march=athlon-tbird -m64 -E -dM %s -o - 2>&1 \ // RUN: -target i386-unknown-linux \ // RUN: | FileCheck %s -check-prefix=CHECK_ATHLON_TBIRD_M64 // CHECK_ATHLON_TBIRD_M64: error: @@ -712,7 +815,7 @@ // CHECK_ATHLON_4_M32: #define __tune_athlon__ 1 // CHECK_ATHLON_4_M32: #define __tune_athlon_sse__ 1 // CHECK_ATHLON_4_M32: #define i386 1 -// RUN: %clang -march=athlon-4 -m64 -E -dM %s -o - 2>&1 \ +// RUN: not %clang -march=athlon-4 -m64 -E -dM %s -o - 2>&1 \ // RUN: -target i386-unknown-linux \ // RUN: | FileCheck %s -check-prefix=CHECK_ATHLON_4_M64 // CHECK_ATHLON_4_M64: error: @@ -732,7 +835,7 @@ // CHECK_ATHLON_XP_M32: #define __tune_athlon__ 1 // CHECK_ATHLON_XP_M32: #define __tune_athlon_sse__ 1 // CHECK_ATHLON_XP_M32: #define i386 1 -// RUN: %clang -march=athlon-xp -m64 -E -dM %s -o - 2>&1 \ +// RUN: not %clang -march=athlon-xp -m64 -E -dM %s -o - 2>&1 \ // RUN: -target i386-unknown-linux \ // RUN: | FileCheck %s -check-prefix=CHECK_ATHLON_XP_M64 // CHECK_ATHLON_XP_M64: error: @@ -752,7 +855,7 @@ // CHECK_ATHLON_MP_M32: #define __tune_athlon__ 1 // CHECK_ATHLON_MP_M32: #define __tune_athlon_sse__ 1 // CHECK_ATHLON_MP_M32: #define i386 1 -// RUN: %clang -march=athlon-mp -m64 -E -dM %s -o - 2>&1 \ +// RUN: not %clang -march=athlon-mp -m64 -E -dM %s -o - 2>&1 \ // RUN: -target i386-unknown-linux \ // RUN: | FileCheck %s -check-prefix=CHECK_ATHLON_MP_M64 // CHECK_ATHLON_MP_M64: error: @@ -1060,6 +1163,7 @@ // CHECK_BTVER1_M32: #define __LZCNT__ 1 // CHECK_BTVER1_M32: #define __MMX__ 1 // CHECK_BTVER1_M32: #define __POPCNT__ 1 +// CHECK_BTVER1_M32: #define __PRFCHW__ 1 // CHECK_BTVER1_M32: #define __SSE2_MATH__ 1 // CHECK_BTVER1_M32: #define __SSE2__ 1 // CHECK_BTVER1_M32: #define __SSE3__ 1 @@ -1080,6 +1184,7 @@ // CHECK_BTVER1_M64: #define __LZCNT__ 1 // CHECK_BTVER1_M64: #define __MMX__ 1 // CHECK_BTVER1_M64: #define __POPCNT__ 1 +// CHECK_BTVER1_M64: #define __PRFCHW__ 1 // CHECK_BTVER1_M64: #define __SSE2_MATH__ 1 // CHECK_BTVER1_M64: #define __SSE2__ 1 // CHECK_BTVER1_M64: #define __SSE3__ 1 @@ -1104,6 +1209,7 @@ // CHECK_BTVER2_M32: #define __LZCNT__ 1 // CHECK_BTVER2_M32: #define __MMX__ 1 // CHECK_BTVER2_M32: #define __POPCNT__ 1 +// CHECK_BTVER2_M32: #define __PRFCHW__ 1 // CHECK_BTVER2_M32: #define __SSE2_MATH__ 1 // CHECK_BTVER2_M32: #define __SSE2__ 1 // CHECK_BTVER2_M32: #define __SSE3__ 1 @@ -1126,6 +1232,7 @@ // CHECK_BTVER2_M64: #define __LZCNT__ 1 // CHECK_BTVER2_M64: #define __MMX__ 1 // CHECK_BTVER2_M64: #define __POPCNT__ 1 +// CHECK_BTVER2_M64: #define __PRFCHW__ 1 // CHECK_BTVER2_M64: #define __SSE2_MATH__ 1 // CHECK_BTVER2_M64: #define __SSE2__ 1 // CHECK_BTVER2_M64: #define __SSE3__ 1 @@ -1152,6 +1259,7 @@ // CHECK_BDVER1_M32: #define __MMX__ 1 // CHECK_BDVER1_M32: #define __PCLMUL__ 1 // CHECK_BDVER1_M32: #define __POPCNT__ 1 +// CHECK_BDVER1_M32: #define __PRFCHW__ 1 // CHECK_BDVER1_M32: #define __SSE2_MATH__ 1 // CHECK_BDVER1_M32: #define __SSE2__ 1 // CHECK_BDVER1_M32: #define __SSE3__ 1 @@ -1179,6 +1287,7 @@ // CHECK_BDVER1_M64: #define __MMX__ 1 // CHECK_BDVER1_M64: #define __PCLMUL__ 1 // CHECK_BDVER1_M64: #define __POPCNT__ 1 +// CHECK_BDVER1_M64: #define __PRFCHW__ 1 // CHECK_BDVER1_M64: #define __SSE2_MATH__ 1 // CHECK_BDVER1_M64: #define __SSE2__ 1 // CHECK_BDVER1_M64: #define __SSE3__ 1 @@ -1211,6 +1320,7 @@ // CHECK_BDVER2_M32: #define __MMX__ 1 // CHECK_BDVER2_M32: #define __PCLMUL__ 1 // CHECK_BDVER2_M32: #define __POPCNT__ 1 +// CHECK_BDVER2_M32: #define __PRFCHW__ 1 // CHECK_BDVER2_M32: #define __SSE2_MATH__ 1 // CHECK_BDVER2_M32: #define __SSE2__ 1 // CHECK_BDVER2_M32: #define __SSE3__ 1 @@ -1220,6 +1330,7 @@ // CHECK_BDVER2_M32: #define __SSE_MATH__ 1 // CHECK_BDVER2_M32: #define __SSE__ 1 // CHECK_BDVER2_M32: #define __SSSE3__ 1 +// CHECK_BDVER2_M32: #define __TBM__ 1 // CHECK_BDVER2_M32: #define __XOP__ 1 // CHECK_BDVER2_M32: #define __bdver2 1 // CHECK_BDVER2_M32: #define __bdver2__ 1 @@ -1241,6 +1352,7 @@ // CHECK_BDVER2_M64: #define __MMX__ 1 // CHECK_BDVER2_M64: #define __PCLMUL__ 1 // CHECK_BDVER2_M64: #define __POPCNT__ 1 +// CHECK_BDVER2_M64: #define __PRFCHW__ 1 // CHECK_BDVER2_M64: #define __SSE2_MATH__ 1 // CHECK_BDVER2_M64: #define __SSE2__ 1 // CHECK_BDVER2_M64: #define __SSE3__ 1 @@ -1250,6 +1362,7 @@ // CHECK_BDVER2_M64: #define __SSE_MATH__ 1 // CHECK_BDVER2_M64: #define __SSE__ 1 // CHECK_BDVER2_M64: #define __SSSE3__ 1 +// CHECK_BDVER2_M64: #define __TBM__ 1 // CHECK_BDVER2_M64: #define __XOP__ 1 // CHECK_BDVER2_M64: #define __amd64 1 // CHECK_BDVER2_M64: #define __amd64__ 1 @@ -1258,5 +1371,78 @@ // CHECK_BDVER2_M64: #define __tune_bdver2__ 1 // CHECK_BDVER2_M64: #define __x86_64 1 // CHECK_BDVER2_M64: #define __x86_64__ 1 +// RUN: %clang -march=bdver3 -m32 -E -dM %s -o - 2>&1 \ +// RUN: -target i386-unknown-linux \ +// RUN: | FileCheck %s -check-prefix=CHECK_BDVER3_M32 +// CHECK_BDVER3_M32-NOT: #define __3dNOW_A__ 1 +// CHECK_BDVER3_M32-NOT: #define __3dNOW__ 1 +// CHECK_BDVER3_M32: #define __AES__ 1 +// CHECK_BDVER3_M32: #define __AVX__ 1 +// CHECK_BDVER3_M32: #define __BMI__ 1 +// CHECK_BDVER3_M32: #define __F16C__ 1 +// CHECK_BDVER3_M32: #define __FMA4__ 1 +// CHECK_BDVER3_M32: #define __FMA__ 1 +// CHECK_BDVER3_M32: #define __LZCNT__ 1 +// CHECK_BDVER3_M32: #define __MMX__ 1 +// CHECK_BDVER3_M32: #define __PCLMUL__ 1 +// CHECK_BDVER3_M32: #define __POPCNT__ 1 +// CHECK_BDVER3_M32: #define __PRFCHW__ 1 +// CHECK_BDVER3_M32: #define __SSE2_MATH__ 1 +// CHECK_BDVER3_M32: #define __SSE2__ 1 +// CHECK_BDVER3_M32: #define __SSE3__ 1 +// CHECK_BDVER3_M32: #define __SSE4A__ 1 +// CHECK_BDVER3_M32: #define __SSE4_1__ 1 +// CHECK_BDVER3_M32: #define __SSE4_2__ 1 +// CHECK_BDVER3_M32: #define __SSE_MATH__ 1 +// CHECK_BDVER3_M32: #define __SSE__ 1 +// CHECK_BDVER3_M32: #define __SSSE3__ 1 +// CHECK_BDVER3_M32: #define __TBM__ 1 +// CHECK_BDVER3_M32: #define __XOP__ 1 +// CHECK_BDVER3_M32: #define __bdver3 1 +// CHECK_BDVER3_M32: #define __bdver3__ 1 +// CHECK_BDVER3_M32: #define __i386 1 +// CHECK_BDVER3_M32: #define __i386__ 1 +// CHECK_BDVER3_M32: #define __tune_bdver3__ 1 +// RUN: %clang -march=bdver3 -m64 -E -dM %s -o - 2>&1 \ +// RUN: -target i386-unknown-linux \ +// RUN: | FileCheck %s -check-prefix=CHECK_BDVER3_M64 +// CHECK_BDVER3_M64-NOT: #define __3dNOW_A__ 1 +// CHECK_BDVER3_M64-NOT: #define __3dNOW__ 1 +// CHECK_BDVER3_M64: #define __AES__ 1 +// CHECK_BDVER3_M64: #define __AVX__ 1 +// CHECK_BDVER3_M64: #define __BMI__ 1 +// CHECK_BDVER3_M64: #define __F16C__ 1 +// CHECK_BDVER3_M64: #define __FMA4__ 1 +// CHECK_BDVER3_M64: #define __FMA__ 1 +// CHECK_BDVER3_M64: #define __LZCNT__ 1 +// CHECK_BDVER3_M64: #define __MMX__ 1 +// CHECK_BDVER3_M64: #define __PCLMUL__ 1 +// CHECK_BDVER3_M64: #define __POPCNT__ 1 +// CHECK_BDVER3_M64: #define __PRFCHW__ 1 +// CHECK_BDVER3_M64: #define __SSE2_MATH__ 1 +// CHECK_BDVER3_M64: #define __SSE2__ 1 +// CHECK_BDVER3_M64: #define __SSE3__ 1 +// CHECK_BDVER3_M64: #define __SSE4A__ 1 +// CHECK_BDVER3_M64: #define __SSE4_1__ 1 +// CHECK_BDVER3_M64: #define __SSE4_2__ 1 +// CHECK_BDVER3_M64: #define __SSE_MATH__ 1 +// CHECK_BDVER3_M64: #define __SSE__ 1 +// CHECK_BDVER3_M64: #define __SSSE3__ 1 +// CHECK_BDVER3_M64: #define __TBM__ 1 +// CHECK_BDVER3_M64: #define __XOP__ 1 +// CHECK_BDVER3_M64: #define __amd64 1 +// CHECK_BDVER3_M64: #define __amd64__ 1 +// CHECK_BDVER3_M64: #define __bdver3 1 +// CHECK_BDVER3_M64: #define __bdver3__ 1 +// CHECK_BDVER3_M64: #define __tune_bdver3__ 1 +// CHECK_BDVER3_M64: #define __x86_64 1 +// CHECK_BDVER3_M64: #define __x86_64__ 1 // // End X86/GCC/Linux tests ------------------ + +// Begin PPC/GCC/Linux tests ---------------- +// RUN: %clang -mvsx -E -dM %s -o - 2>&1 \ +// RUN: -target powerpc64-unknown-linux \ +// RUN: | FileCheck %s -check-prefix=CHECK_PPC_VSX_M64 +// +// CHECK_PPC_VSX_M64: #define __VSX__ diff --git a/test/Preprocessor/predefined-macros.c b/test/Preprocessor/predefined-macros.c index 94671f3..11449f9 100644 --- a/test/Preprocessor/predefined-macros.c +++ b/test/Preprocessor/predefined-macros.c @@ -44,3 +44,21 @@ // CHECK-SYNC_CAS_I586: __GCC_HAVE_SYNC_COMPARE_AND_SWAP_2 // CHECK-SYNC_CAS_I586: __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 // CHECK-SYNC_CAS_I586: __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 +// +// RUN: %clang_cc1 %s -E -dM -o - -triple armv6 -target-cpu arm1136j-s \ +// RUN: | FileCheck %s --check-prefix=CHECK-SYNC_CAS_ARM +// CHECK-SYNC_CAS_ARM: __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 +// CHECK-SYNC_CAS_ARM: __GCC_HAVE_SYNC_COMPARE_AND_SWAP_2 +// CHECK-SYNC_CAS_ARM: __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 +// CHECK-SYNC_CAS_ARM: __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 +// +// RUN: %clang_cc1 %s -E -dM -o - -triple armv7 -target-cpu cortex-a8 \ +// RUN: | FileCheck %s --check-prefix=CHECK-SYNC_CAS_ARMv7 +// CHECK-SYNC_CAS_ARMv7: __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 +// CHECK-SYNC_CAS_ARMv7: __GCC_HAVE_SYNC_COMPARE_AND_SWAP_2 +// CHECK-SYNC_CAS_ARMv7: __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 +// CHECK-SYNC_CAS_ARMv7: __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 +// +// RUN: %clang_cc1 %s -E -dM -o - -triple armv6 -target-cpu cortex-m0 \ +// RUN: | FileCheck %s --check-prefix=CHECK-SYNC_CAS_ARMv6 +// CHECK-SYNC_CAS_ARMv6-NOT: __GCC_HAVE_SYNC_COMPARE_AND_SWAP diff --git a/test/Preprocessor/stdint.c b/test/Preprocessor/stdint.c index c3be05d..b92cfe7 100644 --- a/test/Preprocessor/stdint.c +++ b/test/Preprocessor/stdint.c @@ -213,6 +213,220 @@ // I386:INTMAX_C_(0) 0LL // I386:UINTMAX_C_(0) 0ULL // +// RUN: %clang_cc1 -E -ffreestanding -triple=mips-none-none %s | FileCheck -check-prefix MIPS %s +// +// MIPS:typedef signed long long int int64_t; +// MIPS:typedef unsigned long long int uint64_t; +// MIPS:typedef int64_t int_least64_t; +// MIPS:typedef uint64_t uint_least64_t; +// MIPS:typedef int64_t int_fast64_t; +// MIPS:typedef uint64_t uint_fast64_t; +// +// MIPS:typedef signed int int32_t; +// MIPS:typedef unsigned int uint32_t; +// MIPS:typedef int32_t int_least32_t; +// MIPS:typedef uint32_t uint_least32_t; +// MIPS:typedef int32_t int_fast32_t; +// MIPS:typedef uint32_t uint_fast32_t; +// +// MIPS:typedef signed short int16_t; +// MIPS:typedef unsigned short uint16_t; +// MIPS:typedef int16_t int_least16_t; +// MIPS:typedef uint16_t uint_least16_t; +// MIPS:typedef int16_t int_fast16_t; +// MIPS:typedef uint16_t uint_fast16_t; +// +// MIPS:typedef signed char int8_t; +// MIPS:typedef unsigned char uint8_t; +// MIPS:typedef int8_t int_least8_t; +// MIPS:typedef uint8_t uint_least8_t; +// 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 long int intmax_t; +// MIPS:typedef long long unsigned int uintmax_t; +// +// MIPS:INT8_MAX_ 127 +// MIPS:INT8_MIN_ (-127 -1) +// MIPS:UINT8_MAX_ 255 +// MIPS:INT_LEAST8_MIN_ (-127 -1) +// MIPS:INT_LEAST8_MAX_ 127 +// MIPS:UINT_LEAST8_MAX_ 255 +// MIPS:INT_FAST8_MIN_ (-127 -1) +// MIPS:INT_FAST8_MAX_ 127 +// MIPS:UINT_FAST8_MAX_ 255 +// +// MIPS:INT16_MAX_ 32767 +// MIPS:INT16_MIN_ (-32767 -1) +// MIPS:UINT16_MAX_ 65535 +// MIPS:INT_LEAST16_MIN_ (-32767 -1) +// MIPS:INT_LEAST16_MAX_ 32767 +// MIPS:UINT_LEAST16_MAX_ 65535 +// MIPS:INT_FAST16_MIN_ (-32767 -1) +// MIPS:INT_FAST16_MAX_ 32767 +// MIPS:UINT_FAST16_MAX_ 65535 +// +// MIPS:INT32_MAX_ 2147483647 +// MIPS:INT32_MIN_ (-2147483647 -1) +// MIPS:UINT32_MAX_ 4294967295U +// MIPS:INT_LEAST32_MIN_ (-2147483647 -1) +// MIPS:INT_LEAST32_MAX_ 2147483647 +// MIPS:UINT_LEAST32_MAX_ 4294967295U +// MIPS:INT_FAST32_MIN_ (-2147483647 -1) +// MIPS:INT_FAST32_MAX_ 2147483647 +// MIPS:UINT_FAST32_MAX_ 4294967295U +// +// MIPS:INT64_MAX_ 9223372036854775807LL +// MIPS:INT64_MIN_ (-9223372036854775807LL -1) +// MIPS:UINT64_MAX_ 18446744073709551615ULL +// MIPS:INT_LEAST64_MIN_ (-9223372036854775807LL -1) +// MIPS:INT_LEAST64_MAX_ 9223372036854775807LL +// MIPS:UINT_LEAST64_MAX_ 18446744073709551615ULL +// MIPS:INT_FAST64_MIN_ (-9223372036854775807LL -1) +// MIPS:INT_FAST64_MAX_ 9223372036854775807LL +// MIPS:UINT_FAST64_MAX_ 18446744073709551615ULL +// +// MIPS:INTPTR_MIN_ (-2147483647 -1) +// MIPS:INTPTR_MAX_ 2147483647 +// MIPS:UINTPTR_MAX_ 4294967295U +// MIPS:PTRDIFF_MIN_ (-2147483647 -1) +// MIPS:PTRDIFF_MAX_ 2147483647 +// MIPS:SIZE_MAX_ 4294967295U +// +// MIPS:INTMAX_MIN_ (-9223372036854775807LL -1) +// MIPS:INTMAX_MAX_ 9223372036854775807LL +// MIPS:UINTMAX_MAX_ 18446744073709551615ULL +// +// MIPS:SIG_ATOMIC_MIN_ (-2147483647 -1) +// MIPS:SIG_ATOMIC_MAX_ 2147483647 +// MIPS:WINT_MIN_ (-2147483647 -1) +// MIPS:WINT_MAX_ 2147483647 +// +// MIPS:WCHAR_MAX_ 2147483647 +// MIPS:WCHAR_MIN_ (-2147483647 -1) +// +// MIPS:INT8_C_(0) 0 +// MIPS:UINT8_C_(0) 0U +// MIPS:INT16_C_(0) 0 +// MIPS:UINT16_C_(0) 0U +// MIPS:INT32_C_(0) 0 +// MIPS:UINT32_C_(0) 0U +// MIPS:INT64_C_(0) 0LL +// MIPS:UINT64_C_(0) 0ULL +// +// MIPS:INTMAX_C_(0) 0LL +// MIPS:UINTMAX_C_(0) 0ULL +// +// RUN: %clang_cc1 -E -ffreestanding -triple=mips64-none-none %s | FileCheck -check-prefix MIPS64 %s +// +// MIPS64:typedef signed long long int int64_t; +// MIPS64:typedef unsigned long long int uint64_t; +// MIPS64:typedef int64_t int_least64_t; +// MIPS64:typedef uint64_t uint_least64_t; +// MIPS64:typedef int64_t int_fast64_t; +// MIPS64:typedef uint64_t uint_fast64_t; +// +// MIPS64:typedef signed int int32_t; +// MIPS64:typedef unsigned int uint32_t; +// MIPS64:typedef int32_t int_least32_t; +// MIPS64:typedef uint32_t uint_least32_t; +// MIPS64:typedef int32_t int_fast32_t; +// MIPS64:typedef uint32_t uint_fast32_t; +// +// MIPS64:typedef signed short int16_t; +// MIPS64:typedef unsigned short uint16_t; +// MIPS64:typedef int16_t int_least16_t; +// MIPS64:typedef uint16_t uint_least16_t; +// MIPS64:typedef int16_t int_fast16_t; +// MIPS64:typedef uint16_t uint_fast16_t; +// +// MIPS64:typedef signed char int8_t; +// MIPS64:typedef unsigned char uint8_t; +// MIPS64:typedef int8_t int_least8_t; +// MIPS64:typedef uint8_t uint_least8_t; +// 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 long int intmax_t; +// MIPS64:typedef long long unsigned int uintmax_t; +// +// MIPS64:INT8_MAX_ 127 +// MIPS64:INT8_MIN_ (-127 -1) +// MIPS64:UINT8_MAX_ 255 +// MIPS64:INT_LEAST8_MIN_ (-127 -1) +// MIPS64:INT_LEAST8_MAX_ 127 +// MIPS64:UINT_LEAST8_MAX_ 255 +// MIPS64:INT_FAST8_MIN_ (-127 -1) +// MIPS64:INT_FAST8_MAX_ 127 +// MIPS64:UINT_FAST8_MAX_ 255 +// +// MIPS64:INT16_MAX_ 32767 +// MIPS64:INT16_MIN_ (-32767 -1) +// MIPS64:UINT16_MAX_ 65535 +// MIPS64:INT_LEAST16_MIN_ (-32767 -1) +// MIPS64:INT_LEAST16_MAX_ 32767 +// MIPS64:UINT_LEAST16_MAX_ 65535 +// MIPS64:INT_FAST16_MIN_ (-32767 -1) +// MIPS64:INT_FAST16_MAX_ 32767 +// MIPS64:UINT_FAST16_MAX_ 65535 +// +// MIPS64:INT32_MAX_ 2147483647 +// MIPS64:INT32_MIN_ (-2147483647 -1) +// MIPS64:UINT32_MAX_ 4294967295U +// MIPS64:INT_LEAST32_MIN_ (-2147483647 -1) +// MIPS64:INT_LEAST32_MAX_ 2147483647 +// MIPS64:UINT_LEAST32_MAX_ 4294967295U +// MIPS64:INT_FAST32_MIN_ (-2147483647 -1) +// MIPS64:INT_FAST32_MAX_ 2147483647 +// MIPS64:UINT_FAST32_MAX_ 4294967295U +// +// MIPS64:INT64_MAX_ 9223372036854775807LL +// MIPS64:INT64_MIN_ (-9223372036854775807LL -1) +// MIPS64:UINT64_MAX_ 18446744073709551615ULL +// MIPS64:INT_LEAST64_MIN_ (-9223372036854775807LL -1) +// MIPS64:INT_LEAST64_MAX_ 9223372036854775807LL +// MIPS64:UINT_LEAST64_MAX_ 18446744073709551615ULL +// MIPS64:INT_FAST64_MIN_ (-9223372036854775807LL -1) +// MIPS64:INT_FAST64_MAX_ 9223372036854775807LL +// MIPS64:UINT_FAST64_MAX_ 18446744073709551615ULL +// +// MIPS64:INTPTR_MIN_ (-9223372036854775807LL -1) +// MIPS64:INTPTR_MAX_ 9223372036854775807LL +// MIPS64:UINTPTR_MAX_ 18446744073709551615ULL +// MIPS64:PTRDIFF_MIN_ (-9223372036854775807LL -1) +// MIPS64:PTRDIFF_MAX_ 9223372036854775807LL +// MIPS64:SIZE_MAX_ 18446744073709551615ULL +// +// MIPS64:INTMAX_MIN_ (-9223372036854775807LL -1) +// MIPS64:INTMAX_MAX_ 9223372036854775807LL +// MIPS64:UINTMAX_MAX_ 18446744073709551615ULL +// +// MIPS64:SIG_ATOMIC_MIN_ (-2147483647 -1) +// MIPS64:SIG_ATOMIC_MAX_ 2147483647 +// MIPS64:WINT_MIN_ (-2147483647 -1) +// MIPS64:WINT_MAX_ 2147483647 +// +// MIPS64:WCHAR_MAX_ 2147483647 +// MIPS64:WCHAR_MIN_ (-2147483647 -1) +// +// MIPS64:INT8_C_(0) 0 +// MIPS64:UINT8_C_(0) 0U +// MIPS64:INT16_C_(0) 0 +// MIPS64:UINT16_C_(0) 0U +// MIPS64:INT32_C_(0) 0 +// MIPS64:UINT32_C_(0) 0U +// MIPS64:INT64_C_(0) 0LL +// MIPS64:UINT64_C_(0) 0ULL +// +// MIPS64:INTMAX_C_(0) 0LL +// MIPS64:UINTMAX_C_(0) 0ULL +// // RUN: %clang_cc1 -E -ffreestanding -triple=msp430-none-none %s | FileCheck -check-prefix MSP430 %s // // MSP430:typedef signed long int int32_t; @@ -239,8 +453,8 @@ // MSP430:typedef int16_t intptr_t; // MSP430:typedef uint16_t uintptr_t; // -// MSP430:typedef long int intmax_t; -// MSP430:typedef long unsigned int uintmax_t; +// MSP430:typedef long long int intmax_t; +// MSP430:typedef long long unsigned int uintmax_t; // // MSP430:INT8_MAX_ 127 // MSP430:INT8_MIN_ (-127 -1) @@ -289,9 +503,9 @@ // MSP430:PTRDIFF_MAX_ 32767 // MSP430:SIZE_MAX_ 65535 // -// MSP430:INTMAX_MIN_ (-2147483647L -1) -// MSP430:INTMAX_MAX_ 2147483647L -// MSP430:UINTMAX_MAX_ 4294967295UL +// MSP430:INTMAX_MIN_ (-9223372036854775807LL -1) +// MSP430:INTMAX_MAX_ 9223372036854775807LL +// MSP430:UINTMAX_MAX_ 18446744073709551615ULL // // MSP430:SIG_ATOMIC_MIN_ (-2147483647L -1) // MSP430:SIG_ATOMIC_MAX_ 2147483647L @@ -963,6 +1177,114 @@ // I386_MINGW32:WCHAR_MIN_ 0U // // +// RUN: %clang_cc1 -E -ffreestanding -triple=xcore-none-none %s | FileCheck -check-prefix XCORE %s +// +// XCORE:typedef signed long long int int64_t; +// XCORE:typedef unsigned long long int uint64_t; +// XCORE:typedef int64_t int_least64_t; +// XCORE:typedef uint64_t uint_least64_t; +// XCORE:typedef int64_t int_fast64_t; +// XCORE:typedef uint64_t uint_fast64_t; +// +// XCORE:typedef signed int int32_t; +// XCORE:typedef unsigned int uint32_t; +// XCORE:typedef int32_t int_least32_t; +// XCORE:typedef uint32_t uint_least32_t; +// XCORE:typedef int32_t int_fast32_t; +// XCORE:typedef uint32_t uint_fast32_t; +// +// XCORE:typedef signed short int16_t; +// XCORE:typedef unsigned short uint16_t; +// XCORE:typedef int16_t int_least16_t; +// XCORE:typedef uint16_t uint_least16_t; +// XCORE:typedef int16_t int_fast16_t; +// XCORE:typedef uint16_t uint_fast16_t; +// +// XCORE:typedef signed char int8_t; +// XCORE:typedef unsigned char uint8_t; +// XCORE:typedef int8_t int_least8_t; +// XCORE:typedef uint8_t uint_least8_t; +// 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 long long int intmax_t; +// XCORE:typedef long long unsigned int uintmax_t; +// +// XCORE:INT8_MAX_ 127 +// XCORE:INT8_MIN_ (-127 -1) +// XCORE:UINT8_MAX_ 255 +// XCORE:INT_LEAST8_MIN_ (-127 -1) +// XCORE:INT_LEAST8_MAX_ 127 +// XCORE:UINT_LEAST8_MAX_ 255 +// XCORE:INT_FAST8_MIN_ (-127 -1) +// XCORE:INT_FAST8_MAX_ 127 +// XCORE:UINT_FAST8_MAX_ 255 +// +// XCORE:INT16_MAX_ 32767 +// XCORE:INT16_MIN_ (-32767 -1) +// XCORE:UINT16_MAX_ 65535 +// XCORE:INT_LEAST16_MIN_ (-32767 -1) +// XCORE:INT_LEAST16_MAX_ 32767 +// XCORE:UINT_LEAST16_MAX_ 65535 +// XCORE:INT_FAST16_MIN_ (-32767 -1) +// XCORE:INT_FAST16_MAX_ 32767 +// XCORE:UINT_FAST16_MAX_ 65535 +// +// XCORE:INT32_MAX_ 2147483647 +// XCORE:INT32_MIN_ (-2147483647 -1) +// XCORE:UINT32_MAX_ 4294967295U +// XCORE:INT_LEAST32_MIN_ (-2147483647 -1) +// XCORE:INT_LEAST32_MAX_ 2147483647 +// XCORE:UINT_LEAST32_MAX_ 4294967295U +// XCORE:INT_FAST32_MIN_ (-2147483647 -1) +// XCORE:INT_FAST32_MAX_ 2147483647 +// XCORE:UINT_FAST32_MAX_ 4294967295U +// +// XCORE:INT64_MAX_ 9223372036854775807LL +// XCORE:INT64_MIN_ (-9223372036854775807LL -1) +// XCORE:UINT64_MAX_ 18446744073709551615ULL +// XCORE:INT_LEAST64_MIN_ (-9223372036854775807LL -1) +// XCORE:INT_LEAST64_MAX_ 9223372036854775807LL +// XCORE:UINT_LEAST64_MAX_ 18446744073709551615ULL +// XCORE:INT_FAST64_MIN_ (-9223372036854775807LL -1) +// XCORE:INT_FAST64_MAX_ 9223372036854775807LL +// XCORE:UINT_FAST64_MAX_ 18446744073709551615ULL +// +// XCORE:INTPTR_MIN_ (-2147483647 -1) +// XCORE:INTPTR_MAX_ 2147483647 +// XCORE:UINTPTR_MAX_ 4294967295U +// XCORE:PTRDIFF_MIN_ (-2147483647 -1) +// XCORE:PTRDIFF_MAX_ 2147483647 +// XCORE:SIZE_MAX_ 4294967295U +// +// XCORE:INTMAX_MIN_ (-9223372036854775807LL -1) +// XCORE:INTMAX_MAX_ 9223372036854775807LL +// XCORE:UINTMAX_MAX_ 18446744073709551615ULL +// +// XCORE:SIG_ATOMIC_MIN_ (-2147483647 -1) +// XCORE:SIG_ATOMIC_MAX_ 2147483647 +// XCORE:WINT_MIN_ 0U +// XCORE:WINT_MAX_ 4294967295U +// +// XCORE:WCHAR_MAX_ 255U +// XCORE:WCHAR_MIN_ 0 +// +// XCORE:INT8_C_(0) 0 +// XCORE:UINT8_C_(0) 0U +// XCORE:INT16_C_(0) 0 +// XCORE:UINT16_C_(0) 0U +// XCORE:INT32_C_(0) 0 +// XCORE:UINT32_C_(0) 0U +// XCORE:INT64_C_(0) 0LL +// XCORE:UINT64_C_(0) 0ULL +// +// XCORE:INTMAX_C_(0) 0LL +// XCORE:UINTMAX_C_(0) 0ULL +// +// // stdint.h forms several macro definitions by pasting together identifiers // to form names (eg. int32_t is formed from int ## 32 ## _t). The following // case tests that these joining operations are performed correctly even if diff --git a/test/Preprocessor/traditional-cpp.c b/test/Preprocessor/traditional-cpp.c index 4c4633e..aa9f0f1 100644 --- a/test/Preprocessor/traditional-cpp.c +++ b/test/Preprocessor/traditional-cpp.c @@ -3,9 +3,9 @@ * things like using /usr/bin/cpp to preprocess non-source files. */ /* - RUN: %clang_cc1 -traditional-cpp %s -E -o %t - RUN: FileCheck -strict-whitespace < %t %s + RUN: %clang_cc1 -traditional-cpp %s -E | FileCheck -strict-whitespace %s RUN: %clang_cc1 -traditional-cpp %s -E -C | FileCheck -check-prefix=CHECK-COMMENTS %s + RUN: %clang_cc1 -traditional-cpp -x c++ %s -E | FileCheck -check-prefix=CHECK-CXX %s */ /* -traditional-cpp should eliminate all C89 comments. */ @@ -13,7 +13,9 @@ * CHECK-COMMENTS: {{^}}/* -traditional-cpp should eliminate all C89 comments. *{{/$}} */ +/* -traditional-cpp should only eliminate "//" comments in C++ mode. */ /* CHECK: {{^}}foo // bar{{$}} + * CHECK-CXX: {{^}}foo {{$}} */ foo // bar @@ -88,3 +90,20 @@ a b c in skipped block Preserve URLs: http://clang.llvm.org /* CHECK: {{^}}Preserve URLs: http://clang.llvm.org{{$}} */ + +/* The following tests ensure we ignore # and ## in macro bodies */ + +#define FOO_NO_STRINGIFY(a) test(# a) +FOO_NO_STRINGIFY(foobar) +/* CHECK: {{^}}test(# foobar){{$}} + */ + +#define FOO_NO_PASTE(a, b) test(b##a) +FOO_NO_PASTE(foo,bar) +/* CHECK {{^}}test(bar##foo){{$}} + */ + +#define BAR_NO_STRINGIFY(a) test(#a) +BAR_NO_STRINGIFY(foobar) +/* CHECK: {{^}}test(#foobar){{$}} + */ diff --git a/test/Preprocessor/ucn-pp-identifier.c b/test/Preprocessor/ucn-pp-identifier.c index 8616d40..6936ed9 100644 --- a/test/Preprocessor/ucn-pp-identifier.c +++ b/test/Preprocessor/ucn-pp-identifier.c @@ -1,6 +1,6 @@ // RUN: %clang_cc1 %s -fsyntax-only -std=c99 -pedantic -verify -Wundef // RUN: %clang_cc1 %s -fsyntax-only -x c++ -pedantic -verify -Wundef -// RUN: %clang_cc1 %s -fsyntax-only -std=c99 -pedantic -Wundef 2>&1 | FileCheck -strict-whitespace %s +// RUN: not %clang_cc1 %s -fsyntax-only -std=c99 -pedantic -Wundef 2>&1 | FileCheck -strict-whitespace %s #define \u00FC #define a\u00FD() 0 diff --git a/test/Preprocessor/warn-macro-unused.c b/test/Preprocessor/warn-macro-unused.c index c33aeb5..a305cc9 100644 --- a/test/Preprocessor/warn-macro-unused.c +++ b/test/Preprocessor/warn-macro-unused.c @@ -2,6 +2,10 @@ #include "warn-macro-unused.h" +# 1 "warn-macro-unused-fake-header.h" 1 +#define unused_from_fake_header +# 5 "warn-macro-unused.c" 2 + #define unused // expected-warning {{macro is not used}} #define unused unused diff --git a/test/Preprocessor/x86_target_features.c b/test/Preprocessor/x86_target_features.c index ad7ee85..751c8ae 100644 --- a/test/Preprocessor/x86_target_features.c +++ b/test/Preprocessor/x86_target_features.c @@ -1,32 +1,238 @@ -// RUN: %clang -target i386-unknown-unknown -march=core2 -msse4 -x c -E -dM -o %t %s -// RUN: grep '#define __SSE2_MATH__ 1' %t -// RUN: grep '#define __SSE2__ 1' %t -// RUN: grep '#define __SSE3__ 1' %t -// RUN: grep '#define __SSE4_1__ 1' %t -// RUN: grep '#define __SSE4_2__ 1' %t -// RUN: grep '#define __SSE_MATH__ 1' %t -// RUN: grep '#define __SSE__ 1' %t -// RUN: grep '#define __SSSE3__ 1' %t - -// RUN: %clang -target i386-unknown-unknown -march=core2 -msse4 -mno-sse2 -x c -E -dM -o %t %s -// RUN: grep '#define __SSE2_MATH__ 1' %t | count 0 -// RUN: grep '#define __SSE2__ 1' %t | count 0 -// RUN: grep '#define __SSE3__ 1' %t | count 0 -// RUN: grep '#define __SSE4_1__ 1' %t | count 0 -// RUN: grep '#define __SSE4_2__ 1' %t | count 0 -// RUN: grep '#define __SSE_MATH__ 1' %t -// RUN: grep '#define __SSE__ 1' %t -// RUN: grep '#define __SSSE3__ 1' %t | count 0 - -// RUN: %clang -target i386-unknown-unknown -march=pentium-m -x c -E -dM -o %t %s -// RUN: grep '#define __SSE2_MATH__ 1' %t -// RUN: grep '#define __SSE2__ 1' %t -// RUN: grep '#define __SSE3__ 1' %t | count 0 -// RUN: grep '#define __SSE4_1__ 1' %t | count 0 -// RUN: grep '#define __SSE4_2__ 1' %t | count 0 -// RUN: grep '#define __SSE_MATH__ 1' %t -// RUN: grep '#define __SSE__ 1' %t -// RUN: grep '#define __SSSE3__ 1' %t | count 0 +// RUN: %clang -target i386-unknown-unknown -march=core2 -msse4 -x c -E -dM -o - %s | FileCheck --check-prefix=SSE4 %s +// SSE4: #define __SSE2_MATH__ 1 +// SSE4: #define __SSE2__ 1 +// SSE4: #define __SSE3__ 1 +// SSE4: #define __SSE4_1__ 1 +// SSE4: #define __SSE4_2__ 1 +// SSE4: #define __SSE_MATH__ 1 +// SSE4: #define __SSE__ 1 +// SSE4: #define __SSSE3__ 1 +// RUN: %clang -target i386-unknown-unknown -march=core2 -msse4 -mno-sse2 -x c -E -dM -o - %s | FileCheck --check-prefix=SSE %s + +// SSE-NOT: #define __SSE2_MATH__ 1 +// SSE-NOT: #define __SSE2__ 1 +// SSE-NOT: #define __SSE3__ 1 +// SSE-NOT: #define __SSE4_1__ 1 +// SSE-NOT: #define __SSE4_2__ 1 +// SSE: #define __SSE_MATH__ 1 +// SSE: #define __SSE__ 1 +// SSE-NOT: #define __SSSE3__ 1 + +// RUN: %clang -target i386-unknown-unknown -march=pentium-m -x c -E -dM -o - %s | FileCheck --check-prefix=SSE2 %s + +// SSE2: #define __SSE2_MATH__ 1 +// SSE2: #define __SSE2__ 1 +// SSE2-NOT: #define __SSE3__ 1 +// SSE2-NOT: #define __SSE4_1__ 1 +// SSE2-NOT: #define __SSE4_2__ 1 +// SSE2: #define __SSE_MATH__ 1 +// SSE2: #define __SSE__ 1 +// SSE2-NOT: #define __SSSE3__ 1 + +// RUN: %clang -target i386-unknown-unknown -march=pentium-m -mno-sse -mavx -x c -E -dM -o - %s | FileCheck --check-prefix=AVX %s + +// AVX: #define __AVX__ 1 +// AVX: #define __SSE2_MATH__ 1 +// AVX: #define __SSE2__ 1 +// AVX: #define __SSE3__ 1 +// AVX: #define __SSE4_1__ 1 +// AVX: #define __SSE4_2__ 1 +// AVX: #define __SSE_MATH__ 1 +// AVX: #define __SSE__ 1 +// AVX: #define __SSSE3__ 1 + +// RUN: %clang -target i386-unknown-unknown -march=pentium-m -mxop -mno-avx -x c -E -dM -o - %s | FileCheck --check-prefix=SSE4A %s + +// SSE4A: #define __SSE2_MATH__ 1 +// SSE4A: #define __SSE2__ 1 +// SSE4A: #define __SSE3__ 1 +// SSE4A: #define __SSE4A__ 1 +// SSE4A: #define __SSE4_1__ 1 +// SSE4A: #define __SSE4_2__ 1 +// SSE4A: #define __SSE_MATH__ 1 +// SSE4A: #define __SSE__ 1 +// SSE4A: #define __SSSE3__ 1 + +// RUN: %clang -target i386-unknown-unknown -march=atom -mavx512f -x c -E -dM -o - %s | FileCheck --check-prefix=AVX512F %s + +// AVX512F: #define __AVX2__ 1 +// AVX512F: #define __AVX512F__ 1 +// AVX512F: #define __AVX__ 1 +// AVX512F: #define __SSE2_MATH__ 1 +// AVX512F: #define __SSE2__ 1 +// AVX512F: #define __SSE3__ 1 +// AVX512F: #define __SSE4_1__ 1 +// AVX512F: #define __SSE4_2__ 1 +// AVX512F: #define __SSE_MATH__ 1 +// AVX512F: #define __SSE__ 1 +// AVX512F: #define __SSSE3__ 1 + +// RUN: %clang -target i386-unknown-unknown -march=atom -mavx512cd -x c -E -dM -o - %s | FileCheck --check-prefix=AVX512CD %s + +// AVX512CD: #define __AVX2__ 1 +// AVX512CD: #define __AVX512CD__ 1 +// AVX512CD: #define __AVX512F__ 1 +// AVX512CD: #define __AVX__ 1 +// AVX512CD: #define __SSE2_MATH__ 1 +// AVX512CD: #define __SSE2__ 1 +// AVX512CD: #define __SSE3__ 1 +// AVX512CD: #define __SSE4_1__ 1 +// AVX512CD: #define __SSE4_2__ 1 +// AVX512CD: #define __SSE_MATH__ 1 +// AVX512CD: #define __SSE__ 1 +// AVX512CD: #define __SSSE3__ 1 + +// RUN: %clang -target i386-unknown-unknown -march=atom -mavx512er -x c -E -dM -o - %s | FileCheck --check-prefix=AVX512ER %s + +// AVX512ER: #define __AVX2__ 1 +// AVX512ER: #define __AVX512ER__ 1 +// AVX512ER: #define __AVX512F__ 1 +// AVX512ER: #define __AVX__ 1 +// AVX512ER: #define __SSE2_MATH__ 1 +// AVX512ER: #define __SSE2__ 1 +// AVX512ER: #define __SSE3__ 1 +// AVX512ER: #define __SSE4_1__ 1 +// AVX512ER: #define __SSE4_2__ 1 +// AVX512ER: #define __SSE_MATH__ 1 +// AVX512ER: #define __SSE__ 1 +// AVX512ER: #define __SSSE3__ 1 + +// RUN: %clang -target i386-unknown-unknown -march=atom -mavx512pf -x c -E -dM -o - %s | FileCheck --check-prefix=AVX512PF %s + +// AVX512PF: #define __AVX2__ 1 +// AVX512PF: #define __AVX512F__ 1 +// AVX512PF: #define __AVX512PF__ 1 +// AVX512PF: #define __AVX__ 1 +// AVX512PF: #define __SSE2_MATH__ 1 +// AVX512PF: #define __SSE2__ 1 +// AVX512PF: #define __SSE3__ 1 +// AVX512PF: #define __SSE4_1__ 1 +// AVX512PF: #define __SSE4_2__ 1 +// AVX512PF: #define __SSE_MATH__ 1 +// AVX512PF: #define __SSE__ 1 +// AVX512PF: #define __SSSE3__ 1 + +// RUN: %clang -target i386-unknown-unknown -march=atom -mavx512pf -mno-avx512f -x c -E -dM -o - %s | FileCheck --check-prefix=AVX512F2 %s + +// AVX512F2: #define __AVX2__ 1 +// AVX512F2-NOT: #define __AVX512F__ 1 +// AVX512F2-NOT: #define __AVX512PF__ 1 +// AVX512F2: #define __AVX__ 1 +// AVX512F2: #define __SSE2_MATH__ 1 +// AVX512F2: #define __SSE2__ 1 +// AVX512F2: #define __SSE3__ 1 +// AVX512F2: #define __SSE4_1__ 1 +// AVX512F2: #define __SSE4_2__ 1 +// AVX512F2: #define __SSE_MATH__ 1 +// AVX512F2: #define __SSE__ 1 +// AVX512F2: #define __SSSE3__ 1 + +// RUN: %clang -target i386-unknown-unknown -march=atom -msse4.2 -x c -E -dM -o - %s | FileCheck --check-prefix=SSE42POPCNT %s + +// SSE42POPCNT: #define __POPCNT__ 1 + +// RUN: %clang -target i386-unknown-unknown -march=atom -mno-popcnt -msse4.2 -x c -E -dM -o - %s | FileCheck --check-prefix=SSE42NOPOPCNT %s + +// SSE42NOPOPCNT-NOT: #define __POPCNT__ 1 + +// RUN: %clang -target i386-unknown-unknown -march=atom -mpopcnt -mno-sse4.2 -x c -E -dM -o - %s | FileCheck --check-prefix=NOSSE42POPCNT %s + +// NOSSE42POPCNT: #define __POPCNT__ 1 + +// RUN: %clang -target i386-unknown-unknown -march=atom -msse -x c -E -dM -o - %s | FileCheck --check-prefix=SSEMMX %s + +// SSEMMX: #define __MMX__ 1 + +// RUN: %clang -target i386-unknown-unknown -march=atom -msse -mno-sse -x c -E -dM -o - %s | FileCheck --check-prefix=SSENOSSEMMX %s + +// SSENOSSEMMX-NOT: #define __MMX__ 1 + +// RUN: %clang -target i386-unknown-unknown -march=atom -msse -mno-mmx -x c -E -dM -o - %s | FileCheck --check-prefix=SSENOMMX %s + +// SSENOMMX-NOT: #define __MMX__ 1 + +// RUN: %clang -target i386-unknown-unknown -march=atom -mf16c -x c -E -dM -o - %s | FileCheck --check-prefix=F16C %s + +// F16C: #define __AVX__ 1 +// F16C: #define __F16C__ 1 + +// RUN: %clang -target i386-unknown-unknown -march=atom -mf16c -mno-avx -x c -E -dM -o - %s | FileCheck --check-prefix=F16CNOAVX %s + +// F16CNOAVX-NOT: #define __AVX__ 1 +// F16CNOAVX-NOT: #define __F16C__ 1 + +// RUN: %clang -target i386-unknown-unknown -march=pentiumpro -mpclmul -x c -E -dM -o - %s | FileCheck --check-prefix=PCLMUL %s + +// PCLMUL: #define __PCLMUL__ 1 +// PCLMUL: #define __SSE2__ 1 +// PCLMUL-NOT: #define __SSE3__ 1 + +// RUN: %clang -target i386-unknown-unknown -march=pentiumpro -mpclmul -mno-sse2 -x c -E -dM -o - %s | FileCheck --check-prefix=PCLMULNOSSE2 %s + +// PCLMULNOSSE2-NOT: #define __PCLMUL__ 1 +// PCLMULNOSSE2-NOT: #define __SSE2__ 1 +// PCLMULNOSSE2-NOT: #define __SSE3__ 1 + +// RUN: %clang -target i386-unknown-unknown -march=pentiumpro -maes -x c -E -dM -o - %s | FileCheck --check-prefix=AES %s + +// AES: #define __AES__ 1 +// AES: #define __SSE2__ 1 +// AES-NOT: #define __SSE3__ 1 + +// RUN: %clang -target i386-unknown-unknown -march=pentiumpro -maes -mno-sse2 -x c -E -dM -o - %s | FileCheck --check-prefix=AESNOSSE2 %s + +// AESNOSSE2-NOT: #define __AES__ 1 +// AESNOSSE2-NOT: #define __SSE2__ 1 +// AESNOSSE2-NOT: #define __SSE3__ 1 + +// RUN: %clang -target i386-unknown-unknown -march=pentiumpro -msha -x c -E -dM -o - %s | FileCheck --check-prefix=SHA %s + +// SHA: #define __SHA__ 1 +// SHA: #define __SSE2__ 1 +// SHA-NOT: #define __SSE3__ 1 + +// run: %clang -target i386-unknown-unknown -march=pentiumpro -msha -mno-sha -x c -e -dm -o - %s | filecheck --check-prefix=SHANOSHA %s + +// SHANOSHA-NOT: #define __SHA__ 1 +// SHANOSHA-NOT: #define __SSE2__ 1 + +// run: %clang -target i386-unknown-unknown -march=pentiumpro -msha -mno-sse2 -x c -e -dm -o - %s | filecheck --check-prefix=SHANOSSE2 %s + +// SHANOSSSE2-NOT: #define __SHA__ 1 +// SHANOSSSE2-NOT: #define __SSE2__ 1 +// SHANOSSSE2-NOT: #define __SSE3__ 1 + +// RUN: %clang -target i386-unknown-unknown -march=atom -mtbm -x c -E -dM -o - %s | FileCheck --check-prefix=TBM %s + +// TBM: #define __TBM__ 1 + +// RUN: %clang -target i386-unknown-unknown -march=bdver2 -mno-tbm -x c -E -dM -o - %s | FileCheck --check-prefix=NOTBM %s + +// NOTBM-NOT: #define __TBM__ 1 + +// RUN: %clang -target i386-unknown-unknown -march=pentiumpro -mcx16 -x c -E -dM -o - %s | FileCheck --check-prefix=MCX16 %s + +// MCX16: #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16 1 + +// RUN: %clang -target i386-unknown-unknown -march=atom -mprfchw -x c -E -dM -o - %s | FileCheck --check-prefix=PRFCHW %s + +// PRFCHW: #define __PRFCHW__ 1 + +// RUN: %clang -target i386-unknown-unknown -march=btver2 -mno-prfchw -x c -E -dM -o - %s | FileCheck --check-prefix=NOPRFCHW %s + +// NOPRFCHW-NOT: #define __PRFCHW__ 1 + +// RUN: %clang -target i386-unknown-unknown -march=atom -m3dnow -x c -E -dM -o - %s | FileCheck --check-prefix=3DNOWPRFCHW %s + +// 3DNOWPRFCHW: #define __PRFCHW__ 1 + +// RUN: %clang -target i386-unknown-unknown -march=atom -mno-prfchw -m3dnow -x c -E -dM -o - %s | FileCheck --check-prefix=3DNOWNOPRFCHW %s + +// 3DNOWNOPRFCHW-NOT: #define __PRFCHW__ 1 + +// RUN: %clang -target i386-unknown-unknown -march=atom -mprfchw -mno-3dnow -x c -E -dM -o - %s | FileCheck --check-prefix=NO3DNOWPRFCHW %s + +// NO3DNOWPRFCHW: #define __PRFCHW__ 1 |