| 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 |
|
| 7 |
#ifndef HEADER1 |
| 8 |
#define HEADER1 |
| 9 |
|
| 10 |
#define M1 0 // expected-note {{previous}} |
| 11 |
#define M1 1 // expected-warning {{redefined}} |
| 12 |
|
| 13 |
#define M2 3 |
| 14 |
|
| 15 |
#elif !defined(HEADER2) |
| 16 |
#define HEADER2 |
| 17 |
|
| 18 |
#define M2 4 // expected-warning {{redefined}} |
| 19 |
// expected-note@-6 {{previous}} |
| 20 |
|
| 21 |
#else |
| 22 |
|
| 23 |
// Use the error to verify it was parsed. |
| 24 |
int x = M1; // expected-note {{previous}} |
| 25 |
int x = M2; // expected-error {{redefinition}} |
| 26 |
|
| 27 |
#endif |