aboutgitcodebugslistschat
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2024-11-08 13:53:30 +1100
committerStefano Brivio <sbrivio@redhat.com>2024-11-08 08:26:21 +0100
commit0588163b1f981a3ef87a9a3fe155dc2f0e116e18 (patch)
tree56ba44c8897dc7dc85764f667383776494501a6b
parent14dd70e2b33941f1f7663969574278873c9e3d35 (diff)
downloadpasst-0588163b1f981a3ef87a9a3fe155dc2f0e116e18.tar
passt-0588163b1f981a3ef87a9a3fe155dc2f0e116e18.tar.gz
passt-0588163b1f981a3ef87a9a3fe155dc2f0e116e18.tar.bz2
passt-0588163b1f981a3ef87a9a3fe155dc2f0e116e18.tar.lz
passt-0588163b1f981a3ef87a9a3fe155dc2f0e116e18.tar.xz
passt-0588163b1f981a3ef87a9a3fe155dc2f0e116e18.tar.zst
passt-0588163b1f981a3ef87a9a3fe155dc2f0e116e18.zip
cppcheck: Don't check the system headers
We pass -I options to cppcheck so that it will find the system headers. Then we need to pass a bunch more options to suppress the zillions of cppcheck errors found in those headers. It turns out, however, that it's not recommended to give the system headers to cppcheck anyway. Instead it has built-in knowledge of the ANSI libc and uses that as the basis of its checks. We do need to suppress missingIncludeSystem warnings instead though. Not bothering with the system headers makes the cppcheck runtime go from ~37s to ~14s on my machine, which is a pretty nice win. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
-rw-r--r--Makefile10
1 files changed, 1 insertions, 9 deletions
diff --git a/Makefile b/Makefile
index 0ba85b4..258d298 100644
--- a/Makefile
+++ b/Makefile
@@ -163,11 +163,6 @@ clang-tidy: $(PASST_SRCS) $(HEADERS)
clang-tidy $(PASST_SRCS) -- $(filter-out -pie,$(FLAGS) $(CFLAGS) $(CPPFLAGS)) \
-DCLANG_TIDY_58992
-SYSTEM_INCLUDES := /usr/include $(wildcard /usr/include/$(TARGET))
-ifeq ($(shell $(CC) -v 2>&1 | grep -c "gcc version"),1)
-VER := $(shell $(CC) -dumpversion)
-SYSTEM_INCLUDES += /usr/lib/gcc/$(TARGET)/$(VER)/include
-endif
cppcheck: $(PASST_SRCS) $(HEADERS)
if cppcheck --check-level=exhaustive /dev/null > /dev/null 2>&1; then \
CPPCHECK_EXHAUSTIVE="--check-level=exhaustive"; \
@@ -177,11 +172,8 @@ cppcheck: $(PASST_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=*:%/*) \
- $(SYSTEM_INCLUDES:%=--suppress=unmatchedSuppression:%/*) \
--inline-suppr \
+ --suppress=missingIncludeSystem \
--suppress=unusedStructMember \
$(filter -D%,$(FLAGS) $(CFLAGS) $(CPPFLAGS)) -D CPPCHECK_6936 \
$(PASST_SRCS) $(HEADERS)