1 /* Test "ignore redundant include" facility. 2 3 We must test with C and 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" } 16 { dg-error "mi1c\.h\n\[^\n\]*mi1cc\.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 "mi1cc.h" 23 #include "mi1cc.h" 24 25 #include "mi1nd.h" 26 #include "mi1nd.h" 27 28 #include "mi1ndp.h" 29 #include "mi1ndp.h" 30 31 #define MIX_H 32 #include "mi1x.h" 33 #include "mi1x.h" 34 35 int 36 main (void) 37 { 38 return a + b + c + d; 39 } 40