summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzack <zack@138bc75d-0d04-0410-961f-82ee72b054a4>1999-09-04 02:34:10 +0000
committerzack <zack@138bc75d-0d04-0410-961f-82ee72b054a4>1999-09-04 02:34:10 +0000
commit4dcec6fe0599a3c551c231aa8a3d51b42d0da3a3 (patch)
tree326bceebef801f4cd6d4a1156ea4dc1fa7755572
parent54c2eebaed8d913f97a94dbffc267abfe0ca2152 (diff)
downloadgcc-4dcec6fe0599a3c551c231aa8a3d51b42d0da3a3.tar.gz
1999-09-03 19:31 -0700 Zack Weinberg <zack@bitmover.com>
* gcc.dg/cast-qual-1.c: Add missing dg-bogus tag. * gcc.dg/compare1.c: Fix typo. * gcc-dg/cpp-unc.c, cpp-unc1.c, cpp-unc2.c, cpp-unc3.c: New files which test the preprocessor's unterminated conditional diagnostics. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@29097 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/testsuite/gcc.dg/cast-qual-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/compare1.c2
-rw-r--r--gcc/testsuite/gcc.dg/cpp-unc.c39
-rw-r--r--gcc/testsuite/gcc.dg/cpp-unc1.c13
-rw-r--r--gcc/testsuite/gcc.dg/cpp-unc2.c11
-rw-r--r--gcc/testsuite/gcc.dg/cpp-unc3.c4
6 files changed, 69 insertions, 2 deletions
diff --git a/gcc/testsuite/gcc.dg/cast-qual-1.c b/gcc/testsuite/gcc.dg/cast-qual-1.c
index a7a34700bd5..464fd45119d 100644
--- a/gcc/testsuite/gcc.dg/cast-qual-1.c
+++ b/gcc/testsuite/gcc.dg/cast-qual-1.c
@@ -20,7 +20,7 @@ bad_cast(const void *bar)
void
good_assign(const void *bar)
{
- char *const *foo = bar;
+ char *const *foo = bar; /* { dg-bogus "initialization discards" "discarding `const' warning" } */
}
void
diff --git a/gcc/testsuite/gcc.dg/compare1.c b/gcc/testsuite/gcc.dg/compare1.c
index bba5f1d1dce..3be9d95baf0 100644
--- a/gcc/testsuite/gcc.dg/compare1.c
+++ b/gcc/testsuite/gcc.dg/compare1.c
@@ -22,5 +22,5 @@ int main()
{
enum machine_mode mode = DImode;
- return (mode == Pmode); /* dg-bogus "warning:" "comparison between signed and unsigned" } */
+ return (mode == Pmode); /* { dg-bogus "warning:" "comparison between signed and unsigned" } */
}
diff --git a/gcc/testsuite/gcc.dg/cpp-unc.c b/gcc/testsuite/gcc.dg/cpp-unc.c
new file mode 100644
index 00000000000..4daddf65e64
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/cpp-unc.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 "cpp-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 "cpp-unc1.c" /* { dg-error "" } */
+#endif
+
+/* dg.exp doesn't read the included files for tags, so we have to
+ do them explicitly here. */
+/* { dg-error "#if" "unc1.h: unterminated #if" { target native } 3 } */
diff --git a/gcc/testsuite/gcc.dg/cpp-unc1.c b/gcc/testsuite/gcc.dg/cpp-unc1.c
new file mode 100644
index 00000000000..5059ae66760
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/cpp-unc1.c
@@ -0,0 +1,13 @@
+/* Tests for un-terminated conditionals: 1. */
+
+#if 1 /* { dg-error "unterminated" "unterminated #if" } */
+
+#ifdef notdef /* { dg-bogus "unterminated" "nested terminated #ifdef" } */
+
+blah blah blah
+
+#endif
+
+more text
+
+/* oops! */
diff --git a/gcc/testsuite/gcc.dg/cpp-unc2.c b/gcc/testsuite/gcc.dg/cpp-unc2.c
new file mode 100644
index 00000000000..d9e39591570
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/cpp-unc2.c
@@ -0,0 +1,11 @@
+/* Tests for unterminated conditionals: 2. */
+
+#ifdef __sparc__ /* { dg-error "unterminated" "unterminated if-elif-elif..." } */
+sparc
+#elif defined __powerpc__
+ppc
+#elif defined __i386__
+i386
+#elif defined __vax__
+vax
+
diff --git a/gcc/testsuite/gcc.dg/cpp-unc3.c b/gcc/testsuite/gcc.dg/cpp-unc3.c
new file mode 100644
index 00000000000..9a16bb31155
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/cpp-unc3.c
@@ -0,0 +1,4 @@
+/* Tests for unterminated conditionals: 3. */
+
+#if 1 /* { dg-error "#else" "unterminated #else" } */
+#else