| 1 |
#!/bin/bash |
| 2 |
|
| 3 |
SKIP_GTEST=1 |
| 4 |
SKIP_BENCHMARK=1 |
| 5 |
|
| 6 |
. other/analysis/gen-file.sh |
| 7 |
|
| 8 |
set -e |
| 9 |
|
| 10 |
CPPCHECK=("--enable=all") |
| 11 |
CPPCHECK+=("--inconclusive") |
| 12 |
CPPCHECK+=("--check-level=exhaustive") |
| 13 |
CPPCHECK+=("--inline-suppr") |
| 14 |
CPPCHECK+=("--library=other/docker/cppcheck/toxcore.cfg") |
| 15 |
CPPCHECK+=("--error-exitcode=1") |
| 16 |
# Some files don't match all our suppressions below. |
| 17 |
CPPCHECK+=("--suppress=unmatchedSuppression") |
| 18 |
# This disagrees with clang's warnings. |
| 19 |
CPPCHECK+=("--suppress=invalidPrintfArgType_uint") |
| 20 |
# False positives in switch statements. |
| 21 |
CPPCHECK+=("--suppress=knownConditionTrueFalse") |
| 22 |
# Cppcheck does not need standard library headers to get proper results. |
| 23 |
CPPCHECK+=("--suppress=missingIncludeSystem") |
| 24 |
# TODO(iphydf): Maybe fix? |
| 25 |
CPPCHECK+=("--suppress=signConversion") |
| 26 |
# These const correctness checks are very broken for C. |
| 27 |
CPPCHECK+=("--suppress=constParameter") |
| 28 |
CPPCHECK+=("--suppress=constParameterCallback") |
| 29 |
CPPCHECK+=("--suppress=constParameterPointer") |
| 30 |
CPPCHECK+=("--suppress=constVariablePointer") |
| 31 |
|
| 32 |
# We use this for VLAs. |
| 33 |
CPPCHECK_CXX+=("--suppress=allocaCalled") |
| 34 |
# False positive in auto_tests. |
| 35 |
CPPCHECK_CXX+=("--suppress=shadowFunction") |
| 36 |
# False positive in group.c. |
| 37 |
# Using cppcheck-suppress claims the suppression is unused. |
| 38 |
CPPCHECK_CXX+=("--suppress=AssignmentAddressToInteger") |
| 39 |
# We use C style casts because we write C code. |
| 40 |
CPPCHECK_CXX+=("--suppress=cstyleCast") |
| 41 |
# Used in Messenger.c for a static_assert(...) |
| 42 |
CPPCHECK_CXX+=("--suppress=sizeofFunctionCall") |
| 43 |
# This is outdated. Range-for is a good choice. |
| 44 |
CPPCHECK_CXX+=("--suppress=useStlAlgorithm") |
| 45 |
|
| 46 |
run() { |
| 47 |
echo "Running cppcheck in variant '$*'" |
| 48 |
cppcheck -j8 "${CPPCHECK[@]}" "${CPPCHECK_C[@]}" tox*/*.[ch] tox*/*/*.[ch] "${CPPFLAGS[@]}" "$@" |
| 49 |
cppcheck "${CPPCHECK[@]}" "${CPPCHECK_CXX[@]}" amalgamation.cc "${CPPFLAGS[@]}" "$@" |
| 50 |
} |
| 51 |
|
| 52 |
. other/analysis/variants.sh |