summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/cpp/unc4.c
diff options
context:
space:
mode:
authorupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
committerupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
commit554fd8c5195424bdbcabf5de30fdc183aba391bd (patch)
tree976dc5ab7fddf506dadce60ae936f43f58787092 /gcc/testsuite/gcc.dg/cpp/unc4.c
downloadcbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.bz2
cbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.xz
obtained gcc-4.6.4.tar.bz2 from upstream website;upstream
verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository.
Diffstat (limited to 'gcc/testsuite/gcc.dg/cpp/unc4.c')
-rw-r--r--gcc/testsuite/gcc.dg/cpp/unc4.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/cpp/unc4.c b/gcc/testsuite/gcc.dg/cpp/unc4.c
new file mode 100644
index 000000000..10c49e9d4
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/cpp/unc4.c
@@ -0,0 +1,39 @@
+/* { dg-do preprocess } */
+
+/* Tests for un-terminated conditional diagnostics.
+ Copyright (c) 1999 Free Software Foundation.
+ Contributed by Zack Weinberg, who made it up all by himself. */
+
+#endif /* { dg-error "#endif" "#endif without #if" } */
+
+#else /* { dg-error "#else" "#else without #if" } */
+#endif /* { dg-error "#endif" "#endif after #else without #if" } */
+
+#elif 0 /* { dg-error "#elif" "#elif without #if" } */
+#endif /* { dg-error "#endif" "#endif after #else without #if" } */
+
+#if 1 /* { dg-bogus "unterminated" "terminated true conditional" } */
+blah
+#endif
+
+#if 0 /* { dg-bogus "unterminated" "terminated false conditional" } */
+ignored
+#endif
+
+/* We shouldn't see unbalanced conditionals inside #if'ed out #includes. */
+#if 0
+#include "unc1.c"
+#endif
+
+/* The ifdef below should not get an error just because there's a bad if
+ inside the included file.
+ The odd dg-error tag on the include matches the "In file included from"
+ message. */
+#define FOO
+#ifdef FOO /* { dg-bogus "unterminated" "nested unterm" } */
+#include "unc1.c" /* { dg-message "file included from" "" { target *-*-* } 0 } */
+#endif
+
+/* dg.exp doesn't read the included files for tags, so we have to
+ do them explicitly here. */
+/* { dg-error "#if" "unc1.c: unterminated #if" { target *-*-* } 4 } */