]> granicus.if.org Git - clang/commitdiff
attribute "unused" also applies to functions.
authorTed Kremenek <kremenek@apple.com>
Thu, 7 Aug 2008 01:02:05 +0000 (01:02 +0000)
committerTed Kremenek <kremenek@apple.com>
Thu, 7 Aug 2008 01:02:05 +0000 (01:02 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54440 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaDeclAttr.cpp

index 3f9da3bebe0ceb782f2205047497dff1388ffe89..54f6579e36c0c47a58ac77d778f19edb8600c271 100644 (file)
@@ -346,11 +346,9 @@ static void HandleUnusedAttr(Decl *d, const AttributeList &Attr, Sema &S) {
     return;
   }
   
-  VarDecl *VD = dyn_cast<VarDecl>(d);
-  
-  if (!VD) {
+  if (!isa<VarDecl>(d) && !getFunctionProto(d)) {
     S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type,
-           "unused", "variable");
+           "unused", "variable and function");
     return;
   }