From 2c2e213439c62ab650bda0f705395d63c334cfae Mon Sep 17 00:00:00 2001 From: Tom Reynolds Date: Tue, 31 Jan 2017 00:03:48 +0100 Subject: [PATCH] Compatibility with current cppcheck version Multi-threading is now disabled since it cannot be used with the "unusedFunction" check - which we had enabled so far (and probably want to keep enabled). Add -j and change the checks in --enable to re-enable multi threading. Current cppcheck also depends on a 'library' configuration file. Its location, and that of cppcheck itself, are now configurable in this script. skipci --- mk/linux/mg_cppcheck.sh | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/mk/linux/mg_cppcheck.sh b/mk/linux/mg_cppcheck.sh index f4b152e3c..5fbee8ffb 100755 --- a/mk/linux/mg_cppcheck.sh +++ b/mk/linux/mg_cppcheck.sh @@ -4,12 +4,26 @@ # Written by Mark Vejvoda # Copyright (c) 2011 Mark Vejvoda under GNU GPL v3.0+ -CPPCHECK=$(which cppcheck) +# (Actual) Location of the cppcheck binary +CPPCHECK=$(readlink -f $(which cppcheck)) + +# cppcheck now depends on this library (see 'cppcheck --help' for the '--library' option) +# If you use the Debian / Ubuntu package set this to: /usr/share/cppcheck/cfg/std.cfg +CPPCHECKLIB=$(dirname $CPPCHECK)/cfg/std.cfg + +# File to write results to LOGFILE=/tmp/cppcheck.log -CPUS=`lscpu -p | grep -cv '^#'` -if [ "$CPUS" = '' ]; then CPUS=1; fi - -$CPPCHECK ../../source/ -i ../../source/win32_deps -i ../../source/configurator -i ../../source/shared_lib/sources/libircclient -i ../../source/shared_lib/sources/platform/miniupnpc -i ../../source/shared_lib/sources/streflop -j $CPUS --enable=all --force --verbose 2> $LOGFILE +$CPPCHECK ../../source/ \ + -i ../../source/win32_deps \ + -i ../../source/configurator \ + -i ../../source/shared_lib/sources/libircclient \ + -i ../../source/shared_lib/sources/platform/miniupnpc \ + -i ../../source/shared_lib/sources/streflop \ + --library=$CPPCHECKLIB \ + --enable=all \ + --force \ + --verbose \ + 2> $LOGFILE echo "Results from cppcheck were written to $LOGFILE"