2020-05-04 09:19:14 +08:00
|
|
|
#!/bin/bash
|
2018-02-23 10:22:38 +08:00
|
|
|
|
2022-01-14 08:28:06 +08:00
|
|
|
SKIP_GTEST=1
|
|
|
|
|
2018-02-23 10:22:38 +08:00
|
|
|
. other/analysis/gen-file.sh
|
|
|
|
|
2022-01-14 08:28:06 +08:00
|
|
|
set -e
|
|
|
|
|
2022-03-16 05:19:43 +08:00
|
|
|
CPPCHECK=("--enable=all")
|
2022-02-21 21:24:00 +08:00
|
|
|
CPPCHECK+=("--inconclusive")
|
|
|
|
CPPCHECK+=("--error-exitcode=1")
|
|
|
|
# Used for VLA.
|
|
|
|
CPPCHECK+=("--suppress=allocaCalled")
|
2022-03-31 08:09:50 +08:00
|
|
|
# False positives on sanctions_copy in group_moderation.c
|
|
|
|
CPPCHECK+=("--suppress=doubleFree")
|
2022-03-16 05:19:43 +08:00
|
|
|
# False positives in switch statements.
|
2022-02-21 21:24:00 +08:00
|
|
|
CPPCHECK+=("--suppress=knownConditionTrueFalse")
|
|
|
|
# Cppcheck does not need standard library headers to get proper results.
|
|
|
|
CPPCHECK+=("--suppress=missingIncludeSystem")
|
|
|
|
# TODO(iphydf): Maybe fix?
|
|
|
|
CPPCHECK+=("--suppress=signConversion")
|
|
|
|
# TODO(iphydf): Fixed in the toxav refactor PR.
|
|
|
|
CPPCHECK+=("--suppress=redundantAssignment")
|
2022-03-16 05:19:43 +08:00
|
|
|
# We're a library. This only works on whole programs.
|
|
|
|
CPPCHECK_C=("--suppress=unusedFunction")
|
|
|
|
|
|
|
|
# We actually write C code.
|
|
|
|
CPPCHECK_CXX=("--suppress=cstyleCast")
|
2022-03-25 02:16:45 +08:00
|
|
|
# False positive in cmp.c.
|
|
|
|
CPPCHECK_CXX+=("--suppress=objectIndex")
|
2022-03-16 05:19:43 +08:00
|
|
|
# False positive in auto_tests.
|
|
|
|
CPPCHECK_CXX+=("--suppress=shadowArgument")
|
|
|
|
CPPCHECK_CXX+=("--suppress=shadowFunction")
|
2022-02-21 21:24:00 +08:00
|
|
|
|
2022-01-14 08:28:06 +08:00
|
|
|
run() {
|
|
|
|
echo "Running cppcheck in variant '$*'"
|
2022-03-16 05:19:43 +08:00
|
|
|
cppcheck "${CPPCHECK[@]}" "${CPPCHECK_C[@]}" tox*/*.[ch] tox*/*/*.[ch] "${CPPFLAGS[@]}" "$@"
|
|
|
|
cppcheck "${CPPCHECK[@]}" "${CPPCHECK_CXX[@]}" amalgamation.cc "${CPPFLAGS[@]}" "$@"
|
2022-01-14 08:28:06 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
. other/analysis/variants.sh
|