1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-26 15:03:53 +01:00

dist/tools/cppcheck: Allow individual files to be cppchecked

This commit is contained in:
Lucas Jenss 2017-10-10 10:56:00 -07:00
parent 9964a60759
commit 556baf07a1

View File

@ -19,7 +19,28 @@ else
DEFAULT_SUPPRESSIONS=--suppress="unusedStructMember"
fi
FILES=$(changed_files)
FILES=""
CPPCHECK_OPTIONS=""
IN_FILES_SECTION=false
while [ $# -gt 0 ]; do
if [ "$1" = "--" ]; then
IN_FILES_SECTION=true
shift
continue
fi
if [ "$IN_FILES_SECTION" = false ]; then
CPPCHECK_OPTIONS="${CPPCHECK_OPTIONS} $1"
else
FILES="${FILES} $1"
fi
shift
done
if [ -z "${FILES}" ]; then
FILES=$(changed_files)
fi
if [ -z "${FILES}" ]; then
exit
@ -28,4 +49,4 @@ fi
# TODO: switch back to 8 jobs when/if cppcheck issue is resolved
cppcheck --std=c99 --enable=style --force --error-exitcode=2 --quiet -j 1 \
--template "{file}:{line}: {severity} ({id}): {message}" \
--inline-suppr ${DEFAULT_SUPPRESSIONS} ${@} ${FILES}
--inline-suppr ${DEFAULT_SUPPRESSIONS} ${CPPCHECK_OPTIONS} ${@} ${FILES}