Re: clang's static checker report. - Mailing list pgsql-hackers

From Martijn van Oosterhout
Subject Re: clang's static checker report.
Date
Msg-id 20090823164749.GC17121@svana.org
Whole thread Raw
In response to Re: clang's static checker report.  (Greg Stark <gsstark@mit.edu>)
List 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@pointblue.com.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@svana.org>   http://svana.org/kleptog/
> Please line up in a tree and maintain the heap invariant while
> boarding. Thank you for flying nlogn airlines.

pgsql-hackers by date:

Previous
From: Roger Leigh
Date:
Subject: Re: [PATCH 5/6] psql: print_aligned_text uses table formatting
Next
From: Grzegorz Jaskiewicz
Date:
Subject: Re: clang's static checker report.