Re: Setting -Werror in CFLAGS - Mailing list pgsql-hackers

From Peter Geoghegan
Subject Re: Setting -Werror in CFLAGS
Date
Msg-id CAEYLb_VvuMgXDR6sivMSBYsvi5erkycphZcVTsfsatYhV7xxQQ@mail.gmail.com
Whole thread Raw
In response to Re: Setting -Werror in CFLAGS  (Peter Eisentraut <peter_e@gmx.net>)
List pgsql-hackers
On 18 January 2012 19:40, Peter Eisentraut <peter_e@gmx.net> wrote:
> On ons, 2012-01-04 at 13:44 -0500, Robert Haas wrote:
>> I'm not thrilled about that either.  Especially since they seem to be
>> adding more and more warnings that are harder and harder to work
>> around for issues that are less and less important.  Unimportant
>> warnings that are easily avoidable are not so bad, but...
>>
> I think the reason they add all these new warnings is that a lot of
> software is of poor quality.  A lot of software probably doesn't check
> any return values, so they need to see those warnings.  If the last 3
> out of 100 are hard to fix, that might be a small price to pay.

I recently ran a static analysis tool, Clang Static Analyzer, on
Postgres. It was an amusing distraction for half an hour, but it
wasn't particularly useful. It was immediately obvious 1) Why the tool
flagged certain code as possibly questionable and 2) Why it wasn't
actually questionable at all. It would probably be really useful with
a poor quality codebase though.

As I've already said, the fact that a Clang warning successfully
flagged a bug in Postgres a while back does go to show that there is
some benefit to be had from all of these sorts of diagnostics. I have
a rather low opinion of GCC's diagnostics though.

--
Peter Geoghegan       http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training and Services


pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: age(xid) on hot standby
Next
From: Tom Lane
Date:
Subject: Re: age(xid) on hot standby