Re: clang's static checker report.

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: Greg Stark <gsstark(at)mit(dot)edu>
Cc: Grzegorz Jaskiewicz <gj(at)pointblue(dot)com(dot)pl>, pgsql-hackers Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: clang's static checker report.
Date: 2009-08-23 16:47:49
Message-ID: 20090823164749.GC17121@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun, Aug 23, 2009 at 05:41:24PM +0100, Greg Stark wrote:
> On Sun, Aug 23, 2009 at 4:57 PM, Grzegorz Jaskiewicz<gj(at)pointblue(dot)com(dot)pl> wrote:
> > I am sure there's plenty of false positives, but I am also quite sure
> > there's many real errors on that list.
>
> Do you know how to teach clang about functions which never return?
> That seems to be causing most of the false positives because it
> doesn't recognize that our error checks stop execution and avoid the
> use of the unitialized variables afterwards.

This caused many of the false positives in Coverity's tool as well.

The way you work around it is by altering the definition of
elog/ereport slightly so that after the usual expansion you add:

if( level >= ERROR) exit(1)

If it were just a matter of a function that didn't return it'd be easy.
What we have is a function that doesn't return depending on the
arguments, this is much trickier.

Have a nice day,
--
Martijn van Oosterhout <kleptog(at)svana(dot)org> http://svana.org/kleptog/
> Please line up in a tree and maintain the heap invariant while
> boarding. Thank you for flying nlogn airlines.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Grzegorz Jaskiewicz 2009-08-23 16:49:46 Re: clang's static checker report.
Previous Message Grzegorz Jaskiewicz 2009-08-23 16:47:46 Re: clang's static checker report.