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