annotate clang/test/Preprocessor/is_target_variant.c @ 236:c4bab56944e8 llvm-original

LLVM 16
author kono
date Wed, 09 Nov 2022 17:45:10 +0900
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
236
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
1 // RUN: %clang_cc1 -fsyntax-only -triple arm64-apple-macos -DMAC -verify %s
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
2 // RUN: %clang_cc1 -fsyntax-only -triple arm64-apple-ios13.1 -DIOS -verify %s
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
3 // RUN: %clang_cc1 -fsyntax-only -triple arm64-apple-ios13.1-macabi -DCATALYST -verify %s
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
4 // RUN: %clang_cc1 -fsyntax-only -triple arm64-apple-macos12 -darwin-target-variant-triple arm64-apple-ios-macabi -DZIPPERED -verify %s
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
5 // expected-no-diagnostics
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
6
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
7 #if !__has_builtin(__is_target_variant_os) || !__has_builtin(__is_target_variant_environment)
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
8 #error "has builtin doesn't work"
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
9 #endif
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
10
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
11 #ifdef ZIPPERED
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
12
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
13 // Target variant is a darwin.
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
14 #if !__is_target_variant_os(darwin)
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
15 #error "mismatching variant os"
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
16 #endif
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
17
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
18 // Target variant is not macOS...
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
19 #if __is_target_variant_os(macos)
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
20 #error "mismatching variant os"
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
21 #endif
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
22
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
23 // ...but iOS.
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
24 #if !__is_target_variant_os(ios)
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
25 #error "mismatching variant os"
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
26 #endif
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
27
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
28 // Zippered builds also set the target variant environment to macabi.
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
29 // At the moment, only zippered builds set __is_target_variant_os(ios),
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
30 // so checking __is_target_variant_environment() is currently redundant
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
31 // with checking the former.
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
32 #if !__is_target_variant_environment(macabi)
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
33 #error "mismatching variant environment"
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
34 #endif
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
35
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
36 #else
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
37
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
38 // In non-zippered builds, even for catalyst, no target variant is set.
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
39 // So these are all false.
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
40
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
41 #if __is_target_variant_os(darwin)
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
42 #error "mismatching variant os"
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
43 #endif
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
44
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
45 #if __is_target_variant_os(macos)
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
46 #error "mismatching variant os"
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
47 #endif
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
48
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
49 #if __is_target_variant_os(ios)
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
50 #error "mismatching variant os"
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
51 #endif
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
52
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
53 #if __is_target_variant_environment(macabi)
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
54 #error "mismatching variant environment"
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
55 #endif
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
56
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
57 #endif
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
58
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
59 // The target environment in zippered builds is _not_ macabi.
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
60 // The target environment is macabi only in catalyst builds.
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
61 #ifdef CATALYST
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
62 #if !__is_target_environment(macabi)
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
63 #error "mismatching environment"
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
64 #endif
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
65 #if !__is_target_os(ios)
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
66 #error "mismatching os"
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
67 #endif
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
68 #else
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
69 #if __is_target_environment(macabi)
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
70 #error "mismatching environment"
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
71 #endif
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
72 #endif