diff options
author | Jordan Rose <jordan_rose@apple.com> | 2012-07-24 21:55:34 +0000 |
---|---|---|
committer | Jordan Rose <jordan_rose@apple.com> | 2012-07-24 21:55:34 +0000 |
commit | b43f63822e051f2d28d8e083b688b2f113d6ba9c (patch) | |
tree | 31e42da02e110a6b4ded84a094ba4569ad68e874 | |
parent | 56bf6fd5ea33e3c8c798d908483f3a6266c7a615 (diff) |
Add __has_feature(attribute_availability_with_message).
This tests for the ability to include a "message" field in availability
attributes, like so:
extern void ATSFontGetName(const char *oName)
__attribute__((availability(macosx,introduced=8.0,deprecated=9.0,
message="use CTFontCopyFullName")));
This was actually supported in Clang 3.1, but we got a request for a
__has_feature so that header files can use this more safely. It's
unfortunate that the 3.1 release doesn't include this, however.
<rdar://problem/11886458>
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160699 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Lex/PPMacroExpansion.cpp | 1 | ||||
-rw-r--r-- | test/Sema/attr-availability.c | 6 |
2 files changed, 7 insertions, 0 deletions
diff --git a/lib/Lex/PPMacroExpansion.cpp b/lib/Lex/PPMacroExpansion.cpp index c9d400fc66..3a7f02cafb 100644 --- a/lib/Lex/PPMacroExpansion.cpp +++ b/lib/Lex/PPMacroExpansion.cpp @@ -619,6 +619,7 @@ static bool HasFeature(const Preprocessor &PP, const IdentifierInfo *II) { .Case("address_sanitizer", LangOpts.AddressSanitizer) .Case("attribute_analyzer_noreturn", true) .Case("attribute_availability", true) + .Case("attribute_availability_with_message", true) .Case("attribute_cf_returns_not_retained", true) .Case("attribute_cf_returns_retained", true) .Case("attribute_deprecated_with_message", true) diff --git a/test/Sema/attr-availability.c b/test/Sema/attr-availability.c index a13e351a6e..b4a6f9616d 100644 --- a/test/Sema/attr-availability.c +++ b/test/Sema/attr-availability.c @@ -37,3 +37,9 @@ void f6(int) __attribute__((availability(ios,deprecated=4.0))); // expected-warn void f7(int) __attribute__((availability(ios,introduced=2.0))); void f7(int) __attribute__((availability(ios,deprecated=3.0))); // expected-note {{previous attribute is here}} void f7(int) __attribute__((availability(ios,deprecated=4.0))); // expected-warning {{availability does not match previous declaration}} + + +// <rdar://problem/11886458> +#if !__has_feature(attribute_availability_with_message) +# error "Missing __has_feature" +#endif |