More warnings for unused expressions.
authorAnders Carlsson <andersca@mac.com>
Sat, 1 Aug 2009 01:39:59 +0000 (01:39 +0000)
committerAnders Carlsson <andersca@mac.com>
Sat, 1 Aug 2009 01:39:59 +0000 (01:39 +0000)
llvm-svn: 77763

clang/lib/Sema/SemaStmt.cpp
clang/test/Sema/unused-expr.c

index f00d600..65611f2 100644 (file)
@@ -649,6 +649,8 @@ Sema::ActOnForStmt(SourceLocation ForLoc, SourceLocation LParenLoc,
         << SecondType << Second->getSourceRange());
   }
   
+  DiagnoseUnusedExprResult(First);
+  DiagnoseUnusedExprResult(Third);
   DiagnoseUnusedExprResult(Body);
 
   first.release();
index c55afea..8b5d156 100644 (file)
@@ -67,6 +67,10 @@ void t4(int a) {
   
   for (;;)
     b == 5; // expected-warning{{expression result unused}}
+    
+  for (b == 1;;) {} // expected-warning{{expression result unused}}
+  for (;b == 1;) {}
+  for (;;b == 1) {} // expected-warning{{expression result unused}}
 }