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 | dd0f7942c5415ce146dcc02d57fc503c683f8625 (patch) | |
tree | 571860328952024282c4cb148648176b634d87a9 /test/Sema/uninit-variables.c | |
parent | 150b462afc7a713edd19bcbbbb22381fe060d4f5 (diff) |
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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124278 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Sema/uninit-variables.c')
-rw-r--r-- | test/Sema/uninit-variables.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/test/Sema/uninit-variables.c b/test/Sema/uninit-variables.c index 200fc83b10..1bcfc8ad64 100644 --- a/test/Sema/uninit-variables.c +++ b/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}} +} + |