I played some with clangs static analyser. It is a really tool, the output formating is great, its easy to use. The only downside is that is implements na c++ specific checks to speak of.
To build blender with the analyser i did the followoing:
cmake -G 'Unix Makefiles' \ -D CMAKE_C_COMPILER=[path to ccc-analyzer] \ -D CMAKE_CXX_COMILER=[path to ccc-analyzer] \ -D WITH_OPENCOLLADA=ON -D OPENCOLLADA=[path to opencollada] \ ../blender/ # then run the build with scan-build -o /tmp/report make -j[number of cores +1]
I do not know and have not bothered to figure out if specifying the analyser as compiler twice is overkill. This works for me.
The build is however slow.
After this step clang’s analyser will have created a directory in /tmp/report