diff options
Diffstat (limited to 'test/Sema')
-rw-r--r-- | test/Sema/attr-availability.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/test/Sema/attr-availability.c b/test/Sema/attr-availability.c index b7a8e6ef0f..48bdf26598 100644 --- a/test/Sema/attr-availability.c +++ b/test/Sema/attr-availability.c @@ -1,4 +1,6 @@ // RUN: %clang_cc1 -triple x86_64-apple-darwin9 -fsyntax-only -fblocks -verify %s +// RUN: %clang_cc1 -D WARN_PARTIAL -Wpartial-availability -triple x86_64-apple-darwin9 -fsyntax-only -fblocks -verify %s +// void f0() __attribute__((availability(macosx,introduced=10.4,deprecated=10.2))); // expected-warning{{feature cannot be deprecated in OS X version 10.2 before it was introduced in version 10.4; attribute ignored}} void 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}} @@ -13,9 +15,32 @@ ATSFontGetName(const char *oName) __attribute__((availability(macosx,introduced= extern void ATSFontGetPostScriptName(int flags) __attribute__((availability(macosx,introduced=8.0,obsoleted=9.0, message="use ATSFontGetFullPostScriptName"))); // expected-note {{'ATSFontGetPostScriptName' has been explicitly marked unavailable here}} +#if defined(WARN_PARTIAL) +// expected-note@+3 {{has been explicitly marked partial here}} +#endif +extern void +PartiallyAvailable() __attribute__((availability(macosx,introduced=10.8))); + +enum __attribute__((availability(macosx,introduced=10.8))) PartialEnum { + kPartialEnumConstant, +}; + void test_10095131() { ATSFontGetName("Hello"); // expected-warning {{'ATSFontGetName' is deprecated: first deprecated in OS X 9.0 - use CTFontCopyFullName}} ATSFontGetPostScriptName(100); // expected-error {{'ATSFontGetPostScriptName' is unavailable: obsoleted in OS X 9.0 - use ATSFontGetFullPostScriptName}} + +#if defined(WARN_PARTIAL) + // expected-warning@+2 {{is partial: introduced in OS X 10.8}} expected-note@+2 {{explicitly redeclare 'PartiallyAvailable' to silence this warning}} +#endif + PartiallyAvailable(); +} + +extern void PartiallyAvailable() ; +void with_redeclaration() { + PartiallyAvailable(); // Don't warn. + + // enums should never warn. + enum PartialEnum p = kPartialEnumConstant; } // rdar://10711037 |