diff --git a/dist/tools/cppcheck/README.md b/dist/tools/cppcheck/README.md index 92a32b68b4..732cde1b33 100644 --- a/dist/tools/cppcheck/README.md +++ b/dist/tools/cppcheck/README.md @@ -15,12 +15,19 @@ Check all files changed in the current branch against the branch named Check all files but ignore warnings about unused struct members: - ./dist/tools/cppcheck/check.sh --suppress=unusedStructMember + ./dist/tools/cppcheck/check.sh --suppress=unassignedVariable Check all files changed in the current branch against the branch named -'master', ignoring warnings about unused struct members: +'master', ignoring warnings about unassigned variables: - ./dist/tools/cppcheck/check.sh master --suppress=unusedStructMember --suppress=unassignedVariable + ./dist/tools/cppcheck/check.sh master --suppress=unassignedVariable + +# Default options + +This script suppresses warnings of the type "unusedStructMember" by default. If +you want to get warnings about "unusedStructMembers" run the script with the +--show-unused-struct option: + ./dist/tools/cppcheck/check.sh --show-unused-struct [BRANCH] [options to be passed] # What to do about the findings diff --git a/dist/tools/cppcheck/check.sh b/dist/tools/cppcheck/check.sh index 065552a3d6..d8de0c5f9f 100755 --- a/dist/tools/cppcheck/check.sh +++ b/dist/tools/cppcheck/check.sh @@ -1,6 +1,14 @@ #!/bin/sh -CHECKROOT=$(dirname "${0}") +# Don't show warnings about unusedStructMembers by default +DEFAULT_SUPPRESSIONS="${1}" +if echo "${DEFAULT_SUPPRESSIONS}" | grep -q '^--show-unused-struct'; then + DEFAULT_SUPPRESSIONS="" + shift 1 +else + DEFAULT_SUPPRESSIONS=--suppress="unusedStructMember" +fi + BRANCH=${1} FILEREGEX='\.([sScHh]|cpp)$' @@ -33,6 +41,5 @@ if [ -z "${FILES}" ]; then fi cppcheck --std=c99 --enable=style --force --error-exitcode=2 --quiet -j 8 \ - --inline-suppr --suppressions ${CHECKROOT}/vendor_suppressions.txt \ - --template "{file}:{line}: {severity} ({id}): {message}" \ - ${@} ${FILES} + --template "{file}:{line}: {severity} ({id}): {message}" \ + --inline-suppr ${DEFAULT_SUPPRESSIONS} ${@} ${FILES} diff --git a/dist/tools/cppcheck/vendor_suppressions.txt b/dist/tools/cppcheck/vendor_suppressions.txt deleted file mode 100644 index eb0ed89675..0000000000 --- a/dist/tools/cppcheck/vendor_suppressions.txt +++ /dev/null @@ -1,23 +0,0 @@ -unusedStructMember:boards/chronos/drivers/include/display.h -unusedStructMember:boards/x86-multiboot-common/include/multiboot.h -unusedStructMember:cpu/atmega_common/avr-libc-extra/time.h -unusedStructMember:cpu/cc2538/include/cc2538-gpio.h -unusedStructMember:cpu/cc2538/include/cc2538-uart.h -unusedStructMember:cpu/cc2538/include/gptimer.h -unusedStructMember:cpu/cc2538/include/rfcore.h -unusedStructMember:cpu/cc2538/include/soc-adc.h -unusedStructMember:cpu/cortex-m0_common/include/core_*.h -unusedStructMember:cpu/cortex-m3_common/include/core_*.h -unusedStructMember:cpu/cortex-m4_common/include/core_*.h -unusedStructMember:cpu/lpc1768/include/LPC17xx.h -unusedStructMember:cpu/lpc1768/include/core_cm3.h -unusedStructMember:cpu/sam3x8e/include/sam3x8e.h -unusedStructMember:cpu/samd21/include/component/component_*.h -unusedStructMember:cpu/samd21/include/samd21.h -unusedStructMember:cpu/stm32f0/include/stm32f051x8.h -unusedStructMember:cpu/stm32f1/include/stm32f10x.h -unusedStructMember:cpu/stm32f3/include/stm32f303xc.h -unusedStructMember:cpu/stm32f4/include/stm32f407xx.h -unusedStructMember:cpu/stm32f4/include/stm32f415xx.h -unusedStructMember:tests/unittests/embunit/embUnit/RepeatedTest.h -unusedStructMember:tests/unittests/embunit/embUnit/Test*.h