|
| 1 | +// RUN: %clang -### --target=arm64-apple-darwin %s 2>&1 | FileCheck %s --check-prefix=DARWIN-DEFAULT |
| 2 | +// DARWIN-DEFAULT: "-fdefine-target-os-macros" |
| 3 | + |
| 4 | +// RUN: %clang -### --target=arm-none-linux-gnu %s 2>&1 | FileCheck %s --check-prefix=NON-DARWIN-DEFAULT |
| 5 | +// RUN: %clang -### --target=x86_64-pc-win32 %s 2>&1 | FileCheck %s --check-prefix=NON-DARWIN-DEFAULT |
| 6 | +// NON-DARWIN-DEFAULT-NOT: "-fdefine-target-os-macros" |
| 7 | + |
| 8 | +// RUN: %clang -dM -E --target=arm64-apple-macos %s 2>&1 \ |
| 9 | +// RUN: | FileCheck %s -DMAC=1 \ |
| 10 | +// RUN: -DOSX=1 \ |
| 11 | +// RUN: -DIPHONE=0 \ |
| 12 | +// RUN: -DIOS=0 \ |
| 13 | +// RUN: -DTV=0 \ |
| 14 | +// RUN: -DWATCH=0 \ |
| 15 | +// RUN: -DDRIVERKIT=0 \ |
| 16 | +// RUN: -DMACCATALYST=0 \ |
| 17 | +// RUN: -DEMBEDDED=0 \ |
| 18 | +// RUN: -DSIMULATOR=0 \ |
| 19 | +// RUN: -DWINDOWS=0 \ |
| 20 | +// RUN: -DLINUX=0 \ |
| 21 | +// RUN: -DUNIX=0 |
| 22 | + |
| 23 | +// RUN: %clang -dM -E --target=arm64-apple-ios %s 2>&1 \ |
| 24 | +// RUN: | FileCheck %s -DMAC=1 \ |
| 25 | +// RUN: -DOSX=0 \ |
| 26 | +// RUN: -DIPHONE=1 \ |
| 27 | +// RUN: -DIOS=1 \ |
| 28 | +// RUN: -DTV=0 \ |
| 29 | +// RUN: -DWATCH=0 \ |
| 30 | +// RUN: -DDRIVERKIT=0 \ |
| 31 | +// RUN: -DMACCATALYST=0 \ |
| 32 | +// RUN: -DEMBEDDED=1 \ |
| 33 | +// RUN: -DSIMULATOR=0 \ |
| 34 | +// RUN: -DWINDOWS=0 \ |
| 35 | +// RUN: -DLINUX=0 \ |
| 36 | +// RUN: -DUNIX=0 |
| 37 | + |
| 38 | +// RUN: %clang -dM -E --target=arm64-apple-ios-macabi %s 2>&1 \ |
| 39 | +// RUN: | FileCheck %s -DMAC=1 \ |
| 40 | +// RUN: -DOSX=0 \ |
| 41 | +// RUN: -DIPHONE=1 \ |
| 42 | +// RUN: -DIOS=1 \ |
| 43 | +// RUN: -DTV=0 \ |
| 44 | +// RUN: -DWATCH=0 \ |
| 45 | +// RUN: -DDRIVERKIT=0 \ |
| 46 | +// RUN: -DMACCATALYST=1 \ |
| 47 | +// RUN: -DEMBEDDED=0 \ |
| 48 | +// RUN: -DSIMULATOR=0 \ |
| 49 | +// RUN: -DWINDOWS=0 \ |
| 50 | +// RUN: -DLINUX=0 \ |
| 51 | +// RUN: -DUNIX=0 |
| 52 | + |
| 53 | +// RUN: %clang -dM -E --target=arm64-apple-ios-simulator %s 2>&1 \ |
| 54 | +// RUN: | FileCheck %s -DMAC=1 \ |
| 55 | +// RUN: -DOSX=0 \ |
| 56 | +// RUN: -DIPHONE=1 \ |
| 57 | +// RUN: -DIOS=1 \ |
| 58 | +// RUN: -DTV=0 \ |
| 59 | +// RUN: -DWATCH=0 \ |
| 60 | +// RUN: -DDRIVERKIT=0 \ |
| 61 | +// RUN: -DMACCATALYST=0 \ |
| 62 | +// RUN: -DEMBEDDED=0 \ |
| 63 | +// RUN: -DSIMULATOR=1 \ |
| 64 | +// RUN: -DWINDOWS=0 \ |
| 65 | +// RUN: -DLINUX=0 \ |
| 66 | +// RUN: -DUNIX=0 |
| 67 | + |
| 68 | +// RUN: %clang -dM -E --target=arm64-apple-tvos %s 2>&1 \ |
| 69 | +// RUN: | FileCheck %s -DMAC=1 \ |
| 70 | +// RUN: -DOSX=0 \ |
| 71 | +// RUN: -DIPHONE=1 \ |
| 72 | +// RUN: -DIOS=0 \ |
| 73 | +// RUN: -DTV=1 \ |
| 74 | +// RUN: -DWATCH=0 \ |
| 75 | +// RUN: -DDRIVERKIT=0 \ |
| 76 | +// RUN: -DMACCATALYST=0 \ |
| 77 | +// RUN: -DEMBEDDED=1 \ |
| 78 | +// RUN: -DSIMULATOR=0 \ |
| 79 | +// RUN: -DWINDOWS=0 \ |
| 80 | +// RUN: -DLINUX=0 \ |
| 81 | +// RUN: -DUNIX=0 |
| 82 | + |
| 83 | +// RUN: %clang -dM -E --target=arm64-apple-tvos-simulator %s 2>&1 \ |
| 84 | +// RUN: | FileCheck %s -DMAC=1 \ |
| 85 | +// RUN: -DOSX=0 \ |
| 86 | +// RUN: -DIPHONE=1 \ |
| 87 | +// RUN: -DIOS=0 \ |
| 88 | +// RUN: -DTV=1 \ |
| 89 | +// RUN: -DWATCH=0 \ |
| 90 | +// RUN: -DDRIVERKIT=0 \ |
| 91 | +// RUN: -DMACCATALYST=0 \ |
| 92 | +// RUN: -DEMBEDDED=0 \ |
| 93 | +// RUN: -DSIMULATOR=1 \ |
| 94 | +// RUN: -DWINDOWS=0 \ |
| 95 | +// RUN: -DLINUX=0 \ |
| 96 | +// RUN: -DUNIX=0 |
| 97 | + |
| 98 | +// RUN: %clang -dM -E --target=arm64-apple-watchos %s 2>&1 \ |
| 99 | +// RUN: | FileCheck %s -DMAC=1 \ |
| 100 | +// RUN: -DOSX=0 \ |
| 101 | +// RUN: -DIPHONE=1 \ |
| 102 | +// RUN: -DIOS=0 \ |
| 103 | +// RUN: -DTV=0 \ |
| 104 | +// RUN: -DWATCH=1 \ |
| 105 | +// RUN: -DDRIVERKIT=0 \ |
| 106 | +// RUN: -DMACCATALYST=0 \ |
| 107 | +// RUN: -DEMBEDDED=1 \ |
| 108 | +// RUN: -DSIMULATOR=0 \ |
| 109 | +// RUN: -DWINDOWS=0 \ |
| 110 | +// RUN: -DLINUX=0 \ |
| 111 | +// RUN: -DUNIX=0 |
| 112 | + |
| 113 | +// RUN: %clang -dM -E --target=arm64-apple-watchos-simulator %s 2>&1 \ |
| 114 | +// RUN: | FileCheck %s -DMAC=1 \ |
| 115 | +// RUN: -DOSX=0 \ |
| 116 | +// RUN: -DIPHONE=1 \ |
| 117 | +// RUN: -DIOS=0 \ |
| 118 | +// RUN: -DTV=0 \ |
| 119 | +// RUN: -DWATCH=1 \ |
| 120 | +// RUN: -DDRIVERKIT=0 \ |
| 121 | +// RUN: -DMACCATALYST=0 \ |
| 122 | +// RUN: -DEMBEDDED=0 \ |
| 123 | +// RUN: -DSIMULATOR=1 \ |
| 124 | +// RUN: -DWINDOWS=0 \ |
| 125 | +// RUN: -DLINUX=0 \ |
| 126 | +// RUN: -DUNIX=0 |
| 127 | + |
| 128 | +// RUN: %clang -dM -E --target=arm64-apple-driverkit %s 2>&1 \ |
| 129 | +// RUN: | FileCheck %s -DMAC=1 \ |
| 130 | +// RUN: -DOSX=0 \ |
| 131 | +// RUN: -DIPHONE=0 \ |
| 132 | +// RUN: -DIOS=0 \ |
| 133 | +// RUN: -DTV=0 \ |
| 134 | +// RUN: -DWATCH=0 \ |
| 135 | +// RUN: -DDRIVERKIT=1 \ |
| 136 | +// RUN: -DMACCATALYST=0 \ |
| 137 | +// RUN: -DEMBEDDED=0 \ |
| 138 | +// RUN: -DSIMULATOR=0 \ |
| 139 | +// RUN: -DWINDOWS=0 \ |
| 140 | +// RUN: -DLINUX=0 \ |
| 141 | +// RUN: -DUNIX=0 |
| 142 | + |
| 143 | +// RUN: %clang -dM -E --target=x86_64-pc-linux-gnu \ |
| 144 | +// RUN: -fdefine-target-os-macros %s 2>&1 \ |
| 145 | +// RUN: | FileCheck %s -DMAC=0 \ |
| 146 | +// RUN: -DOSX=0 \ |
| 147 | +// RUN: -DIPHONE=0 \ |
| 148 | +// RUN: -DIOS=0 \ |
| 149 | +// RUN: -DTV=0 \ |
| 150 | +// RUN: -DWATCH=0 \ |
| 151 | +// RUN: -DDRIVERKIT=0 \ |
| 152 | +// RUN: -DMACCATALYST=0 \ |
| 153 | +// RUN: -DEMBEDDED=0 \ |
| 154 | +// RUN: -DSIMULATOR=0 \ |
| 155 | +// RUN: -DWINDOWS=0 \ |
| 156 | +// RUN: -DLINUX=1 \ |
| 157 | +// RUN: -DUNIX=0 |
| 158 | + |
| 159 | +// RUN: %clang -dM -E --target=x86_64-pc-win32 \ |
| 160 | +// RUN: -fdefine-target-os-macros %s 2>&1 \ |
| 161 | +// RUN: | FileCheck %s -DMAC=0 \ |
| 162 | +// RUN: -DOSX=0 \ |
| 163 | +// RUN: -DIPHONE=0 \ |
| 164 | +// RUN: -DIOS=0 \ |
| 165 | +// RUN: -DTV=0 \ |
| 166 | +// RUN: -DWATCH=0 \ |
| 167 | +// RUN: -DDRIVERKIT=0 \ |
| 168 | +// RUN: -DMACCATALYST=0 \ |
| 169 | +// RUN: -DEMBEDDED=0 \ |
| 170 | +// RUN: -DSIMULATOR=0 \ |
| 171 | +// RUN: -DWINDOWS=1 \ |
| 172 | +// RUN: -DLINUX=0 \ |
| 173 | +// RUN: -DUNIX=0 |
| 174 | + |
| 175 | +// RUN: %clang -dM -E --target=x86_64-pc-windows-gnu \ |
| 176 | +// RUN: -fdefine-target-os-macros %s 2>&1 \ |
| 177 | +// RUN: | FileCheck %s -DMAC=0 \ |
| 178 | +// RUN: -DOSX=0 \ |
| 179 | +// RUN: -DIPHONE=0 \ |
| 180 | +// RUN: -DIOS=0 \ |
| 181 | +// RUN: -DTV=0 \ |
| 182 | +// RUN: -DWATCH=0 \ |
| 183 | +// RUN: -DDRIVERKIT=0 \ |
| 184 | +// RUN: -DMACCATALYST=0 \ |
| 185 | +// RUN: -DEMBEDDED=0 \ |
| 186 | +// RUN: -DSIMULATOR=0 \ |
| 187 | +// RUN: -DWINDOWS=1 \ |
| 188 | +// RUN: -DLINUX=0 \ |
| 189 | +// RUN: -DUNIX=0 |
| 190 | + |
| 191 | +// RUN: %clang -dM -E --target=sparc-none-solaris \ |
| 192 | +// RUN: -fdefine-target-os-macros %s 2>&1 \ |
| 193 | +// RUN: | FileCheck %s -DMAC=0 \ |
| 194 | +// RUN: -DOSX=0 \ |
| 195 | +// RUN: -DIPHONE=0 \ |
| 196 | +// RUN: -DIOS=0 \ |
| 197 | +// RUN: -DTV=0 \ |
| 198 | +// RUN: -DWATCH=0 \ |
| 199 | +// RUN: -DDRIVERKIT=0 \ |
| 200 | +// RUN: -DMACCATALYST=0 \ |
| 201 | +// RUN: -DEMBEDDED=0 \ |
| 202 | +// RUN: -DSIMULATOR=0 \ |
| 203 | +// RUN: -DWINDOWS=0 \ |
| 204 | +// RUN: -DLINUX=0 \ |
| 205 | +// RUN: -DUNIX=1 |
| 206 | + |
| 207 | +// RUN: %clang -dM -E --target=arm64-apple-macos \ |
| 208 | +// RUN: -fno-define-target-os-macros %s 2>&1 \ |
| 209 | +// RUN: | FileCheck %s --check-prefix=NEG |
| 210 | + |
| 211 | +// RUN: %clang -dM -E --target=arm64-apple-macos \ |
| 212 | +// RUN: -fdefine-target-os-macros \ |
| 213 | +// RUN: -fno-define-target-os-macros %s 2>&1 \ |
| 214 | +// RUN: | FileCheck %s --check-prefix=NEG |
| 215 | + |
| 216 | +// RUN: %clang -dM -E --target=x86_64-pc-windows \ |
| 217 | +// RUN: -fdefine-target-os-macros \ |
| 218 | +// RUN: -fno-define-target-os-macros %s 2>&1 \ |
| 219 | +// RUN: | FileCheck %s --check-prefix=NEG |
| 220 | + |
| 221 | +// NEG-NOT: #define TARGET_OS_ |
| 222 | + |
| 223 | +// CHECK-DAG: #define TARGET_OS_MAC [[MAC]] |
| 224 | +// CHECK-DAG: #define TARGET_OS_OSX [[OSX]] |
| 225 | +// CHECK-DAG: #define TARGET_OS_IPHONE [[IPHONE]] |
| 226 | +// CHECK-DAG: #define TARGET_OS_IOS [[IOS]] |
| 227 | +// CHECK-DAG: #define TARGET_OS_TV [[TV]] |
| 228 | +// CHECK-DAG: #define TARGET_OS_WATCH [[WATCH]] |
| 229 | +// CHECK-DAG: #define TARGET_OS_DRIVERKIT [[DRIVERKIT]] |
| 230 | +// CHECK-DAG: #define TARGET_OS_MACCATALYST [[MACCATALYST]] |
| 231 | +// CHECK-DAG: #define TARGET_OS_SIMULATOR [[SIMULATOR]] |
| 232 | +// Deprecated |
| 233 | +// CHECK-DAG: #define TARGET_OS_EMBEDDED [[EMBEDDED]] |
| 234 | +// CHECK-DAG: #define TARGET_OS_NANO [[WATCH]] |
| 235 | +// CHECK-DAG: #define TARGET_IPHONE_SIMULATOR [[SIMULATOR]] |
| 236 | +// CHECK-DAG: #define TARGET_OS_UIKITFORMAC [[MACCATALYST]] |
| 237 | +// Non-darwin OSes |
| 238 | +// CHECK-DAG: #define TARGET_OS_WIN32 [[WINDOWS]] |
| 239 | +// CHECK-DAG: #define TARGET_OS_WINDOWS [[WINDOWS]] |
| 240 | +// CHECK-DAG: #define TARGET_OS_LINUX [[LINUX]] |
| 241 | +// CHECK-DAG: #define TARGET_OS_UNIX [[UNIX]] |
0 commit comments