brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.3 KiB · 8d17df1 Raw
92 lines · plain
1// RUN: %clang_cc1 -triple x86_64-apple-ios14-macabi -fblocks -fsyntax-only -verify %s2// RUN: %clang_cc1 -xobjective-c++ -triple x86_64-apple-ios14-macabi -fblocks -fsyntax-only -verify %s3 4// RUN: %clang_cc1 -triple x86_64-apple-ios14.1-macabi -DNO_WARNING -fblocks -fsyntax-only -verify %s5 6#ifdef NO_WARNING7  // expected-no-diagnostics8#endif9 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)))13 14void previouslyAvailable(void) AVAILABLE_PREV;15void currentlyAvailable(void) AVAILABLE_CURRENT;16void willBeAvailabile(void) AVAILABLE_NEXT;17#ifndef NO_WARNING18// expected-note@-2 {{'willBeAvailabile' has been marked as being introduced in macCatalyst 14.1 here, but the deployment target is macCatalyst 14}}19#endif20 21 22typedef struct {23 24} Record AVAILABLE_NEXT;25#ifndef NO_WARNING26// expected-note@-2 {{'Record' has been marked as being introduced in macCatalyst 14.1 here, but the deployment target is macCatalyst 14}}27#endif28 29AVAILABLE_PREV30Record var;31#ifndef NO_WARNING32// 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}}34#endif35 36AVAILABLE_NEXT37Record var2;38 39void test(void) {40  previouslyAvailable();41  currentlyAvailable();42  willBeAvailabile();43#ifndef NO_WARNING44  // 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}}46#endif47  if (@available(maccatalyst 14.1, *))48    willBeAvailabile(); // OK49  if (@available(ios 14.1, *))50    willBeAvailabile(); // Also OK51  if (@available(macCatalyst 14.1, *))52    willBeAvailabile(); // OK53}54 55void previouslyAvailableIOS(void) __attribute__((availability(ios, introduced = 10)));56void currentlyAvailableIOS(void) __attribute__((availability(ios, introduced = 14)));57void willBeAvailabileIOS(void) __attribute__((availability(ios, introduced = 14.1)));58#ifndef NO_WARNING59// expected-note@-2 {{'willBeAvailabileIOS' has been marked as being introduced in macCatalyst 14.1 here, but the deployment target is macCatalyst 14}}60#endif61 62void testIOSAvailabilityAlsoWorks(void) {63  previouslyAvailableIOS();64  currentlyAvailableIOS();65  willBeAvailabileIOS();66#ifndef NO_WARNING67  // 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}}69#endif70  if (@available(macCatalyst 14.1, *))71    willBeAvailabileIOS(); // OK72  if (@available(ios 14.1, *))73    willBeAvailabile(); // Also OK74}75 76typedef struct {77 78} Record2 __attribute__((availability(ios, introduced = 14.1)));79#ifndef NO_WARNING80// expected-note@-2 {{'Record2' has been marked as being introduced in macCatalyst 14.1 here, but the deployment target is macCatalyst 14}}81#endif82 83__attribute__((availability(ios, introduced = 10)))84Record2 var11;85#ifndef NO_WARNING86// 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}}88#endif89 90__attribute__((availability(ios, introduced = 14.1)))91Record2 var12;92