[cfe-dev] CLANG rpm packages, and hopefully a new project using scan-build

Stefan Reinauer stepan at coresystems.de
Tue Mar 10 13:19:36 PDT 2009


Hi,

from the web page:

> Packaged builds for other platforms may eventually be provided,
> but as the tool is in its early stages we are not actively promoting
> releases yet. If you wish to help contribute regular builds of the
> analyzer on other platforms, please email the Clang Developers'
> mailing list.

I started building snapshot builds of llvm + clang + scan-build for
openSUSE at
http://download.opensuse.org/repositories/home:/reinauer/

Latest version available was r66512, right now it's building an r66542
for testing.

The reason we found interest in clang/llvm was the fine static code
analysis tool scan-build.

We started integrating scan-build in the build system of the open source
firmware (bios) project
coreboot (formerly known as LinuxBIOS). Patrick Georgi made this first 
test run available:

http://coreboot.org/~stepan/llvm/coreboot-builds/  (created with r66542)

There is one directory for each mainboard (target) that we support. Feel
free to have a look.
Each target gets composed from a slightly different set of source files,
plus some generic
ones, so each target reveals a different number of "bugs".

We are still seeing a lot of "parser rejects" with our code, and I would
like to seek some help
here to fix those (in clang or in our code, whatever is appropriate)

One issue I noticed is clang / scan-build does not seem to cope with
forward declarations:
...
note: forward declaration of 'struct pci_bus_operations'
struct pci_bus_operations;
       ^
...
error: variable has incomplete type 'struct pci_bus_operations const'
const struct pci_bus_operations pci_cf8_conf2;


Another one is that it won't detect when a function is never supposed to
return. We have a few situations in the code where we do the following:

void die(char * message)
{
    printf("ERROR: %s\n", message);
    for (;;) ;
}

void somefunction(struct foo *param)
{
    if (!param)
        die("param is not set!")

    param->some_member = somevalue;
}

The above is errored as a potential NULL pointer dereference, which in
fact it is not.



We found quite a bunch more such things. If you are interested in these
types of reports, we will try to provide you as good information as
possible.


Best regards,

Stefan

-- 
coresystems GmbH • Brahmsstr. 16 • D-79104 Freiburg i. Br.
      Tel.: +49 761 7668825 • Fax: +49 761 7664613
Email: info at coresystems.dehttp://www.coresystems.de/
Registergericht: Amtsgericht Freiburg • HRB 7656
Geschäftsführer: Stefan Reinauer • Ust-IdNr.: DE245674866




More information about the cfe-dev mailing list