diff options
| author | Even Rouault <even.rouault@spatialys.com> | 2021-10-30 23:39:37 +0200 |
|---|---|---|
| committer | Even Rouault <even.rouault@spatialys.com> | 2021-10-31 10:51:15 +0100 |
| commit | e4c797a6ed260d74e558ac60fd8069b6f7ac9cc3 (patch) | |
| tree | 4d4e17f1e31ade9b929d241722e9ec2b9b7a85e5 /scripts/cppcheck.sh | |
| parent | 0fe32d249fd3801429fa08a057639128d99c5e45 (diff) | |
| download | PROJ-e4c797a6ed260d74e558ac60fd8069b6f7ac9cc3.tar.gz PROJ-e4c797a6ed260d74e558ac60fd8069b6f7ac9cc3.zip | |
cppcheck.sh: make it compatible with cppcheck 2.7
Diffstat (limited to 'scripts/cppcheck.sh')
| -rwxr-xr-x | scripts/cppcheck.sh | 10 |
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" \ |
