xref: /minix3/external/bsd/llvm/dist/clang/test/PCH/fuzzy-pch.c (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // Test with pch.
2*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -emit-pch -DFOO -o %t %S/variables.h
3*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -DBAR=int -include-pch %t -fsyntax-only -pedantic %s
4*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -DFOO -DBAR=int -include-pch %t %s
5*f4a2713aSLionel Sambuc // RUN: not %clang_cc1 -DFOO=blah -DBAR=int -include-pch %t %s 2> %t.err
6*f4a2713aSLionel Sambuc // RUN: FileCheck -check-prefix=CHECK-FOO %s < %t.err
7*f4a2713aSLionel Sambuc // RUN: not %clang_cc1 -UFOO -include-pch %t %s 2> %t.err
8*f4a2713aSLionel Sambuc // RUN: FileCheck -check-prefix=CHECK-NOFOO %s < %t.err
9*f4a2713aSLionel Sambuc 
10*f4a2713aSLionel Sambuc // RUN: not %clang_cc1 -DFOO -undef -include-pch %t %s 2> %t.err
11*f4a2713aSLionel Sambuc // RUN: FileCheck -check-prefix=CHECK-UNDEF %s < %t.err
12*f4a2713aSLionel Sambuc 
13*f4a2713aSLionel Sambuc BAR bar = 17;
14*f4a2713aSLionel Sambuc 
15*f4a2713aSLionel Sambuc #ifndef FOO
16*f4a2713aSLionel Sambuc #  error FOO was not defined
17*f4a2713aSLionel Sambuc #endif
18*f4a2713aSLionel Sambuc 
19*f4a2713aSLionel Sambuc #if FOO != 1
20*f4a2713aSLionel Sambuc #  error FOO has the wrong definition
21*f4a2713aSLionel Sambuc #endif
22*f4a2713aSLionel Sambuc 
23*f4a2713aSLionel Sambuc #ifndef BAR
24*f4a2713aSLionel Sambuc #  error BAR was not defined
25*f4a2713aSLionel Sambuc #endif
26*f4a2713aSLionel Sambuc 
27*f4a2713aSLionel Sambuc // CHECK-FOO: definition of macro 'FOO' differs between the precompiled header ('1') and the command line ('blah')
28*f4a2713aSLionel Sambuc // CHECK-NOFOO: macro 'FOO' was defined in the precompiled header but undef'd on the command line
29*f4a2713aSLionel Sambuc 
30*f4a2713aSLionel Sambuc // CHECK-UNDEF: command line contains '-undef' but precompiled header was not built with it
31*f4a2713aSLionel Sambuc 
32