[docs] Add LICENSE.txt to the root of the mono-repo
[llvm-project.git] / clang / test / Sema / attr-availability-maccatalyst.c
blob4e6caca7d72ecddda7095d8195741832807e1efd
1 // RUN: %clang_cc1 "-triple" "x86_64-apple-ios13.1-macabi" -fsyntax-only -verify %s
2 // RUN: %clang_cc1 "-triple" "x86_64-apple-ios13.1-macabi" -fapplication-extension -D APPEXT -fsyntax-only -verify %s
4 #ifdef APPEXT
6 #define maccatalyst maccatalyst_app_extension
7 #define macCatalyst maccatalyst_app_extension
8 #define ios ios_app_extension
10 #endif
12 void f0(int) __attribute__((availability(maccatalyst,introduced=2.0,deprecated=9.1))); // expected-note {{'f0' has been explicitly marked deprecated here}}
13 void f1(int) __attribute__((availability(maccatalyst,introduced=2.1)));
14 void f2(int) __attribute__((availability(macCatalyst,introduced=2.0,deprecated=9.0))); // expected-note {{'f2' has been explicitly marked deprecated here}}
15 void f3(int) __attribute__((availability(maccatalyst,introduced=3.0, obsoleted=9.0))); // expected-note {{'f3' has been explicitly marked unavailable here}}
16 void f32(int) __attribute__((availability(maccatalyst,introduced=3.0, obsoleted=9.0))); // expected-note {{'f32' has been explicitly marked unavailable here}}
19 void f5(int) __attribute__((availability(maccatalyst,introduced=2.0))) __attribute__((availability(maccatalyst,deprecated=9.0))); // expected-note {{'f5' has been explicitly marked deprecated here}}
20 void f6(int) __attribute__((availability(maccatalyst,deprecated=9.0))); // expected-note {{'f6' has been explicitly marked deprecated here}}
21 void f6(int) __attribute__((availability(macCatalyst,introduced=2.0)));
23 void f7(void) // expected-note {{'f7' has been explicitly marked deprecated here}}
24 __attribute__((availability(maccatalyst,introduced=3.0, deprecated=4.0)))
25 __attribute__((availability(ios,introduced=2.0, deprecated=5.0)));
27 void f8(void) // expected-note {{'f8' has been explicitly marked unavailable here}}
28 __attribute__((availability(maccatalyst,introduced=3.0, obsoleted=4.0)))
29 __attribute__((availability(ios,introduced=2.0, obsoleted=5.0)));
31 void f9(void) // expected-note {{'f9' has been explicitly marked unavailable here}}
32 __attribute__((availability(maccatalyst,unavailable)))
33 __attribute__((availability(ios,introduced=2.0)));
35 void test(void) {
36 f0(0);
37 #ifndef APPEXT
38 // expected-warning@-2 {{'f0' is deprecated: first deprecated in macCatalyst 9.1}}
39 #else
40 // expected-warning@-4 {{'f0' is deprecated: first deprecated in macCatalyst (App Extension) 9.1}}
41 #endif
42 f1(0);
43 f2(0);
44 #ifndef APPEXT
45 // expected-warning@-2 {{'f2' is deprecated: first deprecated in macCatalyst 9.0}}
46 #else
47 // expected-warning@-4 {{'f2' is deprecated: first deprecated in macCatalyst (App Extension) 9.0}}
48 #endif
49 f3(0);
50 #ifndef APPEXT
51 // expected-error@-2 {{'f3' is unavailable: obsoleted in macCatalyst 9.0}}
52 #else
53 // expected-error@-4 {{'f3' is unavailable: obsoleted in macCatalyst (App Extension) 9.0}}
54 #endif
55 f32(0);
56 #ifndef APPEXT
57 // expected-error@-2 {{'f32' is unavailable: obsoleted in macCatalyst 9.0}}
58 #else
59 // expected-error@-4 {{'f32' is unavailable: obsoleted in macCatalyst (App Extension) 9.0}}
60 #endif
61 f5(0); // expected-warning{{'f5' is deprecated: first deprecated in macCatalyst}}
62 f6(0); // expected-warning{{'f6' is deprecated: first deprecated in macCatalyst}}
64 f7();
65 #ifndef APPEXT
66 // expected-warning@-2 {{'f7' is deprecated: first deprecated in macCatalyst 4.0}}
67 #else
68 // expected-warning@-4 {{'f7' is deprecated: first deprecated in macCatalyst (App Extension) 4.0}}
69 #endif
70 f8();
71 #ifndef APPEXT
72 // expected-error@-2 {{'f8' is unavailable: obsoleted in macCatalyst 4.0}}
73 #else
74 // expected-error@-4 {{'f8' is unavailable: obsoleted in macCatalyst (App Extension) 4.0}}
75 #endif
76 f9(); // expected-error {{'f9' is unavailable}}
79 // Don't inherit "deprecated"/"obsoleted" from iOS for Mac Catalyst.
81 void f100(void)
82 __attribute__((availability(maccatalyst,introduced=3.0)))
83 __attribute__((availability(ios,introduced=2.0, deprecated=5.0)));
85 void f101(void)
86 __attribute__((availability(maccatalyst,introduced=3.0)))
87 __attribute__((availability(ios,introduced=2.0, obsoleted=5.0)));
89 void f102(void)
90 __attribute__((availability(maccatalyst,introduced=3.0)))
91 __attribute__((availability(ios,unavailable)));
93 void f103(void)
94 __attribute__((availability(ios,unavailable)));
96 void f103(void)
97 __attribute__((availability(maccatalyst,introduced=3.0)));
99 void dontInheritObsoletedDeprecated(void) {
100 f100();
101 f101();
102 f102();
103 f103();
106 // Inherit the ios availability when Mac Catalyst isn't given.
108 void f202(void) __attribute__((availability(ios,introduced=2.0, deprecated=5.0))); // expected-note {{here}}
109 void f203(void) __attribute__((availability(ios,introduced=2.0, obsoleted=5.0))); // expected-note {{here}}
110 void f204(void) __attribute__((availability(ios,unavailable))); // expected-note {{here}}
112 void inheritIosAvailability(void) {
113 f202();
114 #ifndef APPEXT
115 // expected-warning@-2 {{'f202' is deprecated: first deprecated in macCatalyst 13.1}}
116 #else
117 // expected-warning@-4 {{'f202' is deprecated: first deprecated in macCatalyst (App Extension) 13.1}}
118 #endif
119 f203();
120 #ifndef APPEXT
121 // expected-error@-2 {{'f203' is unavailable: obsoleted in macCatalyst 13.1}}
122 #else
123 // expected-error@-4 {{'f203' is unavailable: obsoleted in macCatalyst (App Extension) 13.1}}
124 #endif
125 f204();
126 #ifndef APPEXT
127 // expected-error@-2 {{'f204' is unavailable: not available on macCatalyst}}
128 #else
129 // expected-error@-4 {{'f204' is unavailable: not available on macCatalyst (App Extension)}}
130 #endif