Rename lib.sh -> scan-build.sh

This commit is contained in:
Max Brunsfeld 2017-07-06 10:32:41 -07:00
parent 78333b70c0
commit a64db98218
4 changed files with 2 additions and 6 deletions

24
script/util/scan-build.sh Executable file
View file

@ -0,0 +1,24 @@
function scan_build {
extra_args=()
# AFAICT, in the trusty travis container the scan-build tool is from the 3.4
# installation. Therefore, by default it will use clang-3.4 when analysing code
# which doesn't support the '-std=c++14' (it is available via '-std=c++1y').
# Use the system-wide installed clang instead which is 3.5 and does support
# '-std=c++14'.
extra_args+=("--use-analyzer=$(which clang)")
# scan-build will try to guess which CXX should be used to compile the actual
# code, which is usually g++ but we need g++5 in the CI. Explicitly pass
# $CC/$CXX to scan-build if they are set in the environment.
if [[ ! -z "$CC" ]]; then
extra_args+=("--use-cc=$CC")
fi
if [[ ! -z "$CXX" ]]; then
extra_args+=("--use-c++=$CXX")
fi
scan-build "${extra_args[@]}" --status-bugs -disable-checker deadcode.DeadStores "$@"
}