32 lines · c
1// Test with pch.2// RUN: %clang_cc1 -emit-pch -DFOO -o %t %S/variables.h3// RUN: %clang_cc1 -DBAR=int -include-pch %t -fsyntax-only -pedantic %s4// RUN: %clang_cc1 -DFOO -DBAR=int -include-pch %t %s5// RUN: not %clang_cc1 -DFOO=blah -DBAR=int -include-pch %t %s 2> %t.err6// RUN: FileCheck -check-prefix=CHECK-FOO %s < %t.err7// RUN: not %clang_cc1 -UFOO -include-pch %t %s 2> %t.err8// RUN: FileCheck -check-prefix=CHECK-NOFOO %s < %t.err9 10// RUN: not %clang_cc1 -DFOO -undef -include-pch %t %s 2> %t.err11// RUN: FileCheck -check-prefix=CHECK-UNDEF %s < %t.err12 13BAR bar = 17;14 15#ifndef FOO16# error FOO was not defined17#endif18 19#if FOO != 120# error FOO has the wrong definition21#endif22 23#ifndef BAR24# error BAR was not defined25#endif26 27// CHECK-FOO: definition of macro 'FOO' differs between the precompiled file '{{.*}}' ('1') and the command line ('blah')28// CHECK-NOFOO: macro 'FOO' was defined in the precompiled file '{{.*}}' but undef'd on the command line29 30// CHECK-UNDEF: command line contains '-undef' but precompiled file '{{.*}}' was not built with it31 32