1/* { dg-do preprocess } */
2/* { dg-options "-fno-show-column" } */
3
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.  */
7
8#endif /* { dg-error "#endif" "#endif without #if" } */
9
10#else  /* { dg-error "#else" "#else without #if" } */
11#endif /* { dg-error "#endif" "#endif after #else without #if" } */
12
13#elif 0 /* { dg-error "#elif" "#elif without #if" } */
14#endif  /* { dg-error "#endif" "#endif after #else without #if" } */
15
16#if 1  /* { dg-bogus "unterminated" "terminated true conditional" } */
17blah
18#endif
19
20#if 0  /* { dg-bogus "unterminated" "terminated false conditional" } */
21ignored
22#endif
23
24/* We shouldn't see unbalanced conditionals inside #if'ed out #includes.  */
25#if 0
26#include "unc1.c"
27#endif
28
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
37
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 } */
41