| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 | #!/bin/bash# This is a script used by some Buildbot build 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 macOS, apt-get install clang#  on Ubuntu, etc), install CMake, and pip3 install codechecker.FINALDIR="$1"set -xset -ecd `dirname "$0"`cd ..rm -rf codechecker-buildbotif [ ! -z "$FINALDIR" ]; then    rm -rf "$FINALDIR"fimkdir codechecker-buildbotcd codechecker-buildbot# We turn off deprecated declarations, because we don't care about these warnings during static analysis.cmake -Wno-dev -DSDL_STATIC=OFF -DCMAKE_BUILD_TYPE=Debug -DSDL_ASSERTIONS=enabled -DCMAKE_C_FLAGS="-Wno-deprecated-declarations" -DCMAKE_EXPORT_COMPILE_COMMANDS=1 ..# CMake on macOS adds "-arch arm64" or whatever is appropriate, but this confuses CodeChecker, so strip it out.perl -w -pi -e 's/\-arch\s+.*?\s+//g;' compile_commands.jsonrm -rf ../analysisCodeChecker analyze compile_commands.json -o ./reports# "parse" returns 2 if there was a static analysis issue to report, but this#  does not signify an error in the parsing (that would be error code 1). Turn#  off the abort-on-error flag.set +eCodeChecker parse ./reports -e html -o ../analysisset -ecd ..chmod -R a+r analysischmod -R go-w analysisfind analysis -type d -exec chmod a+x {} \;if [ -x /usr/bin/xattr ]; then find analysis -exec /usr/bin/xattr -d com.apple.quarantine {} \; 2>/dev/null ; fiif [ ! -z "$FINALDIR" ]; then    mv analysis "$FINALDIR"else    FINALDIR=analysisfirm -rf codechecker-buildbotecho "Done. Final output is in '$FINALDIR' ..."# end of codechecker-buildbot.sh ...
 |