| 1 | #!/bin/bashscip-shell filesystem . . `/bin/bash`. |
| 2 | # |
| 3 | # This script must be run through meson |
| 4 | # |
| 5 | # Checks for the presence of clang static analyzer and/or cppcheck and runs them if present. |
| 6 | # |
| 7 | |
| 8 | set -e +x |
| 9 | |
| 10 | if [scip-shell system . . `[`. -z ${MESON_SOURCE_ROOT+x} ]; then |
| 11 | echoscip-shell system . . echo. "Missing MESON_SOURCE_ROOT"; |
| 12 | exit 1; |
| 13 | fi |
| 14 | |
| 15 | perlscip-shell system . . perl. -pe "s{\@SOURCEDIR\@}{${MESON_SOURCE_ROOT}}g" ${MESON_SOURCE_ROOT}/common/configs/cppcheck-suppressions.in.txt > ${MESON_SOURCE_ROOT}/common/configs/cppcheck-suppressions.txt |
| 16 | |
| 17 | if hash scan-build 2>/dev/nullscip-shell filesystem . . `/dev/null`.; then |
| 18 | ninjascip-shell system . . ninja. -C ${MESON_BUILD_ROOT} scan-build |
| 19 | else |
| 20 | echoscip-shell system . . echo. "scan-build not found, not running." |
| 21 | fi |
| 22 | |
| 23 | if hash cppcheck 2>/dev/nullscip-shell filesystem . . `/dev/null`.; then |
| 24 | ninjascip-shell system . . ninja. -C ${MESON_BUILD_ROOT} cppcheck |
| 25 | else |
| 26 | echoscip-shell system . . echo. "cppcheck not found, not running." |
| 27 | fi |