aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xscripts/cppcheck.sh18
1 files changed, 16 insertions, 2 deletions
diff --git a/scripts/cppcheck.sh b/scripts/cppcheck.sh
index df939c06..f1e19f81 100755
--- a/scripts/cppcheck.sh
+++ b/scripts/cppcheck.sh
@@ -4,13 +4,27 @@
LOG_FILE=/tmp/cppcheck_proj.txt
+SCRIPT_DIR=$(dirname "$0")
+case $SCRIPT_DIR in
+ "/"*)
+ ;;
+ ".")
+ SCRIPT_DIR=$(pwd)
+ ;;
+ *)
+ SCRIPT_DIR=$(pwd)/$(dirname "$0")
+ ;;
+esac
+
+TOPDIR="$SCRIPT_DIR/.."
+
echo "" > ${LOG_FILE}
-for dirname in src; do
+for dirname in ${TOPDIR}/src; do
echo "Running cppcheck on $dirname... (can be long)"
if ! cppcheck --inline-suppr --template='{file}:{line},{severity},{id},{message}' \
--enable=all --inconclusive --std=posix \
-DCPPCHECK \
- $dirname \
+ "$dirname" \
-j 8 >>${LOG_FILE} 2>&1 ; then
echo "cppcheck failed"
exit 1