1 /* { dg-do preprocess } */
2 
3 /* Tests for un-terminated conditional diagnostics.
4    Copyright (c) 1999 Free Software Foundation.
5    Contributed by Zack Weinberg, who made it up all by himself.  */
6 
7 #endif /* { dg-error "#endif" "#endif without #if" } */
8 
9 #else  /* { dg-error "#else" "#else without #if" } */
10 #endif /* { dg-error "#endif" "#endif after #else without #if" } */
11 
12 #elif 0 /* { dg-error "#elif" "#elif without #if" } */
13 #endif  /* { dg-error "#endif" "#endif after #else without #if" } */
14 
15 #if 1  /* { dg-bogus "unterminated" "terminated true conditional" } */
16 blah
17 #endif
18 
19 #if 0  /* { dg-bogus "unterminated" "terminated false conditional" } */
20 ignored
21 #endif
22 
23 /* We shouldn't see unbalanced conditionals inside #if'ed out #includes.  */
24 #if 0
25 #include "unc1.c"
26 #endif
27 
28 /* The ifdef below should not get an error just because there's a bad if
29    inside the included file.
30    The odd dg-error tag on the include matches the "In file included from"
31    message.  */
32 #define FOO
33 #ifdef FOO  /* { dg-bogus "unterminated" "nested unterm" } */
34 #include "unc1.c"  /* { dg-message "file included from" "" { target *-*-* } 0 } */
35 #endif
36 
37 /* dg.exp doesn't read the included files for tags, so we have to
38    do them explicitly here.  */
39 /* { dg-error "-:#if" "unc1.c: unterminated #if" { target *-*-* } 4 } */
40