Static analysis: integration with the Static Analyzer.

This provides a wrapper script to invoke the Static Analyzer on the code
base. The script simply wraps your commands, that is you have to do the
following:

    ..scripts/analyze cmake ..
    ..scripts/analyze cmake --build .

Note: the Static Analyzer is integrated in Xcode, so if you are on a
Mac, consider using Xcode natively instead of this wrapper script that
will only give you HTML output.

Reference:

- http://clang-analyzer.llvm.org/
This commit is contained in:
Daniel J. Hofmann 2015-09-11 18:33:29 +02:00
parent 998abf05ba
commit 9deadc1371

19
scripts/analyze.sh Executable file
View File

@ -0,0 +1,19 @@
#!/usr/bin/env bash
# Runs the Static Analyzer on the code base.
# This is a wrapper intended to be used with like this:
# 1/ analyze cmake ..
# 2/ analyze cmake --build .
exec scan-build -analyze-headers -no-failure-reports --keep-going --status-bugs \
-enable-checker alpha.core.BoolAssignment \
-enable-checker alpha.core.IdenticalExpr \
-enable-checker alpha.core.TestAfterDivZero \
-enable-checker alpha.deadcode.UnreachableCode \
-enable-checker alpha.security.ArrayBoundV2 \
-enable-checker alpha.security.MallocOverflow \
-enable-checker alpha.security.ReturnPtrRange \
-enable-checker security.FloatLoopCounter \
-enable-checker security.insecureAPI.rand \
-enable-checker security.insecureAPI.strcpy \
"${@}"