diff options
author | Chandler Carruth <chandlerc@gmail.com> | 2011-04-05 21:36:30 +0000 |
---|---|---|
committer | Chandler Carruth <chandlerc@gmail.com> | 2011-04-05 21:36:30 +0000 |
commit | b88fb027bfe2f85da3a341f42549900bd658ac8b (patch) | |
tree | 56e1ab1abc70098b55b9b6660daf53efd78e753a /test/Sema/uninit-variables.c | |
parent | 89054fb972f5f93a6d29a6701f8ad4a5d38030d4 (diff) |
Commit a bit of a hack to fully handle the situation where variables are
marked explicitly as uninitialized through direct self initialization:
int x = x;
With r128894 we prevented warnings about this code, and this patch
teaches the analysis engine to continue analyzing subsequent uses of
'x'. This should wrap up PR9624.
There is still an open question of whether we should suppress the
maybe-uninitialized warnings resulting from variables initialized in
this fashion. The definitely-uninitialized uses should always be warned.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128932 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Sema/uninit-variables.c')
-rw-r--r-- | test/Sema/uninit-variables.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/test/Sema/uninit-variables.c b/test/Sema/uninit-variables.c index ee3e88a49c..f09d44ca44 100644 --- a/test/Sema/uninit-variables.c +++ b/test/Sema/uninit-variables.c @@ -91,8 +91,10 @@ void test14() { for (;;) {} } -void test15() { - int x = x; // no-warning: signals intended lack of initialization. +int test15() { + int x = x; // no-warning: signals intended lack of initialization. \ + // expected-note{{variable 'x' is declared here}} + return x; // expected-warning{{variable 'x' is possibly uninitialized when used here}} } // Don't warn in the following example; shows dataflow confluence. |