Re: additional GCC warning flags

From: Gaetano Mendola <mendola(at)bigfoot(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: additional GCC warning flags
Date: 2004-10-19 21:17:19
Message-ID: 4175845F.4070203@bigfoot.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

Tom Lane wrote:
> Neil Conway <neilc(at)samurai(dot)com> writes:
>
>>-Wpointer-arith might be worth enabling. I'll add it to the GCC CFLAGS
>>in the next patch I send in.
>
>
> If PG builds cleanly or nearly so with it on, by all means.
>
>
>>As you said, -Wcast-align can't be enabled in general at the moment
>>because it flags a ton of warnings on certain platforms (at least on
>>IA64, probably other 64-bit platforms as well).
>
>
> Yes, HPPA as well. I have long harbored a wish to clean this up but
> it never gets to the top of the to-do list. I am not sure that it would
> really repay the effort to make the code clean against this --- I can
> only recall one or two bugs in the last several years that this might
> have caught.
>
> When I looked at the current gcc Info docs, I noticed that there seem to
> be several new warning types that might be worth turning on. Did you
> consider others beyond the three you're proposing now?

Time ago I compiled 8.0 using gcc 4.0 with a bunch of warning, did you see
my post ? I report it here:

--------------------------------------------------------------------------------------

Hi all,
I succesfull compiled postgres 8.0beta2 with a recent gcc 4.0 snapshot:

gcc (GCC) 4.0.0 20040911 (experimental)
Copyright (C) 2004 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

# select version();
version
-----------------------------------------------------------------------------------------------------
PostgreSQL 8.0.0beta2 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 4.0.0 20040911 (experimental)
(1 row)

All the tests passed, however I had a bunch of warning during the
compilation, the more common was: "left-hand operand of comma expression has no effect"

These are some examples:

=============================================================================
gist.c: In function `gistlayerinsert':
gist.c:463: warning: left-hand operand of comma expression has no effect
gist.c: In function `gistreadbuffer':
gist.c:644: warning: left-hand operand of comma expression has no effect
gist.c: In function `gistchoose':
gist.c:1479: warning: left-hand operand of comma expression has no effect
=============================================================================
pg_conversion.c: In function `pg_convert_using':
pg_conversion.c:334: warning: pointer targets in passing arg 1 of `strlen' differ in signedness
=============================================================================
nbtinsert.c: In function `_bt_insertonpg':
nbtinsert.c:380: warning: 'itup_blkno' may be used uninitialized in this function
nbtinsert.c:379: warning: 'itup_off' may be used uninitialized in this function
=============================================================================
pg_proc.c: In function `match_prosrc_to_query':
pg_proc.c:915: warning: pointer targets in passing arg 1 of `pg_mbstrlen_with_len' differ in signedness
pg_proc.c:929: warning: pointer targets in passing arg 1 of `pg_mbstrlen_with_len' differ in signedness
pg_proc.c: In function `match_prosrc_to_literal':
pg_proc.c:982: warning: pointer targets in passing arg 1 of `pg_mblen' differ in signedness
=============================================================================
orindxpath.c: In function `best_or_subclause_indexes':
orindxpath.c:258: warning: 'best_indexinfo' may be used uninitialized in this function
orindxpath.c:260: warning: 'best_indexquals' may be used uninitialized in this function
orindxpath.c:259: warning: 'best_indexclauses' may be used uninitialized in this function
orindxpath.c:261: warning: 'best_startup_cost' may be used uninitialized in this function
orindxpath.c:262: warning: 'best_total_cost' may be used uninitialized in this function
=============================================================================
createplan.c: In function `create_plan':
createplan.c:1244: warning: 'opclass' may be used uninitialized in this function
=============================================================================

Regards
Gaetano Mendola

In response to

Browse pgsql-patches by date

  From Date Subject
Next Message Reini Urban 2004-10-20 01:07:05 Re: Where is the link to cygwin?
Previous Message Marek Lewczuk 2004-10-19 20:36:05 Re: Where is the link to cygwin?