Re: additional GCC warnings - Mailing list pgsql-hackers

From Tom Lane
Subject Re: additional GCC warnings
Date
Msg-id 9353.1098035446@sss.pgh.pa.us
Whole thread Raw
In response to additional GCC warnings  (Neil Conway <neilc@samurai.com>)
Responses Re: additional GCC warnings
Re: additional GCC warnings
List pgsql-hackers
Neil Conway <neilc@samurai.com> writes:
> Recent versions of GCC support some additional warning flags that I 
> think would be useful to enable for building PostgreSQL:

> -Wmissing-declarations ("Warn if a global function is defined without a 
> previous declaration.")

Hm?  We have always used that one.

> -Wdeclaration-after-statement (Recent versions of GCC allow declarations 
> and statements to be intermixed in C; enabling this flag would enforce 
> the current convention of avoiding this style.)

Ick.  If the default is to allow that, then yes we need a warning.
I'd be fairly annoyed if it's not an error, in fact.

> Since some of these flags were added to GCC relatively recently, we 
> would probably need to test if the local gcc supports the flags via 
> configure.

Yeah, you would: it looks like gcc treats an unrecognized -W option
as an error:

$ gcc -Wabc z.c
cc1: Invalid option `-Wabc'
$ echo $?
1
$
        regards, tom lane


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Nearing final release?
Next
From: Tom Lane
Date:
Subject: Re: 7.4 changes