diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2012-12-02 13:20:44 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2012-12-02 13:20:44 +0000 |
| commit | 13cc256e404620c1de0cbcc4e43ce1e2dbbc4898 (patch) | |
| tree | 2732d02d7d51218d6eed98ac7fcfc5b8794896b5 /test/Sema/uninit-variables.c | |
| parent | 657bc3d9848e3be92029b2416031340988cd0111 (diff) | |
Diffstat (limited to 'test/Sema/uninit-variables.c')
| -rw-r--r-- | test/Sema/uninit-variables.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/test/Sema/uninit-variables.c b/test/Sema/uninit-variables.c index 634ae0dc4284..9e3dd9d2875b 100644 --- a/test/Sema/uninit-variables.c +++ b/test/Sema/uninit-variables.c @@ -508,3 +508,26 @@ int self_init_in_cond(int *p) { int n = ((p && (0 || 1)) && (n = *p)) ? n : -1; // ok return n; } + +void test_analyzer_noreturn_aux() __attribute__((analyzer_noreturn)); + +void test_analyzer_noreturn(int y) { + int x; // expected-note {{initialize the variable 'x' to silence this warning}} + if (y) { + test_analyzer_noreturn_aux(); + ++x; // no-warning + } + else { + ++x; // expected-warning {{variable 'x' is uninitialized when used here}} + } +} +void test_analyzer_noreturn_2(int y) { + int x; + if (y) { + test_analyzer_noreturn_aux(); + } + else { + x = 1; + } + ++x; // no-warning +} |
