clang static analyzer: use it!

Jeff Moyer jmoyer at redhat.com
Fri Sep 4 17:15:40 UTC 2009


Dave Jones <davej at redhat.com> writes:

> On Fri, Sep 04, 2009 at 08:30:14AM +0200, Jim Meyering wrote:
>  > Quick summary: use this tool:
>  > 
>  >   http://clang-analyzer.llvm.org/
>  > 
>  > If you're not using its "scan-build" tool, then start.  Right now.
>  > Really.  It's that good.
>  > 
>  > Recently I've run it on a variety of packages, from coreutils
>  > (of course) to libvirt -- and libxml2 on request by the maintainer.
>  > 
>  > To use them, build the tools described here, from source:
>  > (currently, there is no fedora package, afaik)
>  > 
>  >   http://clang-analyzer.llvm.org/
>  > 
>  > I ran them like this for libxml2:
>  > 
>  >     scan-build -o clang ./autogen.sh
>  >     scan-build -o clang make
>
> This does look neat. When I tried it though, I ended up with ..
>
> scan-build: Removing directory '/mnt/data/src/git-trees/kernel/linux-2.6/clang/2009-09-04-1' because it contains no reports.
>
> While I'd love to believe the kernel is bug free, I have a hard time convincing
> myself that clang is doing the right thing.
>
> I added a path to the clang bin/ dir, and copied scan-build to my ~/bin
> and then ran with 'make defconfig ; scan-build -o clang make bzImage'
>
> Am I missing something obvious ?

It may be that the kernel defines $(CC) to gcc, at which point you
lose.  Try doing a make with CC=/path/to/ccc-analyzer.

Cheers,
Jeff




More information about the fedora-devel-list mailing list