brintos

brintos / llvm-project-archived public Read only

0
0
Text · 761 B · 6a7924a Raw
28 lines · cpp
1// RUN: rm -f %t.head.h.pch2// RUN: c-index-test -write-pch %t.head.h.pch %s -Wuninitialized -Werror=unused 2>&1 | FileCheck -check-prefix=HEAD_DIAGS %s3// RUN: c-index-test -test-load-source local %s -include %t.head.h -Wuninitialized -Werror=unused 2>&1 | FileCheck -check-prefix=MAIN_DIAGS %s4 5// Make sure -Wuninitialized works even though the header had a warn-as-error occurrence.6 7// HEAD_DIAGS: error: unused variable 'x'8// MAIN_DIAGS: warning: variable 'x1' is uninitialized9// MAIN_DIAGS-NOT: error: use of undeclared identifier10 11#ifndef HEADER12#define HEADER13 14static void foo_head() {15  int x;16}17 18#else19 20void test() {21  int x1; // expected-note {{initialize}}22  int x2 = x1; // expected-warning {{uninitialized}}23  (void)x2;24  foo_head();25}26 27#endif28