Home | History | Annotate | Download | only in Preprocessor
      1 // This test verifies that the correct macros are predefined.
      2 //
      3 // RUN: %clang_cc1 %s -E -dM -triple i686-pc-win32 -fms-extensions -fms-compatibility \
      4 // RUN:     -fms-compatibility-version=13.00 -o - | FileCheck %s --check-prefix=CHECK-MS
      5 // CHECK-MS: #define _INTEGRAL_MAX_BITS 64
      6 // CHECK-MS: #define _MSC_EXTENSIONS 1
      7 // CHECK-MS: #define _MSC_VER 1300
      8 // CHECK-MS: #define _M_IX86 600
      9 // CHECK-MS: #define _M_IX86_FP
     10 // CHECK-MS: #define _WIN32 1
     11 // CHECK-MS-NOT: #define __STRICT_ANSI__
     12 // CHECK-MS-NOT: GCC
     13 // CHECK-MS-NOT: GNU
     14 // CHECK-MS-NOT: GXX
     15 //
     16 // RUN: %clang_cc1 %s -E -dM -triple x86_64-pc-win32 -fms-extensions -fms-compatibility \
     17 // RUN:     -fms-compatibility-version=13.00 -o - | FileCheck %s --check-prefix=CHECK-MS64
     18 // CHECK-MS64: #define _INTEGRAL_MAX_BITS 64
     19 // CHECK-MS64: #define _MSC_EXTENSIONS 1
     20 // CHECK-MS64: #define _MSC_VER 1300
     21 // CHECK-MS64: #define _M_AMD64 100
     22 // CHECK-MS64: #define _M_X64 100
     23 // CHECK-MS64: #define _WIN64 1
     24 // CHECK-MS64-NOT: #define __STRICT_ANSI__
     25 // CHECK-MS64-NOT: GCC
     26 // CHECK-MS64-NOT: GNU
     27 // CHECK-MS64-NOT: GXX
     28 //
     29 // RUN: %clang_cc1 %s -E -dM -triple i686-pc-win32 -fms-compatibility \
     30 // RUN:     -o - | FileCheck %s --check-prefix=CHECK-MS-STDINT
     31 // CHECK-MS-STDINT:#define __INT16_MAX__ 32767
     32 // CHECK-MS-STDINT:#define __INT32_MAX__ 2147483647
     33 // CHECK-MS-STDINT:#define __INT64_MAX__ 9223372036854775807LL
     34 // CHECK-MS-STDINT:#define __INT8_MAX__ 127
     35 // CHECK-MS-STDINT:#define __INTPTR_MAX__ 2147483647
     36 // CHECK-MS-STDINT:#define __INT_FAST16_MAX__ 32767
     37 // CHECK-MS-STDINT:#define __INT_FAST16_TYPE__ short
     38 // CHECK-MS-STDINT:#define __INT_FAST32_MAX__ 2147483647
     39 // CHECK-MS-STDINT:#define __INT_FAST32_TYPE__ int
     40 // CHECK-MS-STDINT:#define __INT_FAST64_MAX__ 9223372036854775807LL
     41 // CHECK-MS-STDINT:#define __INT_FAST64_TYPE__ long long int
     42 // CHECK-MS-STDINT:#define __INT_FAST8_MAX__ 127
     43 // CHECK-MS-STDINT:#define __INT_FAST8_TYPE__ signed char
     44 // CHECK-MS-STDINT:#define __INT_LEAST16_MAX__ 32767
     45 // CHECK-MS-STDINT:#define __INT_LEAST16_TYPE__ short
     46 // CHECK-MS-STDINT:#define __INT_LEAST32_MAX__ 2147483647
     47 // CHECK-MS-STDINT:#define __INT_LEAST32_TYPE__ int
     48 // CHECK-MS-STDINT:#define __INT_LEAST64_MAX__ 9223372036854775807LL
     49 // CHECK-MS-STDINT:#define __INT_LEAST64_TYPE__ long long int
     50 // CHECK-MS-STDINT:#define __INT_LEAST8_MAX__ 127
     51 // CHECK-MS-STDINT:#define __INT_LEAST8_TYPE__ signed char
     52 // CHECK-MS-STDINT-NOT:#define __UINT16_C_SUFFIX__ U
     53 // CHECK-MS-STDINT:#define __UINT16_MAX__ 65535
     54 // CHECK-MS-STDINT:#define __UINT16_TYPE__ unsigned short
     55 // CHECK-MS-STDINT:#define __UINT32_C_SUFFIX__ U
     56 // CHECK-MS-STDINT:#define __UINT32_MAX__ 4294967295U
     57 // CHECK-MS-STDINT:#define __UINT32_TYPE__ unsigned int
     58 // CHECK-MS-STDINT:#define __UINT64_C_SUFFIX__ ULL
     59 // CHECK-MS-STDINT:#define __UINT64_MAX__ 18446744073709551615ULL
     60 // CHECK-MS-STDINT:#define __UINT64_TYPE__ long long unsigned int
     61 // CHECK-MS-STDINT-NOT:#define __UINT8_C_SUFFIX__ U
     62 // CHECK-MS-STDINT:#define __UINT8_MAX__ 255
     63 // CHECK-MS-STDINT:#define __UINT8_TYPE__ unsigned char
     64 // CHECK-MS-STDINT:#define __UINTMAX_MAX__ 18446744073709551615ULL
     65 // CHECK-MS-STDINT:#define __UINTPTR_MAX__ 4294967295U
     66 // CHECK-MS-STDINT:#define __UINTPTR_TYPE__ unsigned int
     67 // CHECK-MS-STDINT:#define __UINTPTR_WIDTH__ 32
     68 // CHECK-MS-STDINT:#define __UINT_FAST16_MAX__ 65535
     69 // CHECK-MS-STDINT:#define __UINT_FAST16_TYPE__ unsigned short
     70 // CHECK-MS-STDINT:#define __UINT_FAST32_MAX__ 4294967295U
     71 // CHECK-MS-STDINT:#define __UINT_FAST32_TYPE__ unsigned int
     72 // CHECK-MS-STDINT:#define __UINT_FAST64_MAX__ 18446744073709551615ULL
     73 // CHECK-MS-STDINT:#define __UINT_FAST64_TYPE__ long long unsigned int
     74 // CHECK-MS-STDINT:#define __UINT_FAST8_MAX__ 255
     75 // CHECK-MS-STDINT:#define __UINT_FAST8_TYPE__ unsigned char
     76 // CHECK-MS-STDINT:#define __UINT_LEAST16_MAX__ 65535
     77 // CHECK-MS-STDINT:#define __UINT_LEAST16_TYPE__ unsigned short
     78 // CHECK-MS-STDINT:#define __UINT_LEAST32_MAX__ 4294967295U
     79 // CHECK-MS-STDINT:#define __UINT_LEAST32_TYPE__ unsigned int
     80 // CHECK-MS-STDINT:#define __UINT_LEAST64_MAX__ 18446744073709551615ULL
     81 // CHECK-MS-STDINT:#define __UINT_LEAST64_TYPE__ long long unsigned int
     82 // CHECK-MS-STDINT:#define __UINT_LEAST8_MAX__ 255
     83 // CHECK-MS-STDINT:#define __UINT_LEAST8_TYPE__ unsigned char
     84 //
     85 // RUN: %clang_cc1 %s -E -dM -ffast-math -o - \
     86 // RUN:   | FileCheck %s --check-prefix=CHECK-FAST-MATH
     87 // CHECK-FAST-MATH: #define __FAST_MATH__
     88 // CHECK-FAST-MATH: #define __FINITE_MATH_ONLY__ 1
     89 //
     90 // RUN: %clang_cc1 %s -E -dM -ffinite-math-only -o - \
     91 // RUN:   | FileCheck %s --check-prefix=CHECK-FINITE-MATH-ONLY
     92 // CHECK-FINITE-MATH-ONLY: #define __FINITE_MATH_ONLY__ 1
     93 //
     94 // RUN: %clang %s -E -dM -fno-finite-math-only -o - \
     95 // RUN:   | FileCheck %s --check-prefix=CHECK-NO-FINITE-MATH-ONLY
     96 // CHECK-NO-FINITE-MATH-ONLY: #define __FINITE_MATH_ONLY__ 0
     97 //
     98 // RUN: %clang_cc1 %s -E -dM -o - \
     99 // RUN:   | FileCheck %s --check-prefix=CHECK-FINITE-MATH-FLAG-UNDEFINED
    100 // CHECK-FINITE-MATH-FLAG-UNDEFINED: #define __FINITE_MATH_ONLY__ 0
    101 //
    102 // RUN: %clang_cc1 %s -E -dM -o - -triple i686 -target-cpu i386 \
    103 // RUN:   | FileCheck %s --check-prefix=CHECK-SYNC_CAS_I386
    104 // CHECK-SYNC_CAS_I386-NOT: __GCC_HAVE_SYNC_COMPARE_AND_SWAP
    105 //
    106 // RUN: %clang_cc1 %s -E -dM -o - -triple i686 -target-cpu i486 \
    107 // RUN:   | FileCheck %s --check-prefix=CHECK-SYNC_CAS_I486
    108 // CHECK-SYNC_CAS_I486: __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1
    109 // CHECK-SYNC_CAS_I486: __GCC_HAVE_SYNC_COMPARE_AND_SWAP_2
    110 // CHECK-SYNC_CAS_I486: __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4
    111 // CHECK-SYNC_CAS_I486-NOT: __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8
    112 //
    113 // RUN: %clang_cc1 %s -E -dM -o - -triple i686 -target-cpu i586 \
    114 // RUN:   | FileCheck %s --check-prefix=CHECK-SYNC_CAS_I586
    115 // CHECK-SYNC_CAS_I586: __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1
    116 // CHECK-SYNC_CAS_I586: __GCC_HAVE_SYNC_COMPARE_AND_SWAP_2
    117 // CHECK-SYNC_CAS_I586: __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4
    118 // CHECK-SYNC_CAS_I586: __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8
    119 //
    120 // RUN: %clang_cc1 %s -E -dM -o - -triple armv6 -target-cpu arm1136j-s \
    121 // RUN:   | FileCheck %s --check-prefix=CHECK-SYNC_CAS_ARM
    122 // CHECK-SYNC_CAS_ARM: __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1
    123 // CHECK-SYNC_CAS_ARM: __GCC_HAVE_SYNC_COMPARE_AND_SWAP_2
    124 // CHECK-SYNC_CAS_ARM: __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4
    125 // CHECK-SYNC_CAS_ARM: __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8
    126 //
    127 // RUN: %clang_cc1 %s -E -dM -o - -triple armv7 -target-cpu cortex-a8 \
    128 // RUN:   | FileCheck %s --check-prefix=CHECK-SYNC_CAS_ARMv7
    129 // CHECK-SYNC_CAS_ARMv7: __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1
    130 // CHECK-SYNC_CAS_ARMv7: __GCC_HAVE_SYNC_COMPARE_AND_SWAP_2
    131 // CHECK-SYNC_CAS_ARMv7: __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4
    132 // CHECK-SYNC_CAS_ARMv7: __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8
    133 //
    134 // RUN: %clang_cc1 %s -E -dM -o - -triple armv6 -target-cpu cortex-m0 \
    135 // RUN:   | FileCheck %s --check-prefix=CHECK-SYNC_CAS_ARMv6
    136 // CHECK-SYNC_CAS_ARMv6-NOT: __GCC_HAVE_SYNC_COMPARE_AND_SWAP
    137