diff options
Diffstat (limited to 'gcc/testsuite/gcc.dg/cpp')
-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 |
5 files changed, 41 insertions, 0 deletions
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(); +} |