1 // RUN: %clang_cc1 "-triple" "x86_64-apple-darwin9.0.0" -fsyntax-only -verify %s 2 3 #if !__has_feature(attribute_availability_with_strict) 4 #error "Missing __has_feature" 5 #endif 6 7 void f0(int) __attribute__((availability(macosx,introduced=10.4,deprecated=10.6))); 8 void f1(int) __attribute__((availability(macosx,introduced=10.5))); 9 void f2(int) __attribute__((availability(macosx,introduced=10.4,deprecated=10.5))); // expected-note {{'f2' has been explicitly marked deprecated here}} 10 void f3(int) __attribute__((availability(macosx,introduced=10.6))); 11 void f4(int) __attribute__((availability(macosx,introduced=10.1,deprecated=10.3,obsoleted=10.5), availability(ios,introduced=2.0,deprecated=3.0))); // expected-note{{explicitly marked unavailable}} 12 void f5(int) __attribute__((availability(ios,introduced=3.2), availability(macosx,unavailable))); // expected-note{{'f5' has been explicitly marked unavailable here}} 13 void f6(int) __attribute__((availability(macosx,strict,introduced=10.6))); //expected-note{{'f6' has been explicitly marked unavailable here}} 14 15 void test() { 16 f0(0); 17 f1(0); 18 f2(0); // expected-warning{{'f2' is deprecated: first deprecated in macOS 10.5}} 19 f3(0); 20 f4(0); // expected-error{{f4' is unavailable: obsoleted in macOS 10.5}} 21 f5(0); // expected-error{{'f5' is unavailable: not available on macOS}} 22 f6(0); // expected-error{{'f6' is unavailable: introduced in macOS 10.6}} 23 } 24 25 struct __attribute__((availability(macosx,strict,introduced=10.6))) 26 not_yet_introduced_struct; // \ 27 expected-note{{'not_yet_introduced_struct' has been explicitly marked unavailable here}} 28 29 void uses_not_introduced_struct(struct not_yet_introduced_struct *); // \ 30 expected-error{{'not_yet_introduced_struct' is unavailable: introduced in macOS 10.6}} 31 32 __attribute__((availability(macosx,strict,introduced=10.6))) 33 void uses_not_introduced_struct_same_availability(struct not_yet_introduced_struct *); 34 35 // rdar://10535640 36 37 enum { 38 foo __attribute__((availability(macosx,introduced=8.0,deprecated=9.0))) 39 }; 40 41 enum { 42 bar __attribute__((availability(macosx,introduced=8.0,deprecated=9.0))) = foo 43 }; 44 45 enum __attribute__((availability(macosx,introduced=8.0,deprecated=9.0))) { 46 bar1 = foo 47 }; 48 49 // Make sure the note is on the declaration with the actual availability attributes. 50 struct __attribute__((availability(macosx,strict,introduced=10.9))) type_info // \ 51 expected-note{{'type_info' has been explicitly marked unavailable here}} 52 { 53 }; 54 struct type_info; 55 int test2() { 56 struct type_info *t; // expected-error{{'type_info' is unavailable: introduced in macOS 10.9}} 57 return 0; 58 } 59