7 # CC=extra/scripts/cppcheck.sh \
8 # CPPCHECK_FLAGS="--enable=style,performance,portability,information,missingInclude --max-configs=256 -j $(($(getconf _NPROCESSORS_ONLN)-1))" \
11 # CPPCHECK_FLAGS are optional and are not set per default.
12 # CPPCHECK_LIMIT limits cppcheck to the -D and -U that would be passed to CC.
13 # Setting CPPCHECK_LIMIT greatly improves the check-time but obviously
14 # just checks a small subset of the defines found in a file.
25 if [ $next_arg -eq 1 ] ; then
30 [ "x$args" = "x" ] && args="$i" || args="$args $i"
33 if [ $next_limit -eq 1 ] ; then
35 [ "x$limits" = "x" ] && limits="$i" || limits="$limits $i"
42 [ "x$args" = "x" ] && args="-I" || args="$args -I" ;;
45 [ "x$args" = "x" ] && args="$i" || args="$args $i" ;;
46 /-I*) [ "x$args" = "x" ] && args="$i" || args="$args $i" ;;
49 [ "x$limit" = "x" ] && limit="$i" || limit="$limit $i" ;;
50 /-D*) [ "x$limits" = "x" ] && limits="$i" || limits="$limits $i" ;;
51 /-s|/-S|/-dump*|/--print*|/-print*) exit 0 ;;
55 [ -z "${CPPCHECK_LIMIT}" ] && limits=""
56 [ -z "${args}" ] || exec cppcheck ${CPPCHECK_FLAGS} ${args} ${limits}