[cfe-commits] r41452 - in /cfe/trunk: Sema/SemaStmt.cpp test/Sema/unused-expr.c
Chris Lattner
sabre at nondot.org
Sun Aug 26 10:32:59 PDT 2007
Author: lattner
Date: Sun Aug 26 12:32:59 2007
New Revision: 41452
URL: http://llvm.org/viewvc/llvm-project?rev=41452&view=rev
Log:
Fix a bug reported by Keith Bauer
Modified:
cfe/trunk/Sema/SemaStmt.cpp
cfe/trunk/test/Sema/unused-expr.c
Modified: cfe/trunk/Sema/SemaStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Sema/SemaStmt.cpp?rev=41452&r1=41451&r2=41452&view=diff
==============================================================================
--- cfe/trunk/Sema/SemaStmt.cpp (original)
+++ cfe/trunk/Sema/SemaStmt.cpp Sun Aug 26 12:32:59 2007
@@ -27,7 +27,7 @@
// Exprs are statements, so there is no need to do a conversion here. However,
// diagnose some potentially bad code.
- if (!E->hasLocalSideEffect())
+ if (!E->hasLocalSideEffect() && !E->getType()->isVoidType())
Diag(E->getExprLoc(), diag::warn_unused_expr, E->getSourceRange());
return E;
Modified: cfe/trunk/test/Sema/unused-expr.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/unused-expr.c?rev=41452&r1=41451&r2=41452&view=diff
==============================================================================
--- cfe/trunk/test/Sema/unused-expr.c (original)
+++ cfe/trunk/test/Sema/unused-expr.c Sun Aug 26 12:32:59 2007
@@ -7,7 +7,7 @@
VP == P; // expected-warning {{expression result unused}} \
expected-warning {{comparison}}
- (void)A; // expected-warning {{expression result unused}}
+ (void)A;
(void)foo(1,2); // no warning.
A == foo(1, 2); // expected-warning {{expression result unused}}
@@ -25,3 +25,9 @@
//__real__ VC;
}
+extern void t1();
+extern void t2();
+void t3(int c) {
+ c ? t1() : t2();
+}
+
More information about the cfe-commits
mailing list