Static analysis

Sam Price thesamprice at gmail.com
Fri May 5 03:54:07 UTC 2023


I was trying to run scan-build on a microblaze build.
However scan-build wasn't seeing any files get built.
I then tried to revert down to the intercept-build command, and it
generated an empty compilation database.
/usr/share/clang/scan-build-py-10/bin/intercept-build --override-compiler  ./waf
Is supposed to dump out a compilation database that scan-build is using.

Sadly its not intercepting the compile commands from waf.

For scan build I think waf should be able to generate the compile
database. Also unsure where to add the waf magic.
def configure(conf):
    conf.load('compiler_cxx')
    ...
    conf.load('clang_compilation_database')

And then pass that compile database into scan-build

scan-build -o /path/to/report/directory -p /path/to/compile_commands.json


Somewhere in waf I should be able to add some magic to use cppcheck
but am unsure where to add that logic.

    import waftools

    def options(opt):
        opt.load('cppcheck', tooldir=waftools.location)

    def configure(conf):
        conf.load('cppcheck')

And then be able to use cppcheck on the build.
waf build --cppcheck


More information about the devel mailing list