1#!/usr/bin/env bash 2set -eux 3 4BUILDROOT="$(git rev-parse --show-toplevel)" 5SCAN=(scan-build${CC#clang} --use-cc="${CC}") 6 7pushd "$BUILDROOT" &>/dev/null 8 ./autogen.sh 9 # We want to omit source files generated by third-party tools (e.g. 10 # gengetopt) from the static analysis. Therefore, configure to build 11 # in a separate directory which we can then pass to scan-build's 12 # --exclude flag (which only accepts directories containing source 13 # files, not source files directly). 14 mkdir build && pushd build &>/dev/null 15 ${SCAN[@]} ../configure --disable-silent-rules --disable-man 16 popd &>/dev/null 17 ${SCAN[@]} --keep-cc --status-bugs --exclude build \ 18 make -C build -j $(nproc) check 19popd &>/dev/null 20