aboutsummaryrefslogtreecommitdiff
path: root/scripts/cppcheck.sh
diff options
context:
space:
mode:
authorKristian Evers <kristianevers@gmail.com>2021-11-01 18:10:16 +0100
committerKristian Evers <kristianevers@gmail.com>2021-11-01 18:10:16 +0100
commit44bf6b4ba9edd46bf6458c3f2f16d7310f4cb332 (patch)
treed47530aeb20395e76847a5b091d7c35b04ff264f /scripts/cppcheck.sh
parenta36272c5946e7b086116815c6699f6ea1d8380ba (diff)
parent3e1cfd2164e5339cbb075c35d7eab4c55cae9bf0 (diff)
downloadPROJ-44bf6b4ba9edd46bf6458c3f2f16d7310f4cb332.tar.gz
PROJ-44bf6b4ba9edd46bf6458c3f2f16d7310f4cb332.zip
Merge remote-tracking branch 'osgeo/master'
Diffstat (limited to 'scripts/cppcheck.sh')
-rwxr-xr-xscripts/cppcheck.sh10
1 files changed, 9 insertions, 1 deletions
diff --git a/scripts/cppcheck.sh b/scripts/cppcheck.sh
index 4e76db94..43ed1af7 100755
--- a/scripts/cppcheck.sh
+++ b/scripts/cppcheck.sh
@@ -17,11 +17,19 @@ esac
TOPDIR="$SCRIPT_DIR/.."
+CPPCHECK_VERSION="$(cppcheck --version | awk '{print $2}')"
+CPPCHECK_VERSION_GT_2_7=$(expr "$CPPCHECK_VERSION" \>= 2.7 || /bin/true)
+if test "$CPPCHECK_VERSION_GT_2_7" = 1; then
+ POSIX="--library=posix"
+else
+ POSIX="--std=posix"
+fi
+
echo "" > ${LOG_FILE}
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 \
+ --enable=all --inconclusive "$POSIX" \
-DCPPCHECK -D__cplusplus=201103L -DNAN \
-I${TOPDIR}/src -I${TOPDIR}/include \
"$dirname" \