On 2013-12-14 12:14:25 -0500, Tom Lane wrote:
> Andres Freund <and...@2ndquadrant.com> writes:
> > Compiling postgres with said option in CFLAGS really gives an astounding
> > number of warnings. Except some bison/flex generated ones, none of them
> > looks acceptable to me.
> Given that we're not going to be able to get rid of the bison/flex cases,
> is this really something to bother with?

On a second look, it's not that hard to supress the warnings for
those. Something *roughly* like:

 * Declare variables defined by bison as extern, so clang doesn't complain
 * about undeclared non-static variables.
extern int plpgsql_yychar;
extern int plpgsql_yynerrs;


> I agree I don't like cases where
> there's an "extern" in some other .c file rather than in a header, but I'm
> dubious about making a goal of suppressing this warning as such.

The cases where a 'static' is missing imo are cases that should clearly
be fixed, there's just no excuse for them. But it's an easy mistake to
make so having the compiler's support imo is helpful.

WRT the externs in .c files, if it were just old code, I wouldn't
bother. But we're regularly adding them. The last ones just last week in
316472146 and ef3267523 and several others aren't much older. So making
it a policy that can relatively easily be checked automatically not to
do so seems like a good idea.

Unfortunately gcc doesn't have a equivalent warning...


Andres Freund

 Andres Freund                     http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services

Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:

Reply via email to