aboutgitcodebugslistschat
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile32
1 files changed, 31 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index 9e7651b..32cc1d5 100644
--- a/Makefile
+++ b/Makefile
@@ -141,7 +141,7 @@ pkgs:
#
# - bugprone-suspicious-string-compare
# Return value of memcmp(), not really suspicious
-clang-tidy: $(wildcard *.c)
+clang-tidy: $(wildcard *.c) $(wildcard *.h)
clang-tidy -checks=*,-modernize-*,\
-clang-analyzer-valist.Uninitialized,\
-cppcoreguidelines-init-variables,\
@@ -163,3 +163,33 @@ clang-tidy: $(wildcard *.c)
-cppcoreguidelines-avoid-non-const-global-variables,\
-bugprone-suspicious-string-compare \
--warnings-as-errors=* $(wildcard *.c) -- $(CFLAGS)
+
+ifeq ($(shell $(CC) -v 2>&1 | grep -c "gcc version"),1)
+TARGET := $(shell ${CC} -v 2>&1 | sed -n 's/Target: \(.*\)/\1/p')
+VER := $(shell $(CC) -dumpversion)
+EXTRA_INCLUDES := /usr/lib/gcc/$(TARGET)/$(VER)/include
+EXTRA_INCLUDES_OPT := -I$(EXTRA_INCLUDES)
+else
+EXTRA_INCLUDES_OPT :=
+endif
+cppcheck: $(wildcard *.c) $(wildcard *.h)
+ cppcheck --std=c99 --error-exitcode=1 --enable=all --force \
+ --inconclusive --library=posix \
+ -I/usr/include $(EXTRA_INCLUDES_OPT) \
+ --suppress=missingIncludeSystem \
+ --suppress="*:$(EXTRA_INCLUDES)/avx512fintrin.h" \
+ --suppress="*:$(EXTRA_INCLUDES)/xmmintrin.h" \
+ --suppress="*:$(EXTRA_INCLUDES)/emmintrin.h" \
+ --suppress="*:$(EXTRA_INCLUDES)/avxintrin.h" \
+ --suppress="*:$(EXTRA_INCLUDES)/bmiintrin.h" \
+ --suppress=objectIndex:tcp.c --suppress=objectIndex:udp.c \
+ --suppress=va_list_usedBeforeStarted:util.c \
+ --suppress=unusedFunction:igmp.c \
+ --suppress=unusedFunction:siphash.c \
+ --suppress=knownConditionTrueFalse:conf.c \
+ --suppress=strtokCalled:conf.c --suppress=strtokCalled:qrap.c \
+ --suppress=getpwnamCalled:passt.c \
+ --suppress=localtimeCalled:pcap.c \
+ --suppress=unusedStructMember:pcap.c \
+ --suppress=funcArgNamesDifferent:util.h \
+ .