| 1 |
/* Test "ignore redundant include" facility. |
| 2 |
|
| 3 |
We must test with C comments, and null directives, outside |
| 4 |
the guard conditional; also, we test guarding with #ifndef and #if |
| 5 |
!defined. -H is used because cpp might confuse the issue by |
| 6 |
optimizing out #line markers. This test only passes if each of the |
| 7 |
headers is read exactly once. |
| 8 |
|
| 9 |
The disgusting regexp in the dg-error line, when stuck into |
| 10 |
dg.exp's compiler-output regexp, matches the correct -H output and |
| 11 |
only the correct -H output. It has to be all on one line because |
| 12 |
otherwise it will not be interpreted all in one unit. */ |
| 13 |
|
| 14 |
/* { dg-do compile } |
| 15 |
{ dg-options "-H -traditional-cpp" } |
| 16 |
{ dg-message "mi1c\.h\n\[^\n\]*mi1nd\.h\n\[^\n\]*mi1ndp\.h\n\[^\n\]*mi1x\.h" "redundant include check" { target *-*-* } 0 } */ |
| 17 |
|
| 18 |
#include "mi1c.h" |
| 19 |
#include "mi1c.h" |
| 20 |
#include "mi1c.h" |
| 21 |
|
| 22 |
#include "mi1nd.h" |
| 23 |
#include "mi1nd.h" |
| 24 |
|
| 25 |
#include "mi1ndp.h" |
| 26 |
#include "mi1ndp.h" |
| 27 |
|
| 28 |
#define MIX_H |
| 29 |
#include "mi1x.h" |
| 30 |
#include "mi1x.h" |
| 31 |
|
| 32 |
int |
| 33 |
main (void) |
| 34 |
{ |
| 35 |
return a + c + d; |
| 36 |
} |