2023-07-25 11:53:09 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
SKIP_GTEST=1
|
|
|
|
|
|
|
|
. other/analysis/gen-file.sh
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
CPPCHECK=("--enable=all")
|
|
|
|
CPPCHECK+=("--inconclusive")
|
2023-12-27 12:37:22 +01:00
|
|
|
CPPCHECK+=("--check-level=exhaustive")
|
|
|
|
CPPCHECK+=("--inline-suppr")
|
|
|
|
CPPCHECK+=("--library=other/docker/cppcheck/toxcore.cfg")
|
2023-07-25 11:53:09 +02:00
|
|
|
CPPCHECK+=("--error-exitcode=1")
|
2023-12-27 12:37:22 +01:00
|
|
|
# We don't cast function pointers, which cppcheck suggests here.
|
|
|
|
CPPCHECK+=("--suppress=constParameterCallback")
|
2023-07-25 11:53:09 +02:00
|
|
|
# False positives in switch statements.
|
|
|
|
CPPCHECK+=("--suppress=knownConditionTrueFalse")
|
|
|
|
# Cppcheck does not need standard library headers to get proper results.
|
|
|
|
CPPCHECK+=("--suppress=missingIncludeSystem")
|
|
|
|
# TODO(iphydf): Maybe fix?
|
|
|
|
CPPCHECK+=("--suppress=signConversion")
|
|
|
|
|
2023-12-27 12:37:22 +01:00
|
|
|
# We use this for VLAs.
|
|
|
|
CPPCHECK_CXX+=("--suppress=allocaCalled")
|
2023-07-25 11:53:09 +02:00
|
|
|
# False positive in auto_tests.
|
|
|
|
CPPCHECK_CXX+=("--suppress=shadowFunction")
|
2023-12-27 12:37:22 +01:00
|
|
|
# False positive in group.c.
|
|
|
|
# Using cppcheck-suppress claims the suppression is unused.
|
|
|
|
CPPCHECK_CXX+=("--suppress=AssignmentAddressToInteger")
|
|
|
|
# We use C style casts because we write C code.
|
|
|
|
CPPCHECK_CXX+=("--suppress=cstyleCast")
|
2023-07-25 11:53:09 +02:00
|
|
|
# Used in Messenger.c for a static_assert(...)
|
|
|
|
CPPCHECK_CXX+=("--suppress=sizeofFunctionCall")
|
2024-01-12 21:30:48 +01:00
|
|
|
# This is outdated. Range-for is a good choice.
|
|
|
|
CPPCHECK_CXX+=("--suppress=useStlAlgorithm")
|
2023-07-25 11:53:09 +02:00
|
|
|
|
|
|
|
run() {
|
|
|
|
echo "Running cppcheck in variant '$*'"
|
2023-12-27 12:37:22 +01:00
|
|
|
cppcheck -j8 "${CPPCHECK[@]}" "${CPPCHECK_C[@]}" tox*/*.[ch] tox*/*/*.[ch] "${CPPFLAGS[@]}" "$@"
|
2023-07-25 11:53:09 +02:00
|
|
|
cppcheck "${CPPCHECK[@]}" "${CPPCHECK_CXX[@]}" amalgamation.cc "${CPPFLAGS[@]}" "$@"
|
|
|
|
}
|
|
|
|
|
|
|
|
. other/analysis/variants.sh
|