summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
authorJordan Rose <jordan_rose@apple.com>2012-07-24 21:55:34 +0000
committerJordan Rose <jordan_rose@apple.com>2012-07-24 21:55:34 +0000
commit68449acea428a3c76a3d1e3854a171ccf1300253 (patch)
treeb185fde6f86ee6a1d0e61e7cc1e78806c44a7739 /clang
parentf30e9bfb9022937a89dbc5ac93bebc6ed003e6cd (diff)
downloadbcm5719-llvm-68449acea428a3c76a3d1e3854a171ccf1300253.tar.gz
bcm5719-llvm-68449acea428a3c76a3d1e3854a171ccf1300253.zip
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> llvm-svn: 160699
Diffstat (limited to 'clang')
-rw-r--r--clang/lib/Lex/PPMacroExpansion.cpp1
-rw-r--r--clang/test/Sema/attr-availability.c6
2 files changed, 7 insertions, 0 deletions
diff --git a/clang/lib/Lex/PPMacroExpansion.cpp b/clang/lib/Lex/PPMacroExpansion.cpp
index c9d400fc661..3a7f02cafbf 100644
--- a/clang/lib/Lex/PPMacroExpansion.cpp
+++ b/clang/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/clang/test/Sema/attr-availability.c b/clang/test/Sema/attr-availability.c
index a13e351a6e9..b4a6f9616df 100644
--- a/clang/test/Sema/attr-availability.c
+++ b/clang/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
OpenPOWER on IntegriCloud