Files
tomato-testing/other/analysis/run-cppcheck
Green Sky 596ea37298 Squashed 'external/toxcore/c-toxcore/' changes from 640e6cace..e58eb27a8
e58eb27a8 fix(toxav): remove extra copy of video frame on encode Tested and works, but there might be alignment issues and other stuff.
206ea3530 refactor: Explicitly pass dependencies to constructors.
7cefa93cf fix(toxencryptsave): Wipe salt and passkey after usage.
7c3be2342 refactor: Add file/line to tox-bootstrapd logging.
f84e8cdce refactor: Move loglogdata out of network.c.
390f7db06 refactor: Move random and memory OS-specifics to `os_*` files.
REVERT: 640e6cace fix(toxav): remove extra copy of video frame on encode Tested and works, but there might be alignment issues and other stuff.

git-subtree-dir: external/toxcore/c-toxcore
git-subtree-split: e58eb27a84f9fa0cd996868e079f39e90a5c04b6
2025-11-04 21:18:05 +01:00

51 lines
1.8 KiB
Bash
Executable File

#!/bin/bash
SKIP_GTEST=1
. other/analysis/gen-file.sh
set -e
CPPCHECK=("--enable=all")
CPPCHECK+=("--inconclusive")
CPPCHECK+=("--check-level=exhaustive")
CPPCHECK+=("--inline-suppr")
CPPCHECK+=("--library=other/docker/cppcheck/toxcore.cfg")
CPPCHECK+=("--error-exitcode=1")
# Some files don't match all our suppressions below.
CPPCHECK+=("--suppress=unmatchedSuppression")
# We don't cast function pointers, which cppcheck suggests here.
CPPCHECK+=("--suppress=constParameterCallback")
# This disagrees with clang's warnings.
CPPCHECK+=("--suppress=invalidPrintfArgType_uint")
# 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")
# We have suppressions in the code for the misra extension.
CPPCHECK+=("--suppress=unmatchedSuppression")
# We use this for VLAs.
CPPCHECK_CXX+=("--suppress=allocaCalled")
# False positive in auto_tests.
CPPCHECK_CXX+=("--suppress=shadowFunction")
# 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")
# Used in Messenger.c for a static_assert(...)
CPPCHECK_CXX+=("--suppress=sizeofFunctionCall")
# This is outdated. Range-for is a good choice.
CPPCHECK_CXX+=("--suppress=useStlAlgorithm")
run() {
echo "Running cppcheck in variant '$*'"
cppcheck -j8 "${CPPCHECK[@]}" "${CPPCHECK_C[@]}" tox*/*.[ch] tox*/*/*.[ch] "${CPPFLAGS[@]}" "$@"
cppcheck "${CPPCHECK[@]}" "${CPPCHECK_CXX[@]}" amalgamation.cc "${CPPFLAGS[@]}" "$@"
}
. other/analysis/variants.sh