attr-availability.c revision d6724367519b4f98dcce091854549282c11d70a0
1// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -fsyntax-only -verify %s
2
3void f0() __attribute__((availability(macosx,introduced=10.4,deprecated=10.2))); // expected-warning{{feature cannot be deprecated in Mac OS X version 10.2 before it was introduced in version 10.4; attribute ignored}}
4void f1() __attribute__((availability(ios,obsoleted=2.1,deprecated=3.0)));  // expected-warning{{feature cannot be obsoleted in iOS version 2.1 before it was deprecated in version 3.0; attribute ignored}}
5void f2() __attribute__((availability(ios,introduced=2.1,deprecated=2.1)));
6
7void f3() __attribute__((availability(otheros,introduced=2.2))); // expected-warning{{unknown platform 'otheros' in availability macro}}
8
9// rdar://10095131
10extern void
11ATSFontGetName(const char *oName) __attribute__((availability(macosx,introduced=8.0,deprecated=9.0, message="use CTFontCopyFullName"))); // expected-note {{'ATSFontGetName' declared here}}
12
13extern void
14ATSFontGetPostScriptName(int flags) __attribute__((availability(macosx,introduced=8.0,obsoleted=9.0, message="use ATSFontGetFullPostScriptName"))); // expected-note {{function has been explicitly marked unavailable here}}
15
16void test_10095131() {
17  ATSFontGetName("Hello"); // expected-warning {{'ATSFontGetName' is deprecated: first deprecated in Mac OS X 9.0 - use CTFontCopyFullName}}
18  ATSFontGetPostScriptName(100); // expected-error {{'ATSFontGetPostScriptName' is unavailable: obsoleted in Mac OS X 9.0 - use ATSFontGetFullPostScriptName}}
19}
20
21// rdar://10711037
22__attribute__((availability(macos, unavailable))) // expected-warning {{attribute 'availability' is ignored}}
23enum {
24    NSDataWritingFileProtectionWriteOnly = 0x30000000,
25    NSDataWritingFileProtectionCompleteUntilUserAuthentication = 0x40000000,
26};
27