From: Zack Weinberg Date: Sat, 4 Sep 1999 02:34:10 +0000 (+0000) Subject: cast-qual-1.c: Add missing dg-bogus tag. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=edf501302358716842d8f5fb99a2849da03d384d;p=gcc.git cast-qual-1.c: Add missing dg-bogus tag. 1999-09-03 19:31 -0700 Zack Weinberg * 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 --- 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