[cfe-commits] r39683 - /cfe/cfe/trunk/test/Sema/unused-expr.c
clattner at cs.uiuc.edu
clattner at cs.uiuc.edu
Wed Jul 11 09:47:07 PDT 2007
Author: clattner
Date: Wed Jul 11 11:47:07 2007
New Revision: 39683
URL: http://llvm.org/viewvc/llvm-project?rev=39683&view=rev
Log:
New testcase for unused expression analysis
Added:
cfe/cfe/trunk/test/Sema/unused-expr.c (with props)
Added: cfe/cfe/trunk/test/Sema/unused-expr.c
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/test/Sema/unused-expr.c?rev=39683&view=auto
==============================================================================
--- cfe/cfe/trunk/test/Sema/unused-expr.c (added)
+++ cfe/cfe/trunk/test/Sema/unused-expr.c Wed Jul 11 11:47:07 2007
@@ -0,0 +1,26 @@
+// RUN: clang -parse-ast-check %s
+
+int foo(int X, int Y);
+
+void bar(volatile int *VP, int *P, int A,
+ _Complex double C, volatile _Complex double VC) {
+
+ VP == P; // expected-warning {{expression result unused}}
+ (void)A; // expected-warning {{expression result unused}}
+ (void)foo(1,2); // no warning.
+
+ A == foo(1, 2); // expected-warning {{expression result unused}}
+
+ foo(1,2)+foo(4,3); // expected-warning {{expression result unused}}
+
+
+ *P; // expected-warning {{expression result unused}}
+ *VP; // no warning.
+ P[4]; // expected-warning {{expression result unused}}
+ VP[4]; // no warning.
+
+ // FIXME: SEMA explodes on these.
+ //__real__ C;
+ //__real__ VC;
+}
+
Propchange: cfe/cfe/trunk/test/Sema/unused-expr.c
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cfe/cfe/trunk/test/Sema/unused-expr.c
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
More information about the cfe-commits
mailing list