[cmake-developers] scan-build of CMake

Bill Hoffman bill.hoffman at kitware.com
Thu Jul 31 12:16:33 EDT 2014


On 7/31/2014 12:09 PM, Sean McBride wrote:
> Sweet!  Looking forward to turning that on some of our dashboards.
>
> For those that don't know, when Bill refers to 'scan-build' he's talking about the clang static analyzer:
>
> <http://clang-analyzer.llvm.org>
It is pretty easy to setup.  You actually do not need to change ctest or 
CDash for this one.

Just do a normal build, but change the compilers:
set(ENV{CC} /usr/share/clang/scan-build/ccc-analyzer)
set(ENV{CXX} /usr/share/clang/scan-build/c++-analyzer)

Then all the warnings just show up in the build warnings.

You can even exclude things like this:
set(CTEST_CUSTOM_WARNING_EXCEPTION
".*stl_uninitialized.h:75:19: warning: Forming reference to null pointer.*"
".*stl_vector.h:771:9: warning: Returning null reference.*"
"warning: Value stored to 'yymsg' is never read"
"warning: Value stored to 'yytoken' is never read"
)

I just found a bug from one of these already.  :)


-Bill




More information about the cmake-developers mailing list