[cfe-commits] r96452 - in /cfe/trunk: lib/Sema/SemaDecl.cpp test/Sema/warn-unused-function.c
Tanya Lattner
tonic at nondot.org
Tue Feb 16 20:48:04 PST 2010
Author: tbrethou
Date: Tue Feb 16 22:48:01 2010
New Revision: 96452
URL: http://llvm.org/viewvc/llvm-project?rev=96452&view=rev
Log:
Do not add functions marked with the unused attribute to the list of unused functions to warn about. Update test case.
Modified:
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/test/Sema/warn-unused-function.c
Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=96452&r1=96451&r2=96452&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Tue Feb 16 22:48:01 2010
@@ -3135,7 +3135,7 @@
// FIXME: Also include static functions declared but not defined.
if (!NewFD->isInvalidDecl() && IsFunctionDefinition
&& !NewFD->isInlined() && NewFD->getLinkage() == InternalLinkage
- && !NewFD->isUsed())
+ && !NewFD->isUsed() && !NewFD->hasAttr<UnusedAttr>())
UnusedStaticFuncs.push_back(NewFD);
return NewFD;
Modified: cfe/trunk/test/Sema/warn-unused-function.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/warn-unused-function.c?rev=96452&r1=96451&r2=96452&view=diff
==============================================================================
--- cfe/trunk/test/Sema/warn-unused-function.c (original)
+++ cfe/trunk/test/Sema/warn-unused-function.c Tue Feb 16 22:48:01 2010
@@ -24,3 +24,7 @@
void f8(void(*a0)(void));
void f9(void) { f8(f7); }
static void f7(void) {}
+
+__attribute__((unused)) static void bar(void);
+void bar(void) { }
+
More information about the cfe-commits
mailing list