Argyrios Kyrtzidis | 150dcba | 2016-07-13 22:03:47 +0000 | [diff] [blame] | 1 | // RUN: env CINDEXTEST_EDITING=1 c-index-test -test-load-source local %s -Wuninitialized -Werror=unused 2>&1 | FileCheck -check-prefix=DIAGS %s |
Argyrios Kyrtzidis | 70ec1c7 | 2016-07-13 20:35:26 +0000 | [diff] [blame] | 2 | |
| 3 | // Make sure -Wuninitialized works even though the header had a warn-as-error occurrence. |
| 4 | |
| 5 | // DIAGS: error: unused variable 'x' |
| 6 | // DIAGS: warning: variable 'x1' is uninitialized |
| 7 | // DIAGS-NOT: error: use of undeclared identifier |
| 8 | // DIAGS: warning: variable 'x1' is uninitialized |
| 9 | |
| 10 | #include "pch-warn-as-error-code-split.h" |
| 11 | |
| 12 | void test() { |
| 13 | int x1; // expected-note {{initialize}} |
| 14 | int x2 = x1; // expected-warning {{uninitialized}} |
| 15 | (void)x2; |
| 16 | foo_head(); |
| 17 | } |