1 // RUN: %clang_cc1 "-triple" "x86_64-apple-darwin9.0.0" -fsyntax-only -verify %s
3 #if !__has_feature(attribute_availability_with_strict)
4 #error "Missing __has_feature"
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(macOS
,strict
,introduced
=10.6))); //expected-note{{'f6' has been explicitly marked unavailable here}}
18 f2(0); // expected-warning{{'f2' is deprecated: first deprecated in macOS 10.5}}
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}}
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
}}
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}}
32 __attribute__((availability(macosx
,strict
,introduced
=10.6)))
33 void uses_not_introduced_struct_same_availability(struct not_yet_introduced_struct
*);
38 foo
__attribute__((availability(macosx
,introduced
=8.0,deprecated
=9.0)))
42 bar
__attribute__((availability(macosx
,introduced
=8.0,deprecated
=9.0))) = foo
45 enum __attribute__((availability(macosx
,introduced
=8.0,deprecated
=9.0))) {
49 // Make sure the note is on the declaration with the actual availability attributes.
50 struct __attribute__((availability(macOS
,strict
,introduced
=10.9))) type_info
// \
51 expected
-note
{{'type_info' has been explicitly marked unavailable here
}}
56 struct type_info
*t
; // expected-error{{'type_info' is unavailable: introduced in macOS 10.9}}