diff options
author | Zack Weinberg <zack@gcc.gnu.org> | 1999-09-04 02:34:10 +0000 |
---|---|---|
committer | Zack Weinberg <zack@gcc.gnu.org> | 1999-09-04 02:34:10 +0000 |
commit | edf501302358716842d8f5fb99a2849da03d384d (patch) | |
tree | 326bceebef801f4cd6d4a1156ea4dc1fa7755572 | |
parent | 99dccabc3ce6ab4859abe72c0fce799b3a6be995 (diff) | |
download | gcc-edf501302358716842d8f5fb99a2849da03d384d.zip gcc-edf501302358716842d8f5fb99a2849da03d384d.tar.gz gcc-edf501302358716842d8f5fb99a2849da03d384d.tar.bz2 |
cast-qual-1.c: Add missing dg-bogus tag.
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.
From-SVN: r29097
-rw-r--r-- | gcc/testsuite/gcc.dg/cast-qual-1.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/compare1.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/cpp-unc.c | 39 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/cpp-unc1.c | 13 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/cpp-unc2.c | 11 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/cpp-unc3.c | 4 |
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 a7a3470..464fd45 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 bba5f1d..3be9d95 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 0000000..4daddf6 --- /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 0000000..5059ae6 --- /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 0000000..d9e3959 --- /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 0000000..9a16bb3 --- /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 |