[RFA:] -Wdeclaration-after-statement

Joseph S. Myers jsm@polyomino.org.uk
Wed Jul 16 09:39:00 GMT 2003


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



More information about the Gcc-patches mailing list