Commit d9200791 by Andrew Haley Committed by Andrew Haley

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
parent d07660cc
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> 2008-07-03 Richard Guenther <rguenther@suse.de>
PR c++/36128 PR c++/36128
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
*/ */
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-options " -ansi -Wno-long-long" } */
#include "gnu-inline-common.h" #include "gnu-inline-common.h"
......
/* Regression test for preprocessor crash. /* Regression test for preprocessor crash.
Reported by Mathias Froehlich <frohlich@na.uni-tuebingen.de>. */ Reported by Mathias Froehlich <frohlich@na.uni-tuebingen.de>. */
/* { dg-do preprocess } */ /* { dg-do preprocess } */
/* { dg-options "-ansi" } */
#define foo #define foo
#define __CAT__(a,b,c,d) a##b##c##d #define __CAT__(a,b,c,d) a##b##c##d
......
/* Copyright (C) 2001, 2003 Free Software Foundation, Inc. */ /* Copyright (C) 2001, 2003 Free Software Foundation, Inc. */
/* { dg-do preprocess } */ /* { dg-do preprocess } */
/* { dg-options "-ansi" } */
/* This tests that we avoid accidental pasting only before and after /* This tests that we avoid accidental pasting only before and after
macros and arguments, and not when the tokens are already pasted macros and arguments, and not when the tokens are already pasted
......
/* Copyright (C) 2001, 2003 Free Software Foundation, Inc. */ /* Copyright (C) 2001, 2003 Free Software Foundation, Inc. */
/* { dg-do preprocess } */ /* { dg-do preprocess } */
/* { dg-options "-ansi" } */
/* This tests that we avoid accidental pasting, as well as gratuitous /* This tests that we avoid accidental pasting, as well as gratuitous
space insertion, in various nasty places _inside_ a macro's space insertion, in various nasty places _inside_ a macro's
......
/* { 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();
}
/* { 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();
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment