diff options
author | Ted Kremenek <kremenek@apple.com> | 2011-01-26 04:49:43 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2011-01-26 04:49:43 +0000 |
commit | 33ddd9692d1ef9b6535b0019379d7cc139e7a9dd (patch) | |
tree | 0383e46f90e0e3795ed6596ae260e21c901606c4 /clang/test/Sema/uninit-variables.c | |
parent | ce1de6172cbf7c7bf5cbbb4bbaba4940023a5c2e (diff) | |
download | bcm5719-llvm-33ddd9692d1ef9b6535b0019379d7cc139e7a9dd.tar.gz bcm5719-llvm-33ddd9692d1ef9b6535b0019379d7cc139e7a9dd.zip |
Tweak -Wuninitialized-experimental to not emit
a warning for uses of an uninitialized variable
when the use is a void cast, e.g. (void) x.
llvm-svn: 124278
Diffstat (limited to 'clang/test/Sema/uninit-variables.c')
-rw-r--r-- | clang/test/Sema/uninit-variables.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/clang/test/Sema/uninit-variables.c b/clang/test/Sema/uninit-variables.c index 200fc83b10b..1bcfc8ad640 100644 --- a/clang/test/Sema/uninit-variables.c +++ b/clang/test/Sema/uninit-variables.c @@ -212,3 +212,14 @@ void test32() { (void) ^{ (void) test32_x; }; // no-warning } +void test_33() { + int x; // no-warning + (void) x; +} + +int test_34() { + int x; // expected-warning{{use of uninitialized variable 'x'}} expected-note{{add initialization to silence this warning}} + (void) x; + return x; // expected-note{{variable 'x' is possibly uninitialized when used here}} +} + |