FYI: clang static analyzer page has moved to
rdivacky at freebsd.org
Fri Jan 7 07:49:02 UTC 2011
On Thu, Jan 06, 2011 at 11:59:07PM +0100, Erik Cederstrand wrote:
> Den 06/01/2011 kl. 20.56 skrev Tijl Coosemans:
> > On Thursday 06 January 2011 09:01:09 Erik Cederstrand wrote:
> >> Den 05/01/2011 kl. 20.36 skrev Jilles Tjoelker:
> >>> On Wed, Jan 05, 2011 at 05:55:45PM +0100, Ulrich Sp?rlein wrote:
> >>>> - get IPA to work with clang, or at least file a bug
> >>>> - mark functions as __dead2 (please don't do that)
> >>> Why not?
> >> Because the analyzer is supposed to find bugs. Only the function that
> >> really doesn't return should be marked as such. If we begin spewing
> >> __dead2's everywhere, it's bound to silence a valid bug somewhere
> >> down the line when e.g. a conditional in a print_help() function is
> >> changed subtly so it doesn't always reach exit().
> > On the other hand you can't really expect the compiler/analyser to know
> > what a procedure in another file does, so in that case you need __dead2
> > anyway. [...]
> I have high expectations of LLVM :-) LLVM already has some knowledge of what's going on in other files (see LTO) so why shouldn't it be able to detect the __noreturn__ ? All the necessary information should be readily available.
the static analyzer has nothing to do with LLVM. it's a clang component and
uses only the info that clang knows. and clang (ie. the C frontend) does
not perform any analysis of this kind, thus it does not know that stuff
fwiw - my trivial (but working) patch brought down the number of reports
by mere 5% so the bulk is probably somewhere else...
More information about the freebsd-current