brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.4 KiB · c34732b Raw
40 lines · c
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.pch4 5// RUN: not %clang_cc1 -DFOO=blah -DBAR=int -include-pch %t1.pch -pch-through-header=%S/variables.h %s 2> %t.err6// RUN: FileCheck -check-prefix=CHECK-FOO %s < %t.err7 8// RUN: not %clang_cc1 -UFOO -DBAR=int -include-pch %t1.pch %s -pch-through-header=%S/variables.h 2> %t.err9// RUN: FileCheck -check-prefix=CHECK-NOFOO %s < %t.err10 11// RUN: %clang_cc1 -include-pch %t1.pch -DBAR=int -pch-through-header=%S/variables.h -verify %s12 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.pch15// RUN: %clang_cc1 -DMSEXT -fms-extensions -include-pch %t1.pch -DBAR=int -pch-through-header=%S/variables.h -verify %s16 17#include "variables.h"18 19BAR bar = 17;20#ifndef MSEXT21// expected-error@-2 {{unknown type name 'BAR'}}22#endif23 24#ifndef FOO25#  error FOO was not defined26#endif27 28#if FOO != 129#  error FOO has the wrong definition30#endif31 32#if defined(MSEXT) && !defined(BAR)33#  error BAR was not defined34#endif35 36// CHECK-FOO: definition of macro 'FOO' differs between the precompiled file '{{.*}}1.pch' ('1') and the command line ('blah')37// CHECK-NOFOO: macro 'FOO' was defined in the precompiled file '{{.*}}1.pch' but undef'd on the command line38 39// expected-warning@2 {{definition of macro 'BAR' does not match definition in precompiled header}}40