diff options
| author | Even Rouault <even.rouault@spatialys.com> | 2021-10-31 13:13:45 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-10-31 13:13:45 +0100 |
| commit | 3e1cfd2164e5339cbb075c35d7eab4c55cae9bf0 (patch) | |
| tree | 7c3503671443b34365ddacea300a448e0c943a8c | |
| parent | a892e23d9a444e86b35fc67d0fb84e4acca05c2f (diff) | |
| parent | e4c797a6ed260d74e558ac60fd8069b6f7ac9cc3 (diff) | |
| download | PROJ-3e1cfd2164e5339cbb075c35d7eab4c55cae9bf0.tar.gz PROJ-3e1cfd2164e5339cbb075c35d7eab4c55cae9bf0.zip | |
Merge pull request #2916 from rouault/cppcheck_2_7
cppcheck.sh: make it compatible with cppcheck 2.7
| -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" \ |
