[libvirt] [PATCH] storage_backend.c: assure clang that inputvol can't be NULL

Jim Meyering jim at meyering.net
Thu Sep 3 10:46:53 UTC 2009


Daniel P. Berrange wrote:

> On Thu, Sep 03, 2009 at 11:18:00AM +0200, Jim Meyering wrote:
>> clang was complaining that a NULL inputvol would be dereferenced
>> in that "could not open..." diagnostic.
>>
>> Since the two sole callers of this function are careful
>> to call it only when inputvol is non-NULL, this is a good
>> case for giving the parameter the nonnull attribute:
>
> ACK.
>
> BTW, how exactly are you getting all these warnings/diagnostics ?
> Are you merely compiling libvirt using clang & just collecting
> the warnings, or is this some special static analysis tool ?
>
> If we're going to start adding these non-null attributes, then
> I should hook the appropriate tool into autobuild.sh to validate
> them regularly.

Definitely.

I built llvm/clang per instructions here:

    http://clang-analyzer.llvm.org/

Than ran them like this:

    scan-build -o clang ./autogen.sh
    scan-build -o clang make

That produces a bunch of html in the -o-specified dierctory, clang/.
Point your browser at clang/*/index.html to view the results.




More information about the libvir-list mailing list