This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [RFA:] -Wdeclaration-after-statement
- From: "Joseph S. Myers" <jsm at polyomino dot org dot uk>
- To: Hans-Peter Nilsson <hp at bitrange dot com>
- Cc: gcc-patches at gcc dot gnu dot org, Michael Culbertson <Michael dot J dot Culbertson at wheaton dot edu>
- Date: Wed, 16 Jul 2003 10:39:06 +0100 (BST)
- Subject: Re: [RFA:] -Wdeclaration-after-statement
- References: <Pine.BSF.4.44.0307160451040.99649-100000@dair.pair.com>
On Wed, 16 Jul 2003, Hans-Peter Nilsson wrote:
> testsuite:
> * gcc.dg/c99-mixdecl-2.c, gcc.dg/c90-mixdecl-2.c: New tests.
c9?-*.c are tests of standards versions support, tests of a particular
warning option should be named differently. (I'd be happy with
Wdeclaration-after-statement-[12].c, but maybe some people would dislike
those long filenames.)
> + @item -Wdeclaration-after-statement @r{(C only)}
> + @opindex Wdeclaration-after-statement
> + Warn when a declaration is found after a statement in a block. This
> + construct, known from C++, was introduced with ISO C99 and is by default
> + allowed in gcc. It is disallowed in ISO C90 and in gcc versions before
> + GCC version 3.0.
I would say "was not supported by GCC versions before GCC 3.0" rather than
saying that such versions disallow it. Also, "GCC" rather than "gcc".
> + /* Test for C99 mixed declarations and code giving warnings, not error with
> + -Wdeclaration-after-statement. */
dg-warning and dg-error don't suffice to distinguish warnings and errors:
you probably want dg-warning "warning" here to detect the "warning"
marker.
--
Joseph S. Myers
jsm@polyomino.org.uk