1*67e74705SXin Li // RUN: rm -f %t.head.h.pch 2*67e74705SXin Li // RUN: c-index-test -write-pch %t.head.h.pch %s -Wuninitialized -Werror=unused 2>&1 | FileCheck -check-prefix=HEAD_DIAGS %s 3*67e74705SXin Li // RUN: c-index-test -test-load-source local %s -include %t.head.h -Wuninitialized -Werror=unused 2>&1 | FileCheck -check-prefix=MAIN_DIAGS %s 4*67e74705SXin Li 5*67e74705SXin Li // Make sure -Wuninitialized works even though the header had a warn-as-error occurrence. 6*67e74705SXin Li 7*67e74705SXin Li // HEAD_DIAGS: error: unused variable 'x' 8*67e74705SXin Li // MAIN_DIAGS: warning: variable 'x1' is uninitialized 9*67e74705SXin Li // MAIN_DIAGS-NOT: error: use of undeclared identifier 10*67e74705SXin Li 11*67e74705SXin Li #ifndef HEADER 12*67e74705SXin Li #define HEADER 13*67e74705SXin Li foo_head()14*67e74705SXin Listatic void foo_head() { 15*67e74705SXin Li int x; 16*67e74705SXin Li } 17*67e74705SXin Li 18*67e74705SXin Li #else 19*67e74705SXin Li test()20*67e74705SXin Livoid test() { 21*67e74705SXin Li int x1; // expected-note {{initialize}} 22*67e74705SXin Li int x2 = x1; // expected-warning {{uninitialized}} 23*67e74705SXin Li (void)x2; 24*67e74705SXin Li foo_head(); 25*67e74705SXin Li } 26*67e74705SXin Li 27*67e74705SXin Li #endif 28