]> granicus.if.org Git - clang/commitdiff
Augment __has_feature to report that Clang supports adding attribute 'unused'
authorTed Kremenek <kremenek@apple.com>
Fri, 5 Mar 2010 22:43:32 +0000 (22:43 +0000)
committerTed Kremenek <kremenek@apple.com>
Fri, 5 Mar 2010 22:43:32 +0000 (22:43 +0000)
to an Objective-C instance variable.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97850 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Lex/PPMacroExpansion.cpp
test/SemaObjC/unused.m

index d60cf0804f536563846bc104b33d4f5a465533d2..5fe2ef172e2f12957c810b538d0e485b314c204d 100644 (file)
@@ -505,6 +505,7 @@ static bool HasFeature(const Preprocessor &PP, const IdentifierInfo *II) {
            .Case("attribute_cf_returns_retained", true)
            .Case("attribute_ns_returns_not_retained", true)
            .Case("attribute_ns_returns_retained", true)
+           .Case("attribute_objc_ivar_unused", true)
            .Default(false);
 }
 
index e99418875ae219f6cd99feade077a22004fcc3dd..a33a1bc02f9dfeac6baf89f0b0b9868f1b163d07 100644 (file)
@@ -39,7 +39,15 @@ void test2() {
 // instance variables, which GCC does not.
 //===------------------------------------------------------------------------===
 
+#if __has_feature(attribute_objc_ivar_unused)
+#define UNUSED_IVAR __attribute__((unused))
+#else
+#error __attribute__((unused)) not supported on ivars
+#endif
+
 @interface TestUnusedIvar {
-  id x __attribute__((unused)); // no-warning
+  id y __attribute__((unused)); // no-warning
+  id x UNUSED_IVAR; // no-warning
 }
 @end
+