From: Ted Kremenek Date: Thu, 7 Aug 2008 01:02:05 +0000 (+0000) Subject: attribute "unused" also applies to functions. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=356b63a6668d8b010b53921941576189ee4bd459;p=clang attribute "unused" also applies to functions. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54440 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Sema/SemaDeclAttr.cpp b/lib/Sema/SemaDeclAttr.cpp index 3f9da3bebe..54f6579e36 100644 --- a/lib/Sema/SemaDeclAttr.cpp +++ b/lib/Sema/SemaDeclAttr.cpp @@ -346,11 +346,9 @@ static void HandleUnusedAttr(Decl *d, const AttributeList &Attr, Sema &S) { return; } - VarDecl *VD = dyn_cast(d); - - if (!VD) { + if (!isa(d) && !getFunctionProto(d)) { S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type, - "unused", "variable"); + "unused", "variable and function"); return; }