From: Neil Booth Date: Sat, 9 Dec 2000 12:07:56 +0000 (+0000) Subject: lineflags.c: New tests. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=976654912051f4b6680973c01da45c3697645f24;p=gcc.git lineflags.c: New tests. * gcc.dg/cpp/lineflags.c: New tests. * gcc.dg/cpp/poison.c: Update. * gcc.dg/cpp/redef2.c: Update. * gcc.dg/cpp/skipping.c: New test. From-SVN: r38151 --- diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 0c5aca0db2e..5282938e4af 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2000-12-09 Neil Booth + + * gcc.dg/cpp/lineflags.c: New tests. + * gcc.dg/cpp/poison.c: Update. + * gcc.dg/cpp/redef2.c: Update. + * gcc.dg/cpp/skipping.c: New test. + 2000-12-07 Geoffrey Keating * g++.old-deja/g++.other/eh3.C: New testcase. diff --git a/gcc/testsuite/gcc.dg/cpp/lineflags.c b/gcc/testsuite/gcc.dg/cpp/lineflags.c new file mode 100644 index 00000000000..ff112916cc8 --- /dev/null +++ b/gcc/testsuite/gcc.dg/cpp/lineflags.c @@ -0,0 +1,35 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. */ + +/* { dg-do preprocess } */ +/* { dg-options "-fno-show-column" } */ + +/* This tests whether various combinations of flags are correctly + accepted after #line. + + Neil Booth, 8 Dec 2000. */ + +#line 12 "file" 3 /* { dg-warning "extra tokens" } */ + +# 14 "file" 1 1 /* { dg-error "invalid flag" } */ +# 15 "file" 1 2 /* { dg-error "invalid flag" } */ +# 16 "file" 1 3 3 /* { dg-error "invalid flag" } */ +# 17 "file" 1 4 /* { dg-error "invalid flag" } */ +# 18 "file" 2 3 4 4 /* { dg-error "invalid flag" } */ +# 19 "file" 2 4 /* { dg-error "invalid flag" } */ +# 20 "file" 2 2 /* { dg-error "invalid flag" } */ +# 21 "file" 2 1 /* { dg-error "invalid flag" } */ +# 22 "file" 4 /* { dg-error "invalid flag" } */ +# 23 "file" 4 5 /* { dg-error "invalid flag" } */ +# 24 "file" 0 /* { dg-error "invalid flag" } */ +# 25 "file" 5 /* { dg-error "invalid flag" } */ +# 26 "file" foo /* { dg-error "invalid flag" } */ + + +# 29 "file" 1 /* { dg-bogus "invalid flag" } */ +# 30 "file" 2 /* { dg-bogus "invalid flag" } */ +# 31 "file" 1 3 /* { dg-bogus "invalid flag" } */ +# 32 "file" 2 3 /* { dg-bogus "invalid flag" } */ +# 33 "file" 1 3 4 /* { dg-bogus "invalid flag" } */ +# 34 "file" 2 3 4 /* { dg-bogus "invalid flag" } */ +# 35 "file" 3 /* { dg-bogus "invalid flag" } */ +# 36 "file" 3 4 /* { dg-bogus "invalid flag" } */ diff --git a/gcc/testsuite/gcc.dg/cpp/poison.c b/gcc/testsuite/gcc.dg/cpp/poison.c index 3670a76fa89..fd3f5368eb4 100644 --- a/gcc/testsuite/gcc.dg/cpp/poison.c +++ b/gcc/testsuite/gcc.dg/cpp/poison.c @@ -15,10 +15,10 @@ foo5 /* { dg-error "foo5" "use of foo5" } */ #define foo6 345 /* { dg-error "foo6" "def of foo6" } */ #define foo6 456 /* { dg-error "foo6" "redef of foo6" } */ #ifdef foo6 /* { dg-error "foo6" "#ifdef foo6" } */ -#error hey! foo6 poisoned! /* { dg-error "foo6" "poisoned identifiers" } */ +#error hey! foo6 defined! #endif #if defined(foo6) /* { dg-error "foo6" "#if defined foo6" } */ -#error foo6 still poisoned! /* { dg-error "foo6" "poisoned identifiers" } */ +#error foo6 still defined! #else foo6 /* { dg-error "foo6" "use of foo6" } */ #endif diff --git a/gcc/testsuite/gcc.dg/cpp/redef2.c b/gcc/testsuite/gcc.dg/cpp/redef2.c index 5838c47506e..1656ab80054 100644 --- a/gcc/testsuite/gcc.dg/cpp/redef2.c +++ b/gcc/testsuite/gcc.dg/cpp/redef2.c @@ -26,5 +26,5 @@ { dg-warning "previous" "prev def ro" { target *-*-* } 11 } { dg-warning "previous" "prev def va" { target *-*-* } 14 } - { dg-warning "named variable" "named" { target *-*-* } 14 } - { dg-warning "anonymous variable" "anon" { target *-*-* } 15 } */ + { dg-warning "named var" "named variadic" { target *-*-* } 14 } + { dg-warning "anonymous var" "anon variadic" { target *-*-* } 15 } */ diff --git a/gcc/testsuite/gcc.dg/cpp/skipping.c b/gcc/testsuite/gcc.dg/cpp/skipping.c index d87ea70591c..b8daa890b94 100644 --- a/gcc/testsuite/gcc.dg/cpp/skipping.c +++ b/gcc/testsuite/gcc.dg/cpp/skipping.c @@ -18,3 +18,8 @@ F( /* No diagnostic: don't even try to expand it. */ #else #error Macros not expanded in #elif #endif + +/* Check we don't warn about bad identifiers when skipping. */ +#if 0 +#define foo __VA_ARGS__ /* { dg-bogus "warned about identifier" } */ +#endif