blob: 928ca6f4fa8d9177bc93daa3f3700ba41abe9eac [file] [log] [blame]
Reid Klecknerdbc390d2018-07-23 17:44:00 +00001// This test verifies that the correct macros are predefined.
2//
3// RUN: %clang_cc1 %s -x c++ -E -dM -triple x86_64-pc-win32 -fms-extensions -fms-compatibility \
4// RUN: -fms-compatibility-version=19.00 -std=c++14 -o - | FileCheck -match-full-lines %s --check-prefix=CHECK-MS64
Nirav Dave90868bb2019-02-14 19:27:25 +00005// RUN: %clang_cc1 %s -x c++ -E -dM -triple x86_64-pc-win32 -fms-extensions -fms-compatibility \
Craig Topper7339e612019-03-21 20:36:08 +00006// RUN: -fms-compatibility-version=19.00 -std=c++14 -o - | grep GCC | count 5
Reid Klecknerdbc390d2018-07-23 17:44:00 +00007// CHECK-MS64: #define _INTEGRAL_MAX_BITS 64
8// CHECK-MS64: #define _MSC_EXTENSIONS 1
9// CHECK-MS64: #define _MSC_VER 1900
10// CHECK-MS64: #define _MSVC_LANG 201402L
11// CHECK-MS64: #define _M_AMD64 100
12// CHECK-MS64: #define _M_X64 100
13// CHECK-MS64: #define _WIN64 1
14// CHECK-MS64-NOT: #define __STRICT_ANSI__
Nirav Dave90868bb2019-02-14 19:27:25 +000015// CHECK-MS64-NOT: GNU
16// CHECK-MS64-NOT: GXX
17// CHECK-MS64: #define __GCC_ASM_FLAG_OUTPUTS__ 1
Craig Topper7339e612019-03-21 20:36:08 +000018// CHECK-MS64: #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 1
19// CHECK-MS64: #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_2 1
20// CHECK-MS64: #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 1
21// CHECK-MS64: #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 1
Reid Klecknerdbc390d2018-07-23 17:44:00 +000022// CHECK-MS64-NOT: GNU
23// CHECK-MS64-NOT: GXX
24
25// RUN: %clang_cc1 %s -x c++ -E -dM -triple i686-pc-win32 -fms-extensions -fms-compatibility \
26// RUN: -fms-compatibility-version=19.00 -std=c++17 -o - | FileCheck -match-full-lines %s --check-prefix=CHECK-MS
Nirav Dave90868bb2019-02-14 19:27:25 +000027// RUN: %clang_cc1 %s -x c++ -E -dM -triple i686-pc-win32 -fms-extensions -fms-compatibility \
Craig Topper7339e612019-03-21 20:36:08 +000028// RUN: -fms-compatibility-version=19.00 -std=c++17 -o - | grep GCC | count 5
Reid Klecknerdbc390d2018-07-23 17:44:00 +000029// CHECK-MS: #define _INTEGRAL_MAX_BITS 64
30// CHECK-MS: #define _MSC_EXTENSIONS 1
31// CHECK-MS: #define _MSC_VER 1900
32// CHECK-MS: #define _MSVC_LANG 201703L
33// CHECK-MS: #define _M_IX86 600
34// CHECK-MS: #define _M_IX86_FP 0
35// CHECK-MS: #define _WIN32 1
36// CHECK-MS-NOT: #define __STRICT_ANSI__
Nirav Dave90868bb2019-02-14 19:27:25 +000037// CHECK-MS-NOT: GNU
38// CHECK-MS-NOT: GXX
39// CHECK-MS: #define __GCC_ASM_FLAG_OUTPUTS__ 1
Craig Topper7339e612019-03-21 20:36:08 +000040// CHECK-MS: #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 1
41// CHECK-MS: #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_2 1
42// CHECK-MS: #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 1
43// CHECK-MS: #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 1
Reid Klecknerdbc390d2018-07-23 17:44:00 +000044// CHECK-MS-NOT: GNU
45// CHECK-MS-NOT: GXX
46
47// RUN: %clang_cc1 %s -x c++ -E -dM -triple i686-pc-win32 -fms-extensions -fms-compatibility \
48// RUN: -fms-compatibility-version=19.00 -std=c++2a -o - | FileCheck -match-full-lines %s --check-prefix=CHECK-MS-CPP2A
49// CHECK-MS-CPP2A: #define _MSC_VER 1900
Soumi Manna9c29aed2019-12-04 14:38:00 -080050// CHECK-MS-CPP2A: #define _MSVC_LANG 201705L
Reid Klecknerdbc390d2018-07-23 17:44:00 +000051
52// RUN: %clang_cc1 -triple i386-windows %s -E -dM -o - \
53// RUN: | FileCheck -match-full-lines %s --check-prefix=CHECK-X86-WIN
54
55// CHECK-X86-WIN-NOT: #define WIN32 1
56// CHECK-X86-WIN-NOT: #define WIN64 1
57// CHECK-X86-WIN-NOT: #define WINNT 1
58// CHECK-X86-WIN: #define _WIN32 1
59// CHECK-X86-WIN-NOT: #define _WIN64 1
60
61// RUN: %clang_cc1 -triple thumbv7-windows %s -E -dM -o - \
62// RUN: | FileCheck -match-full-lines %s --check-prefix=CHECK-ARM-WIN
63
64// CHECK-ARM-WIN-NOT: #define WIN32 1
65// CHECK-ARM-WIN-NOT: #define WIN64 1
66// CHECK-ARM-WIN-NOT: #define WINNT 1
67// CHECK-ARM-WIN: #define _WIN32 1
68// CHECK-ARM-WIN-NOT: #define _WIN64 1
69
70// RUN: %clang_cc1 -triple x86_64-windows %s -E -dM -o - \
71// RUN: | FileCheck -match-full-lines %s --check-prefix=CHECK-AMD64-WIN
72
73// CHECK-AMD64-WIN-NOT: #define WIN32 1
74// CHECK-AMD64-WIN-NOT: #define WIN64 1
75// CHECK-AMD64-WIN-NOT: #define WINNT 1
76// CHECK-AMD64-WIN: #define _WIN32 1
77// CHECK-AMD64-WIN: #define _WIN64 1
78
79// RUN: %clang_cc1 -triple aarch64-windows %s -E -dM -o - \
80// RUN: | FileCheck -match-full-lines %s --check-prefix=CHECK-ARM64-WIN
81
82// CHECK-ARM64-WIN-NOT: #define WIN32 1
83// CHECK-ARM64-WIN-NOT: #define WIN64 1
84// CHECK-ARM64-WIN-NOT: #define WINNT 1
85// CHECK-ARM64-WIN: #define _M_ARM64 1
86// CHECK-ARM64-WIN: #define _WIN32 1
87// CHECK-ARM64-WIN: #define _WIN64 1
88
89// RUN: %clang_cc1 -triple i686-windows-gnu %s -E -dM -o - \
90// RUN: | FileCheck -match-full-lines %s --check-prefix=CHECK-X86-MINGW
91
92// CHECK-X86-MINGW: #define WIN32 1
93// CHECK-X86-MINGW-NOT: #define WIN64 1
94// CHECK-X86-MINGW: #define WINNT 1
95// CHECK-X86-MINGW: #define _WIN32 1
96// CHECK-X86-MINGW-NOT: #define _WIN64 1
97
98// RUN: %clang_cc1 -triple thumbv7-windows-gnu %s -E -dM -o - \
99// RUN: | FileCheck -match-full-lines %s --check-prefix=CHECK-ARM-MINGW
100
101// CHECK-ARM-MINGW: #define WIN32 1
102// CHECK-ARM-MINGW-NOT: #define WIN64 1
103// CHECK-ARM-MINGW: #define WINNT 1
104// CHECK-ARM-MINGW: #define _WIN32 1
105// CHECK-ARM-MINGW-NOT: #define _WIN64 1
106
107// RUN: %clang_cc1 -triple x86_64-windows-gnu %s -E -dM -o - \
108// RUN: | FileCheck -match-full-lines %s --check-prefix=CHECK-AMD64-MINGW
109
110// CHECK-AMD64-MINGW: #define WIN32 1
111// CHECK-AMD64-MINGW: #define WIN64 1
112// CHECK-AMD64-MINGW: #define WINNT 1
113// CHECK-AMD64-MINGW: #define _WIN32 1
114// CHECK-AMD64-MINGW: #define _WIN64 1
115
116// RUN: %clang_cc1 -triple aarch64-windows-gnu %s -E -dM -o - \
117// RUN: | FileCheck -match-full-lines %s --check-prefix=CHECK-ARM64-MINGW
118
119// CHECK-ARM64-MINGW-NOT: #define _M_ARM64 1
120// CHECK-ARM64-MINGW: #define WIN32 1
121// CHECK-ARM64-MINGW: #define WIN64 1
122// CHECK-ARM64-MINGW: #define WINNT 1
123// CHECK-ARM64-MINGW: #define _WIN32 1
124// CHECK-ARM64-MINGW: #define _WIN64 1
125// CHECK-ARM64-MINGW: #define __aarch64__ 1