File: attr-availability-maccatalyst.c

package info (click to toggle)
llvm-toolchain-15 1%3A15.0.6-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,554,644 kB
  • sloc: cpp: 5,922,452; ansic: 1,012,136; asm: 674,362; python: 191,568; objc: 73,855; f90: 42,327; lisp: 31,913; pascal: 11,973; javascript: 10,144; sh: 9,421; perl: 7,447; ml: 5,527; awk: 3,523; makefile: 2,520; xml: 885; cs: 573; fortran: 567
file content (131 lines) | stat: -rw-r--r-- 5,410 bytes parent folder | download | duplicates (13)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
// RUN: %clang_cc1 "-triple" "x86_64-apple-ios13.1-macabi" -fsyntax-only -verify %s
// RUN: %clang_cc1 "-triple" "x86_64-apple-ios13.1-macabi" -fapplication-extension -D APPEXT -fsyntax-only -verify %s

#ifdef APPEXT

#define maccatalyst maccatalyst_app_extension
#define macCatalyst maccatalyst_app_extension
#define ios ios_app_extension

#endif

void f0(int) __attribute__((availability(maccatalyst,introduced=2.0,deprecated=9.1))); // expected-note {{'f0' has been explicitly marked deprecated here}}
void f1(int) __attribute__((availability(maccatalyst,introduced=2.1)));
void f2(int) __attribute__((availability(macCatalyst,introduced=2.0,deprecated=9.0))); // expected-note {{'f2' has been explicitly marked deprecated here}}
void f3(int) __attribute__((availability(maccatalyst,introduced=3.0, obsoleted=9.0))); // expected-note {{'f3' has been explicitly marked unavailable here}}
void f32(int) __attribute__((availability(maccatalyst,introduced=3.0, obsoleted=9.0))); // expected-note {{'f32' has been explicitly marked unavailable here}}


void f5(int) __attribute__((availability(maccatalyst,introduced=2.0))) __attribute__((availability(maccatalyst,deprecated=9.0))); // expected-note {{'f5' has been explicitly marked deprecated here}}
void f6(int) __attribute__((availability(maccatalyst,deprecated=9.0))); // expected-note {{'f6' has been explicitly marked deprecated here}}
void f6(int) __attribute__((availability(macCatalyst,introduced=2.0)));

void f7(void) // expected-note {{'f7' has been explicitly marked deprecated here}}
__attribute__((availability(maccatalyst,introduced=3.0, deprecated=4.0)))
__attribute__((availability(ios,introduced=2.0, deprecated=5.0)));

void f8(void) // expected-note {{'f8' has been explicitly marked unavailable here}}
__attribute__((availability(maccatalyst,introduced=3.0, obsoleted=4.0)))
__attribute__((availability(ios,introduced=2.0, obsoleted=5.0)));

void f9(void) // expected-note {{'f9' has been explicitly marked unavailable here}}
__attribute__((availability(maccatalyst,unavailable)))
__attribute__((availability(ios,introduced=2.0)));

void test(void) {
  f0(0);
#ifndef APPEXT
  // expected-warning@-2 {{'f0' is deprecated: first deprecated in macCatalyst 9.1}}
#else
  // expected-warning@-4 {{'f0' is deprecated: first deprecated in macCatalyst (App Extension) 9.1}}
#endif
  f1(0);
  f2(0);
#ifndef APPEXT
  // expected-warning@-2 {{'f2' is deprecated: first deprecated in macCatalyst 9.0}}
#else
  // expected-warning@-4 {{'f2' is deprecated: first deprecated in macCatalyst (App Extension) 9.0}}
#endif
  f3(0);
#ifndef APPEXT
  // expected-error@-2 {{'f3' is unavailable: obsoleted in macCatalyst 9.0}}
#else
  // expected-error@-4 {{'f3' is unavailable: obsoleted in macCatalyst (App Extension) 9.0}}
#endif
  f32(0);
#ifndef APPEXT
  // expected-error@-2 {{'f32' is unavailable: obsoleted in macCatalyst 9.0}}
#else
  // expected-error@-4 {{'f32' is unavailable: obsoleted in macCatalyst (App Extension) 9.0}}
#endif
  f5(0); // expected-warning{{'f5' is deprecated: first deprecated in macCatalyst}}
  f6(0); // expected-warning{{'f6' is deprecated: first deprecated in macCatalyst}}

  f7();
#ifndef APPEXT
  // expected-warning@-2 {{'f7' is deprecated: first deprecated in macCatalyst 4.0}}
#else
  // expected-warning@-4 {{'f7' is deprecated: first deprecated in macCatalyst (App Extension) 4.0}}
#endif
  f8();
#ifndef APPEXT
  // expected-error@-2 {{'f8' is unavailable: obsoleted in macCatalyst 4.0}}
#else
  // expected-error@-4 {{'f8' is unavailable: obsoleted in macCatalyst (App Extension) 4.0}}
#endif
  f9(); // expected-error {{'f9' is unavailable}}
}

// Don't inherit "deprecated"/"obsoleted" from iOS for Mac Catalyst.

void f100(void)
__attribute__((availability(maccatalyst,introduced=3.0)))
__attribute__((availability(ios,introduced=2.0, deprecated=5.0)));

void f101(void)
__attribute__((availability(maccatalyst,introduced=3.0)))
__attribute__((availability(ios,introduced=2.0, obsoleted=5.0)));

void f102(void)
__attribute__((availability(maccatalyst,introduced=3.0)))
__attribute__((availability(ios,unavailable)));

void f103(void)
__attribute__((availability(ios,unavailable)));

void f103(void)
__attribute__((availability(maccatalyst,introduced=3.0)));

void dontInheritObsoletedDeprecated(void) {
  f100();
  f101();
  f102();
  f103();
}

// Inherit the ios availability when Mac Catalyst isn't given.

void f202(void) __attribute__((availability(ios,introduced=2.0, deprecated=5.0))); // expected-note {{here}}
void f203(void) __attribute__((availability(ios,introduced=2.0, obsoleted=5.0))); // expected-note {{here}}
void f204(void) __attribute__((availability(ios,unavailable))); // expected-note {{here}}

void inheritIosAvailability(void) {
  f202();
#ifndef APPEXT
// expected-warning@-2 {{'f202' is deprecated: first deprecated in macCatalyst 13.1}}
#else
// expected-warning@-4 {{'f202' is deprecated: first deprecated in macCatalyst (App Extension) 13.1}}
#endif
  f203();
#ifndef APPEXT
  // expected-error@-2 {{'f203' is unavailable: obsoleted in macCatalyst 13.1}}
#else
  // expected-error@-4 {{'f203' is unavailable: obsoleted in macCatalyst (App Extension) 13.1}}
#endif
  f204();
#ifndef APPEXT
  // expected-error@-2 {{'f204' is unavailable: not available on macCatalyst}}
#else
  // expected-error@-4 {{'f204' is unavailable: not available on macCatalyst (App Extension)}}
#endif
}