Richard Smith | 6d69fec | 2019-03-21 20:42:13 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -verify %s -E -o /dev/null -I%S/Inputs/include-next-1 -I%S/Inputs/include-next-2 -DTEST=1 |
| 2 | // RUN: %clang_cc1 -verify %s -E -o /dev/null -I%S/Inputs/include-next-1 -I%S/Inputs/include-next-2 -DTEST=2 |
| 3 | // RUN: %clang_cc1 -verify %s -E -o /dev/null -I%S/Inputs/include-next-1 -I%S/Inputs/include-next-2 -DTEST=3 |
| 4 | |
| 5 | #if TEST == 1 |
| 6 | // expected-warning@+1 {{#include_next in primary source file}} |
| 7 | #include_next "bar.h" |
| 8 | #if BAR != 1 |
| 9 | #error wrong bar |
| 10 | #endif |
| 11 | |
| 12 | #elif TEST == 2 |
| 13 | // expected-no-diagnostics |
| 14 | #include "foo.h" |
| 15 | #if BAR != 2 |
| 16 | #error wrong bar |
| 17 | #endif |
| 18 | |
| 19 | #elif TEST == 3 |
| 20 | // expected-warning@foo.h:1 {{#include_next in file found relative to primary source file or found by absolute path}} |
| 21 | #include "Inputs/include-next-1/foo.h" |
| 22 | #if BAR != 1 |
| 23 | #error wrong bar |
| 24 | #endif |
| 25 | #undef BAR |
| 26 | |
| 27 | #else |
| 28 | #error unknown test |
| 29 | #endif |