150
|
1 // Test -D and -U interaction with a PCH when -fms-extensions is enabled.
|
|
2
|
|
3 // RUN: %clang_cc1 -DFOO %S/variables.h -emit-pch -o %t1.pch
|
|
4
|
|
5 // RUN: not %clang_cc1 -DFOO=blah -DBAR=int -include-pch %t1.pch -pch-through-header=%S/variables.h %s 2> %t.err
|
|
6 // RUN: FileCheck -check-prefix=CHECK-FOO %s < %t.err
|
|
7
|
|
8 // RUN: not %clang_cc1 -UFOO -DBAR=int -include-pch %t1.pch %s -pch-through-header=%S/variables.h 2> %t.err
|
|
9 // RUN: FileCheck -check-prefix=CHECK-NOFOO %s < %t.err
|
|
10
|
|
11 // RUN: %clang_cc1 -include-pch %t1.pch -DBAR=int -pch-through-header=%S/variables.h -verify %s
|
|
12
|
|
13 // Enabling MS extensions should allow us to add BAR definitions.
|
|
14 // RUN: %clang_cc1 -DMSEXT -fms-extensions -DFOO %S/variables.h -emit-pch -o %t1.pch
|
|
15 // RUN: %clang_cc1 -DMSEXT -fms-extensions -include-pch %t1.pch -DBAR=int -pch-through-header=%S/variables.h -verify %s
|
|
16
|
|
17 #include "variables.h"
|
|
18
|
|
19 BAR bar = 17;
|
|
20 #ifndef MSEXT
|
|
21 // expected-error@-2 {{unknown type name 'BAR'}}
|
|
22 #endif
|
|
23
|
|
24 #ifndef FOO
|
|
25 # error FOO was not defined
|
|
26 #endif
|
|
27
|
|
28 #if FOO != 1
|
|
29 # error FOO has the wrong definition
|
|
30 #endif
|
|
31
|
|
32 #if defined(MSEXT) && !defined(BAR)
|
|
33 # error BAR was not defined
|
|
34 #endif
|
|
35
|
|
36 // CHECK-FOO: definition of macro 'FOO' differs between the precompiled header ('1') and the command line ('blah')
|
|
37 // CHECK-NOFOO: macro 'FOO' was defined in the precompiled header but undef'd on the command line
|
|
38
|
252
|
39 // expected-warning@2 {{definition of macro 'BAR' does not match definition in precompiled header}}
|