#!/bin/bash # This is a script used by some Buildbot workers to push the project # through Clang's static analyzer and prepare the output to be uploaded # back to the buildmaster. You might find it useful too. # Install Clang (you already have it on Mac OS X, apt-get install clang # on Ubuntu, etc), Make sure "scan-build" is in your $PATH. FINALDIR="$1" set -x set -e cd `dirname "$0"` cd .. rm -rf checker-buildbot analysis if [ ! -z "$FINALDIR" ]; then rm -rf "$FINALDIR" fi mkdir checker-buildbot cd checker-buildbot # We turn off deprecated declarations, because we don't care about these warnings during static analysis. # The -Wno-liblto is new since our checker-279 upgrade, I think; checker otherwise warns "libLTO.dylib relative to clang installed dir not found" # You might want to do this for CMake-backed builds instead... scan-build -o analysis cmake -G Ninja -Wno-dev -DPHYSFS_BUILD_SHARED=False -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_FLAGS="-Wno-deprecated-declarations" -DCMAKE_EXE_LINKER_FLAGS="-Wno-liblto" .. rm -rf analysis scan-build -o analysis cmake --build . --config Debug if [ `ls -A analysis |wc -l` == 0 ] ; then mkdir analysis/zarro echo '