2014-07-16 13:51:13 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
2017-04-20 12:03:07 +02:00
|
|
|
# Copyright 2017 Kaspar Schleiser <kaspar@schleiser.de>
|
2015-09-27 18:58:30 +02:00
|
|
|
# Copyright 2014 Ludwig Knüpfer <ludwig.knuepfer@fu-berlin.de>
|
2014-11-28 18:02:49 +01:00
|
|
|
# Copyright 2014 Hinnerk van Bruinehsen <h.v.bruinehsen@fu-berlin.de>
|
|
|
|
#
|
|
|
|
# This file is subject to the terms and conditions of the GNU Lesser
|
|
|
|
# General Public License v2.1. See the file LICENSE in the top level
|
|
|
|
# directory for more details.
|
|
|
|
|
2018-06-05 17:06:11 +02:00
|
|
|
: "${RIOTBASE:=$(cd $(dirname $0)/../../../; pwd)}"
|
|
|
|
cd $RIOTBASE
|
|
|
|
|
|
|
|
: "${RIOTTOOLS:=${RIOTBASE}/dist/tools}"
|
2018-03-22 17:21:09 +01:00
|
|
|
. "${RIOTTOOLS}"/ci/changed_files.sh
|
2017-04-20 12:03:07 +02:00
|
|
|
|
2014-11-19 09:37:07 +01:00
|
|
|
# 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
|
|
|
|
|
2017-10-10 19:56:00 +02:00
|
|
|
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
|
2015-05-22 11:46:36 +02:00
|
|
|
|
2014-07-16 13:51:13 +02:00
|
|
|
if [ -z "${FILES}" ]; then
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
2017-04-25 19:31:02 +02:00
|
|
|
# TODO: switch back to 8 jobs when/if cppcheck issue is resolved
|
|
|
|
cppcheck --std=c99 --enable=style --force --error-exitcode=2 --quiet -j 1 \
|
2014-11-19 09:37:07 +01:00
|
|
|
--template "{file}:{line}: {severity} ({id}): {message}" \
|
2017-10-10 19:56:00 +02:00
|
|
|
--inline-suppr ${DEFAULT_SUPPRESSIONS} ${CPPCHECK_OPTIONS} ${@} ${FILES}
|