diff options
| author | Chris Lattner <sabre@nondot.org> | 2007-06-27 05:58:33 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2007-06-27 05:58:33 +0000 |
| commit | c4c8e2546ba96d7898830716f5f71fd4014b818f (patch) | |
| tree | ba5e186ccb74039d2ad5b40216e8adc1753268ae /clang/test/Sema/unused-expr.c | |
| parent | 1ec5f563c7297352e0ba64730bae6c3453e7c7ca (diff) | |
| download | bcm5719-llvm-c4c8e2546ba96d7898830716f5f71fd4014b818f.tar.gz bcm5719-llvm-c4c8e2546ba96d7898830716f5f71fd4014b818f.zip | |
New testcase for unused expression analysis
llvm-svn: 39683
Diffstat (limited to 'clang/test/Sema/unused-expr.c')
| -rw-r--r-- | clang/test/Sema/unused-expr.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/clang/test/Sema/unused-expr.c b/clang/test/Sema/unused-expr.c new file mode 100644 index 00000000000..667f286f510 --- /dev/null +++ b/clang/test/Sema/unused-expr.c @@ -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; +} + |

