diff options
author | Andrew Haley <aph@redhat.com> | 2008-07-03 10:13:48 +0000 |
---|---|---|
committer | Andrew Haley <aph@gcc.gnu.org> | 2008-07-03 10:13:48 +0000 |
commit | d92007910f9e9033056d558dd4a49e4828cc0067 (patch) | |
tree | b3b421ec3934a5398bb571a7badfd6d17cee0eb7 /gcc | |
parent | d07660ccf3063d1155df32ce320f101bafca04a2 (diff) | |
download | gcc-d92007910f9e9033056d558dd4a49e4828cc0067.zip gcc-d92007910f9e9033056d558dd4a49e4828cc0067.tar.gz gcc-d92007910f9e9033056d558dd4a49e4828cc0067.tar.bz2 |
re PR preprocessor/33305 (We should warn about empty macro arguments)
2008-07-03 Andrew Haley <aph@redhat.com>
PR preprocessor/33305
* gcc.dg/cpp/avoidpaste1.c: Use dg-options "-ansi" to avoid
"-pedantic".
* gcc.dg/cpp/avoidpaste2.c: Likewise
* gcc.dg/cpp/20000519-1.c: Likewise.
* g++.dg/ext/gnu-inline-global-reject.C: Likewise.
* gcc.dg/cpp/c99-empty-macro-args.c: New test.
* gcc.dg/cpp/c90-empty-macro-args.c: New test.
From-SVN: r137411
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/testsuite/ChangeLog | 11 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/ext/gnu-inline-global-reject.C | 1 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/cpp/20000519-1.c | 1 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/cpp/avoidpaste1.c | 1 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/cpp/avoidpaste2.c | 1 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/cpp/c90-empty-macro-args.c | 19 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/cpp/c99-empty-macro-args.c | 19 |
7 files changed, 53 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 3feefc8..cc23a06 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,14 @@ +2008-07-03 Andrew Haley <aph@redhat.com> + + PR preprocessor/33305 + * gcc.dg/cpp/avoidpaste1.c: Use dg-options "-ansi" to avoid + "-pedantic". + * gcc.dg/cpp/avoidpaste2.c: Likewise + * gcc.dg/cpp/20000519-1.c: Likewise. + * g++.dg/ext/gnu-inline-global-reject.C: Likewise. + * gcc.dg/cpp/c99-empty-macro-args.c: New test. + * gcc.dg/cpp/c90-empty-macro-args.c: New test. + 2008-07-03 Richard Guenther <rguenther@suse.de> PR c++/36128 diff --git a/gcc/testsuite/g++.dg/ext/gnu-inline-global-reject.C b/gcc/testsuite/g++.dg/ext/gnu-inline-global-reject.C index 2f2b8f2..d9e2660 100644 --- a/gcc/testsuite/g++.dg/ext/gnu-inline-global-reject.C +++ b/gcc/testsuite/g++.dg/ext/gnu-inline-global-reject.C @@ -4,6 +4,7 @@ */ /* { dg-do compile } */ +/* { dg-options " -ansi -Wno-long-long" } */ #include "gnu-inline-common.h" diff --git a/gcc/testsuite/gcc.dg/cpp/20000519-1.c b/gcc/testsuite/gcc.dg/cpp/20000519-1.c index 82ab3a2..7cd7daa 100644 --- a/gcc/testsuite/gcc.dg/cpp/20000519-1.c +++ b/gcc/testsuite/gcc.dg/cpp/20000519-1.c @@ -1,6 +1,7 @@ /* Regression test for preprocessor crash. Reported by Mathias Froehlich <frohlich@na.uni-tuebingen.de>. */ /* { dg-do preprocess } */ +/* { dg-options "-ansi" } */ #define foo #define __CAT__(a,b,c,d) a##b##c##d diff --git a/gcc/testsuite/gcc.dg/cpp/avoidpaste1.c b/gcc/testsuite/gcc.dg/cpp/avoidpaste1.c index d304a74..3591f9c 100644 --- a/gcc/testsuite/gcc.dg/cpp/avoidpaste1.c +++ b/gcc/testsuite/gcc.dg/cpp/avoidpaste1.c @@ -1,6 +1,7 @@ /* Copyright (C) 2001, 2003 Free Software Foundation, Inc. */ /* { dg-do preprocess } */ +/* { dg-options "-ansi" } */ /* This tests that we avoid accidental pasting only before and after macros and arguments, and not when the tokens are already pasted diff --git a/gcc/testsuite/gcc.dg/cpp/avoidpaste2.c b/gcc/testsuite/gcc.dg/cpp/avoidpaste2.c index 42b549c..dc5bbc7 100644 --- a/gcc/testsuite/gcc.dg/cpp/avoidpaste2.c +++ b/gcc/testsuite/gcc.dg/cpp/avoidpaste2.c @@ -1,6 +1,7 @@ /* Copyright (C) 2001, 2003 Free Software Foundation, Inc. */ /* { dg-do preprocess } */ +/* { dg-options "-ansi" } */ /* This tests that we avoid accidental pasting, as well as gratuitous space insertion, in various nasty places _inside_ a macro's diff --git a/gcc/testsuite/gcc.dg/cpp/c90-empty-macro-args.c b/gcc/testsuite/gcc.dg/cpp/c90-empty-macro-args.c new file mode 100644 index 0000000..e90f8e6 --- /dev/null +++ b/gcc/testsuite/gcc.dg/cpp/c90-empty-macro-args.c @@ -0,0 +1,19 @@ +/* { dg-do compile } */ +/* { dg-options "-std=c89 -pedantic" } */ + +#define f(a,b) f2(a,,b) +#define f2(a,b,c) a; b; c; +#define f3(a) a + +#define g() p() + +void p(void) {} + + +void foo(void) +{ + f(p(),p()); /* { dg-warning "macro f2 argument 2: empty macro arguments are undefined" } */ + f2(p(),,p()); /* { dg-warning "macro f2 argument 2: empty macro arguments are undefined" } */ + f3(); /* { dg-warning "macro f3 argument 1: empty macro arguments are undefined" } */ + g(); +} diff --git a/gcc/testsuite/gcc.dg/cpp/c99-empty-macro-args.c b/gcc/testsuite/gcc.dg/cpp/c99-empty-macro-args.c new file mode 100644 index 0000000..e1e0c61 --- /dev/null +++ b/gcc/testsuite/gcc.dg/cpp/c99-empty-macro-args.c @@ -0,0 +1,19 @@ +/* { dg-do compile } */ +/* { dg-options "-std=c99 -pedantic" } */ + +#define f(a,b) f2(a,,b) +#define f2(a,b,c) a; b; c; +#define f3(a) a + +#define g() p() + +void p(void) {} + + +void foo(void) +{ + f(p(),p()); + f2(p(),,p()); + f3(); + g(); +} |