aboutgitcodebugslistschat
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2023-09-29 15:50:21 +1000
committerStefano Brivio <sbrivio@redhat.com>2023-10-04 23:24:00 +0200
commit8640d62af719ecb48ed8c8adb31fd99f02a6c49b (patch)
treeb455c407699a024087a3d0e1770c2ee73072d36a
parentc0efa4e97f20848570552286403574bf228b6420 (diff)
downloadpasst-8640d62af719ecb48ed8c8adb31fd99f02a6c49b.tar
passt-8640d62af719ecb48ed8c8adb31fd99f02a6c49b.tar.gz
passt-8640d62af719ecb48ed8c8adb31fd99f02a6c49b.tar.bz2
passt-8640d62af719ecb48ed8c8adb31fd99f02a6c49b.tar.lz
passt-8640d62af719ecb48ed8c8adb31fd99f02a6c49b.tar.xz
passt-8640d62af719ecb48ed8c8adb31fd99f02a6c49b.tar.zst
passt-8640d62af719ecb48ed8c8adb31fd99f02a6c49b.zip
cppcheck: Use "exhaustive" level checking when available
Recent enough cppcheck versions (at least as of cppcheck 2.12) give this error processing conf.c: conf.c:1179:1: information: ValueFlow analysis is limited in conf. Use --check-level=exhaustive if full analysis is wanted. [checkLevelNormal] Adding --check-level=exhaustive doesn't seem to significantly increase the cppcheck run time for us, so enable it when possible, suppressing that warning. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
-rw-r--r--Makefile6
1 files changed, 6 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index af3bc75..941086a 100644
--- a/Makefile
+++ b/Makefile
@@ -278,6 +278,11 @@ clang-tidy: $(SRCS) $(HEADERS)
-config='{CheckOptions: [{key: bugprone-suspicious-string-compare.WarnOnImplicitComparison, value: "false"}]}' \
--warnings-as-errors=* $(SRCS) -- $(filter-out -pie,$(FLAGS) $(CFLAGS) $(CPPFLAGS)) -DCLANG_TIDY_58992
+CPPCHECK_EXHAUSTIVE :=
+ifeq ($(shell cppcheck --check-level=exhaustive /dev/null > /dev/null 2>&1; echo $$?),0)
+ CPPCHECK_EXHAUSTIVE += --check-level=exhaustive
+endif
+
SYSTEM_INCLUDES := /usr/include $(wildcard /usr/include/$(TARGET))
ifeq ($(shell $(CC) -v 2>&1 | grep -c "gcc version"),1)
VER := $(shell $(CC) -dumpversion)
@@ -286,6 +291,7 @@ endif
cppcheck: $(SRCS) $(HEADERS)
cppcheck --std=c11 --error-exitcode=1 --enable=all --force \
--inconclusive --library=posix --quiet \
+ $(CPPCHECK_EXHAUSTIVE) \
$(SYSTEM_INCLUDES:%=-I%) \
$(SYSTEM_INCLUDES:%=--config-exclude=%) \
$(SYSTEM_INCLUDES:%=--suppress=*:%/*) \