macro-redef.c revision 7f69b1ab4f63ded511dddd7fb7e1cd8860757016
1// RUN: %clang_cc1 %s -emit-pch -o %t1.pch -verify 2// RUN: %clang_cc1 %s -emit-pch -o %t2.pch -include-pch %t1.pch -verify 3// RUN: %clang_cc1 -fsyntax-only %s -include-pch %t2.pch -verify 4 5// Test that a redefinition inside the PCH won't manifest as an ambiguous macro. 6// rdar://13016031 7 8#ifndef HEADER1 9#define HEADER1 10 11#define M1 0 // expected-note {{previous}} 12#define M1 1 // expected-warning {{redefined}} 13 14#define M2 3 15 16#elif !defined(HEADER2) 17#define HEADER2 18 19#define M2 4 // expected-warning {{redefined}} 20 // expected-note@-6 {{previous}} 21 22#else 23 24// Use the error to verify it was parsed. 25int x = M1; // expected-note {{previous}} 26int x = M2; // expected-error {{redefinition}} 27 28#endif 29