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