1 // This test verifies that the correct macros are predefined. 2 // 3 // RUN: %clang_cc1 %s -x c++ -E -dM -triple i686-pc-win32 -fms-extensions -fms-compatibility \ 4 // RUN: -fms-compatibility-version=19.00 -std=c++1z -o - | FileCheck -match-full-lines %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 1900 8 // CHECK-MS: #define _MSVC_LANG 201403L 9 // CHECK-MS: #define _M_IX86 600 10 // CHECK-MS: #define _M_IX86_FP 0 11 // CHECK-MS: #define _WIN32 1 12 // CHECK-MS-NOT: #define __STRICT_ANSI__ 13 // CHECK-MS-NOT: GCC 14 // CHECK-MS-NOT: GNU 15 // CHECK-MS-NOT: GXX 16 // 17 // RUN: %clang_cc1 %s -x c++ -E -dM -triple x86_64-pc-win32 -fms-extensions -fms-compatibility \ 18 // RUN: -fms-compatibility-version=19.00 -std=c++14 -o - | FileCheck -match-full-lines %s --check-prefix=CHECK-MS64 19 // CHECK-MS64: #define _INTEGRAL_MAX_BITS 64 20 // CHECK-MS64: #define _MSC_EXTENSIONS 1 21 // CHECK-MS64: #define _MSC_VER 1900 22 // CHECK-MS64: #define _MSVC_LANG 201402L 23 // CHECK-MS64: #define _M_AMD64 100 24 // CHECK-MS64: #define _M_X64 100 25 // CHECK-MS64: #define _WIN64 1 26 // CHECK-MS64-NOT: #define __STRICT_ANSI__ 27 // CHECK-MS64-NOT: GCC 28 // CHECK-MS64-NOT: GNU 29 // CHECK-MS64-NOT: GXX 30 // 31 // RUN: %clang_cc1 %s -E -dM -triple i686-pc-win32 -fms-compatibility \ 32 // RUN: -o - | FileCheck -match-full-lines %s --check-prefix=CHECK-MS-STDINT 33 // CHECK-MS-STDINT:#define __INT16_MAX__ 32767 34 // CHECK-MS-STDINT:#define __INT32_MAX__ 2147483647 35 // CHECK-MS-STDINT:#define __INT64_MAX__ 9223372036854775807LL 36 // CHECK-MS-STDINT:#define __INT8_MAX__ 127 37 // CHECK-MS-STDINT:#define __INTPTR_MAX__ 2147483647 38 // CHECK-MS-STDINT:#define __INT_FAST16_MAX__ 32767 39 // CHECK-MS-STDINT:#define __INT_FAST16_TYPE__ short 40 // CHECK-MS-STDINT:#define __INT_FAST32_MAX__ 2147483647 41 // CHECK-MS-STDINT:#define __INT_FAST32_TYPE__ int 42 // CHECK-MS-STDINT:#define __INT_FAST64_MAX__ 9223372036854775807LL 43 // CHECK-MS-STDINT:#define __INT_FAST64_TYPE__ long long int 44 // CHECK-MS-STDINT:#define __INT_FAST8_MAX__ 127 45 // CHECK-MS-STDINT:#define __INT_FAST8_TYPE__ signed char 46 // CHECK-MS-STDINT:#define __INT_LEAST16_MAX__ 32767 47 // CHECK-MS-STDINT:#define __INT_LEAST16_TYPE__ short 48 // CHECK-MS-STDINT:#define __INT_LEAST32_MAX__ 2147483647 49 // CHECK-MS-STDINT:#define __INT_LEAST32_TYPE__ int 50 // CHECK-MS-STDINT:#define __INT_LEAST64_MAX__ 9223372036854775807LL 51 // CHECK-MS-STDINT:#define __INT_LEAST64_TYPE__ long long int 52 // CHECK-MS-STDINT:#define __INT_LEAST8_MAX__ 127 53 // CHECK-MS-STDINT:#define __INT_LEAST8_TYPE__ signed char 54 // CHECK-MS-STDINT-NOT:#define __UINT16_C_SUFFIX__ U 55 // CHECK-MS-STDINT:#define __UINT16_MAX__ 65535 56 // CHECK-MS-STDINT:#define __UINT16_TYPE__ unsigned short 57 // CHECK-MS-STDINT:#define __UINT32_C_SUFFIX__ U 58 // CHECK-MS-STDINT:#define __UINT32_MAX__ 4294967295U 59 // CHECK-MS-STDINT:#define __UINT32_TYPE__ unsigned int 60 // CHECK-MS-STDINT:#define __UINT64_C_SUFFIX__ ULL 61 // CHECK-MS-STDINT:#define __UINT64_MAX__ 18446744073709551615ULL 62 // CHECK-MS-STDINT:#define __UINT64_TYPE__ long long unsigned int 63 // CHECK-MS-STDINT-NOT:#define __UINT8_C_SUFFIX__ U 64 // CHECK-MS-STDINT:#define __UINT8_MAX__ 255 65 // CHECK-MS-STDINT:#define __UINT8_TYPE__ unsigned char 66 // CHECK-MS-STDINT:#define __UINTMAX_MAX__ 18446744073709551615ULL 67 // CHECK-MS-STDINT:#define __UINTPTR_MAX__ 4294967295U 68 // CHECK-MS-STDINT:#define __UINTPTR_TYPE__ unsigned int 69 // CHECK-MS-STDINT:#define __UINTPTR_WIDTH__ 32 70 // CHECK-MS-STDINT:#define __UINT_FAST16_MAX__ 65535 71 // CHECK-MS-STDINT:#define __UINT_FAST16_TYPE__ unsigned short 72 // CHECK-MS-STDINT:#define __UINT_FAST32_MAX__ 4294967295U 73 // CHECK-MS-STDINT:#define __UINT_FAST32_TYPE__ unsigned int 74 // CHECK-MS-STDINT:#define __UINT_FAST64_MAX__ 18446744073709551615ULL 75 // CHECK-MS-STDINT:#define __UINT_FAST64_TYPE__ long long unsigned int 76 // CHECK-MS-STDINT:#define __UINT_FAST8_MAX__ 255 77 // CHECK-MS-STDINT:#define __UINT_FAST8_TYPE__ unsigned char 78 // CHECK-MS-STDINT:#define __UINT_LEAST16_MAX__ 65535 79 // CHECK-MS-STDINT:#define __UINT_LEAST16_TYPE__ unsigned short 80 // CHECK-MS-STDINT:#define __UINT_LEAST32_MAX__ 4294967295U 81 // CHECK-MS-STDINT:#define __UINT_LEAST32_TYPE__ unsigned int 82 // CHECK-MS-STDINT:#define __UINT_LEAST64_MAX__ 18446744073709551615ULL 83 // CHECK-MS-STDINT:#define __UINT_LEAST64_TYPE__ long long unsigned int 84 // CHECK-MS-STDINT:#define __UINT_LEAST8_MAX__ 255 85 // CHECK-MS-STDINT:#define __UINT_LEAST8_TYPE__ unsigned char 86 // 87 // RUN: %clang_cc1 %s -E -dM -ffast-math -o - \ 88 // RUN: | FileCheck -match-full-lines %s --check-prefix=CHECK-FAST-MATH 89 // CHECK-FAST-MATH: #define __FAST_MATH__ 1 90 // CHECK-FAST-MATH: #define __FINITE_MATH_ONLY__ 1 91 // 92 // RUN: %clang_cc1 %s -E -dM -ffinite-math-only -o - \ 93 // RUN: | FileCheck -match-full-lines %s --check-prefix=CHECK-FINITE-MATH-ONLY 94 // CHECK-FINITE-MATH-ONLY: #define __FINITE_MATH_ONLY__ 1 95 // 96 // RUN: %clang %s -E -dM -fno-finite-math-only -o - \ 97 // RUN: | FileCheck -match-full-lines %s --check-prefix=CHECK-NO-FINITE-MATH-ONLY 98 // CHECK-NO-FINITE-MATH-ONLY: #define __FINITE_MATH_ONLY__ 0 99 // 100 // RUN: %clang_cc1 %s -E -dM -o - \ 101 // RUN: | FileCheck -match-full-lines %s --check-prefix=CHECK-FINITE-MATH-FLAG-UNDEFINED 102 // CHECK-FINITE-MATH-FLAG-UNDEFINED: #define __FINITE_MATH_ONLY__ 0 103 // 104 // RUN: %clang_cc1 %s -E -dM -o - -triple i686 -target-cpu i386 \ 105 // RUN: | FileCheck -match-full-lines %s --check-prefix=CHECK-SYNC_CAS_I386 106 // CHECK-SYNC_CAS_I386-NOT: __GCC_HAVE_SYNC_COMPARE_AND_SWAP 107 // 108 // RUN: %clang_cc1 %s -E -dM -o - -triple i686 -target-cpu i486 \ 109 // RUN: | FileCheck -match-full-lines %s --check-prefix=CHECK-SYNC_CAS_I486 110 // CHECK-SYNC_CAS_I486: #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 1 111 // CHECK-SYNC_CAS_I486: #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_2 1 112 // CHECK-SYNC_CAS_I486: #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 1 113 // CHECK-SYNC_CAS_I486-NOT: __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 114 // 115 // RUN: %clang_cc1 %s -E -dM -o - -triple i686 -target-cpu i586 \ 116 // RUN: | FileCheck -match-full-lines %s --check-prefix=CHECK-SYNC_CAS_I586 117 // CHECK-SYNC_CAS_I586: #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 1 118 // CHECK-SYNC_CAS_I586: #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_2 1 119 // CHECK-SYNC_CAS_I586: #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 1 120 // CHECK-SYNC_CAS_I586: #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 1 121 // 122 // RUN: %clang_cc1 %s -E -dM -o - -triple armv6 -target-cpu arm1136j-s \ 123 // RUN: | FileCheck -match-full-lines %s --check-prefix=CHECK-SYNC_CAS_ARM 124 // CHECK-SYNC_CAS_ARM: #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 1 125 // CHECK-SYNC_CAS_ARM: #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_2 1 126 // CHECK-SYNC_CAS_ARM: #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 1 127 // CHECK-SYNC_CAS_ARM: #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 1 128 // 129 // RUN: %clang_cc1 %s -E -dM -o - -triple armv7 -target-cpu cortex-a8 \ 130 // RUN: | FileCheck -match-full-lines %s --check-prefix=CHECK-SYNC_CAS_ARMv7 131 // CHECK-SYNC_CAS_ARMv7: #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 1 132 // CHECK-SYNC_CAS_ARMv7: #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_2 1 133 // CHECK-SYNC_CAS_ARMv7: #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 1 134 // CHECK-SYNC_CAS_ARMv7: #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 1 135 // 136 // RUN: %clang_cc1 %s -E -dM -o - -triple armv6 -target-cpu cortex-m0 \ 137 // RUN: | FileCheck -match-full-lines %s --check-prefix=CHECK-SYNC_CAS_ARMv6 138 // CHECK-SYNC_CAS_ARMv6-NOT: __GCC_HAVE_SYNC_COMPARE_AND_SWAP 139 // 140 // RUN: %clang_cc1 %s -E -dM -o - -triple mips -target-cpu mips2 \ 141 // RUN: | FileCheck -match-full-lines %s --check-prefix=CHECK-SYNC_CAS_MIPS \ 142 // RUN: --check-prefix=CHECK-SYNC_CAS_MIPS32 143 // RUN: %clang_cc1 %s -E -dM -o - -triple mips64 -target-cpu mips3 \ 144 // RUN: | FileCheck -match-full-lines %s --check-prefix=CHECK-SYNC_CAS_MIPS \ 145 // RUN: --check-prefix=CHECK-SYNC_CAS_MIPS64 146 // CHECK-SYNC_CAS_MIPS: #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 1 147 // CHECK-SYNC_CAS_MIPS: #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_2 1 148 // CHECK-SYNC_CAS_MIPS: #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 1 149 // CHECK-SYNC_CAS_MIPS32-NOT: __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 150 // CHECK-SYNC_CAS_MIPS64: #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 1 151 152 // RUN: %clang_cc1 %s -E -dM -o - -x cl \ 153 // RUN: | FileCheck -match-full-lines %s --check-prefix=CHECK-CL10 154 // RUN: %clang_cc1 %s -E -dM -o - -x cl -cl-std=CL1.1 \ 155 // RUN: | FileCheck -match-full-lines %s --check-prefix=CHECK-CL11 156 // RUN: %clang_cc1 %s -E -dM -o - -x cl -cl-std=CL1.2 \ 157 // RUN: | FileCheck -match-full-lines %s --check-prefix=CHECK-CL12 158 // RUN: %clang_cc1 %s -E -dM -o - -x cl -cl-std=CL2.0 \ 159 // RUN: | FileCheck -match-full-lines %s --check-prefix=CHECK-CL20 160 // RUN: %clang_cc1 %s -E -dM -o - -x cl -cl-fast-relaxed-math \ 161 // RUN: | FileCheck -match-full-lines %s --check-prefix=CHECK-FRM 162 // CHECK-CL10: #define CL_VERSION_1_0 100 163 // CHECK-CL10: #define CL_VERSION_1_1 110 164 // CHECK-CL10: #define CL_VERSION_1_2 120 165 // CHECK-CL10: #define CL_VERSION_2_0 200 166 // CHECK-CL10: #define __OPENCL_C_VERSION__ 100 167 // CHECK-CL10-NOT: #define __FAST_RELAXED_MATH__ 1 168 // CHECK-CL11: #define CL_VERSION_1_0 100 169 // CHECK-CL11: #define CL_VERSION_1_1 110 170 // CHECK-CL11: #define CL_VERSION_1_2 120 171 // CHECK-CL11: #define CL_VERSION_2_0 200 172 // CHECK-CL11: #define __OPENCL_C_VERSION__ 110 173 // CHECK-CL11-NOT: #define __FAST_RELAXED_MATH__ 1 174 // CHECK-CL12: #define CL_VERSION_1_0 100 175 // CHECK-CL12: #define CL_VERSION_1_1 110 176 // CHECK-CL12: #define CL_VERSION_1_2 120 177 // CHECK-CL12: #define CL_VERSION_2_0 200 178 // CHECK-CL12: #define __OPENCL_C_VERSION__ 120 179 // CHECK-CL12-NOT: #define __FAST_RELAXED_MATH__ 1 180 // CHECK-CL20: #define CL_VERSION_1_0 100 181 // CHECK-CL20: #define CL_VERSION_1_1 110 182 // CHECK-CL20: #define CL_VERSION_1_2 120 183 // CHECK-CL20: #define CL_VERSION_2_0 200 184 // CHECK-CL20: #define __OPENCL_C_VERSION__ 200 185 // CHECK-CL20-NOT: #define __FAST_RELAXED_MATH__ 1 186 // CHECK-FRM: #define __FAST_RELAXED_MATH__ 1 187 188