1 // RUN: %clang_cc1 -triple x86_64-apple-ios14-macabi -fblocks -fsyntax-only -verify %s
2 // RUN: %clang_cc1 -xobjective-c++ -triple x86_64-apple-ios14-macabi -fblocks -fsyntax-only -verify %s
4 // RUN: %clang_cc1 -triple x86_64-apple-ios14.1-macabi -DNO_WARNING -fblocks -fsyntax-only -verify %s
7 // expected-no-diagnostics
10 #define AVAILABLE_PREV __attribute__((availability(macCatalyst, introduced = 13.1)))
11 #define AVAILABLE_CURRENT __attribute__((availability(macCatalyst, introduced = 14)))
12 #define AVAILABLE_NEXT __attribute__((availability(macCatalyst, introduced = 14.1)))
14 void previouslyAvailable(void) AVAILABLE_PREV;
15 void currentlyAvailable(void) AVAILABLE_CURRENT;
16 void willBeAvailabile(void) AVAILABLE_NEXT;
18 // expected-note@-2 {{'willBeAvailabile' has been marked as being introduced in macCatalyst 14.1 here, but the deployment target is macCatalyst 14}}
24 } Record AVAILABLE_NEXT;
26 // expected-note@-2 {{'Record' has been marked as being introduced in macCatalyst 14.1 here, but the deployment target is macCatalyst 14}}
32 // expected-warning@-2 {{'Record' is only available on macCatalyst 14.1 or newer}}
33 // expected-note@-3 {{annotate 'var' with an availability attribute to silence this warnin}}
40 previouslyAvailable();
44 // expected-warning@-2 {{'willBeAvailabile' is only available on macCatalyst 14.1 or newer}}
45 // expected-note@-3 {{enclose 'willBeAvailabile' in an @available check to silence this warning}}
47 if (@available(maccatalyst 14.1, *))
48 willBeAvailabile(); // OK
49 if (@available(ios 14.1, *))
50 willBeAvailabile(); // Also OK
51 if (@available(macCatalyst 14.1, *))
52 willBeAvailabile(); // OK
55 void previouslyAvailableIOS(void) __attribute__((availability(ios, introduced = 10)));
56 void currentlyAvailableIOS(void) __attribute__((availability(ios, introduced = 14)));
57 void willBeAvailabileIOS(void) __attribute__((availability(ios, introduced = 14.1)));
59 // expected-note@-2 {{'willBeAvailabileIOS' has been marked as being introduced in macCatalyst 14.1 here, but the deployment target is macCatalyst 14}}
62 void testIOSAvailabilityAlsoWorks(void) {
63 previouslyAvailableIOS();
64 currentlyAvailableIOS();
65 willBeAvailabileIOS();
67 // expected-warning@-2 {{'willBeAvailabileIOS' is only available on macCatalyst 14.1 or newer}}
68 // expected-note@-3 {{enclose 'willBeAvailabileIOS' in an @available check to silence this warning}}
70 if (@available(macCatalyst 14.1, *))
71 willBeAvailabileIOS(); // OK
72 if (@available(ios 14.1, *))
73 willBeAvailabile(); // Also OK
78 } Record2 __attribute__((availability(ios, introduced = 14.1)));
80 // expected-note@-2 {{'Record2' has been marked as being introduced in macCatalyst 14.1 here, but the deployment target is macCatalyst 14}}
83 __attribute__((availability(ios, introduced = 10)))
86 // expected-warning@-2 {{'Record2' is only available on macCatalyst 14.1 or newer}}
87 // expected-note@-3 {{annotate 'var11' with an availability attribute to silence this warnin}}
90 __attribute__((availability(ios, introduced = 14.1)))