[cfe-commits] r112045 - in /cfe/trunk: lib/Sema/SemaExpr.cpp test/Sema/warn-unused-function.c
Argyrios Kyrtzidis
akyrtzi at gmail.com
Wed Aug 25 03:34:54 PDT 2010
Author: akirtzidis
Date: Wed Aug 25 05:34:54 2010
New Revision: 112045
URL: http://llvm.org/viewvc/llvm-project?rev=112045&view=rev
Log:
Recursive functions should be marked when used from another function. Fixes http://llvm.org/PR7923.
Modified:
cfe/trunk/lib/Sema/SemaExpr.cpp
cfe/trunk/test/Sema/warn-unused-function.c
Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=112045&r1=112044&r2=112045&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Wed Aug 25 05:34:54 2010
@@ -7683,7 +7683,10 @@
}
// FIXME: keep track of references to static functions
- Function->setUsed(true);
+
+ // Recursive functions should be marked when used from another function.
+ if (CurContext != Function)
+ Function->setUsed(true);
return;
}
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=112045&r1=112044&r2=112045&view=diff
==============================================================================
--- cfe/trunk/test/Sema/warn-unused-function.c (original)
+++ cfe/trunk/test/Sema/warn-unused-function.c Wed Aug 25 05:34:54 2010
@@ -44,3 +44,6 @@
static void f12(void) { } // expected-warning{{unused}}
static void f12(void);
+
+// PR7923
+static void unused(void) { unused(); } // expected-warning{{unused}}
More information about the cfe-commits
mailing list