You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Stefan Fritsch <sf...@sfritsch.de> on 2011/01/11 22:19:01 UTC

-Wdeclaration-after-statement

On Tuesday 11 January 2011, Guenter Knauf wrote:
> Am 10.01.2011 21:26, schrieb Stefan Fritsch:
> > BTW, gcc has -Wdeclaration-after-statement to catch these things.
> > Should we add that to the default warnings enabled in maintainer
> > mode?
> 
> +2 - NetWare compiler cant deal with either;
> and +1 to treat it even as error rather than warning:
> -Werror=declarationafterstatement

The -Werror=... syntax requires a rather recent gcc (definitely 4.x, 
and x > 0 IIRC).

> 
> BTW. isnt the option without dashes? My 'man gcc' lists:
> Wdeclarationafterstatement (C and ObjectiveC only)
>       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 not supported by ISO C90
> and was not supported by GCC versions before GCC 3.0.
> 
> Since GCC < 3 didnt support this I assume that then also the above
> options are not recognized - so adding them should depend on GCC
> version

The option is newer than the ability to compile the code. It doesn't 
appear in the gcc 3.3 doc, so I assume it has been introduced in gcc 
3.4.

I have now commited a configure check for it. But I don't have a 
pre-3.4 gcc to test the "no" case.

Cheers,
Stefan

Re: -Wdeclaration-after-statement

Posted by Stefan Fritsch <sf...@sfritsch.de>.
On Tuesday 11 January 2011, Eric Covener wrote:
> On Tue, Jan 11, 2011 at 4:56 PM, Eric Covener <co...@gmail.com> 
wrote:
> >> The option is newer than the ability to compile the code. It
> >> doesn't appear in the gcc 3.3 doc, so I assume it has been
> >> introduced in gcc 3.4.
> >> 
> >> I have now commited a configure check for it. But I don't have a
> >> pre-3.4 gcc to test the "no" case.
> > 
> > Seems to work fine with gcc 3.3.3 on SLES9.
> 
> Your configure check that is, not the gcc feature itself.

Thanks for testing.

Cheers,
Stefan


Re: -Wdeclaration-after-statement

Posted by Eric Covener <co...@gmail.com>.
On Tue, Jan 11, 2011 at 4:56 PM, Eric Covener <co...@gmail.com> wrote:
>> The option is newer than the ability to compile the code. It doesn't
>> appear in the gcc 3.3 doc, so I assume it has been introduced in gcc
>> 3.4.
>>
>> I have now commited a configure check for it. But I don't have a
>> pre-3.4 gcc to test the "no" case.
>
> Seems to work fine with gcc 3.3.3 on SLES9.

Your configure check that is, not the gcc feature itself.

Re: -Wdeclaration-after-statement

Posted by Eric Covener <co...@gmail.com>.
> The option is newer than the ability to compile the code. It doesn't
> appear in the gcc 3.3 doc, so I assume it has been introduced in gcc
> 3.4.
>
> I have now commited a configure check for it. But I don't have a
> pre-3.4 gcc to test the "no" case.

Seems to work fine with gcc 3.3.3 on SLES9.