Skip to content
Snippets Groups Projects
Commit 9a907c70 authored by Martine Lenders's avatar Martine Lenders Committed by GitHub
Browse files

Merge pull request #6019 from x3ro/refactor-cppcheck-script

dist/tools/cppcheck: Improve cmdline parameter handling
parents 7c1c6ac2 556baf07
No related branches found
No related tags found
No related merge requests found
...@@ -19,7 +19,28 @@ else ...@@ -19,7 +19,28 @@ else
DEFAULT_SUPPRESSIONS=--suppress="unusedStructMember" DEFAULT_SUPPRESSIONS=--suppress="unusedStructMember"
fi 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 if [ -z "${FILES}" ]; then
exit exit
...@@ -28,4 +49,4 @@ fi ...@@ -28,4 +49,4 @@ fi
# TODO: switch back to 8 jobs when/if cppcheck issue is resolved # TODO: switch back to 8 jobs when/if cppcheck issue is resolved
cppcheck --std=c99 --enable=style --force --error-exitcode=2 --quiet -j 1 \ cppcheck --std=c99 --enable=style --force --error-exitcode=2 --quiet -j 1 \
--template "{file}:{line}: {severity} ({id}): {message}" \ --template "{file}:{line}: {severity} ({id}): {message}" \
--inline-suppr ${DEFAULT_SUPPRESSIONS} ${@} ${FILES} --inline-suppr ${DEFAULT_SUPPRESSIONS} ${CPPCHECK_OPTIONS} ${@} ${FILES}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment