Currently we pass all our compiler flags to clang-tidy, except -pie, which
it won't accept. In fact in order to run the checker, we only need the
preprocessor flags. Simplify the command line by passing only those.
For cppcheck we already filter out just -D options from the compiler flags.
Simplify this by only passing preprocessor flags, now that we've split
those out into their own variables. Furthermore, one of cppcheck's
features which we're currently not exploiting is to check multiple / all
preprocessor option combinations in a single pass. Therefore, pass only
$(BASE_CPPFLAGS), which contains the mandatory options with which we can't
compile at all.
While we're there remove a redundant $^ that slipped in at some point.
Signed-off-by: David Gibson
---
Makefile | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/Makefile b/Makefile
index 697f229f..c6dbbc67 100644
--- a/Makefile
+++ b/Makefile
@@ -194,9 +194,7 @@ CLANG_TIDY = clang-tidy
CLANG_TIDY_FLAGS = -DCLANG_TIDY_58992
clang-tidy: $(PASST_SRCS)
- $(CLANG_TIDY) $^ -- \
- $(filter-out -pie,$(BASE_CPPFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) $(CFLAGS)) \
- $(CLANG_TIDY_FLAGS)
+ $(CLANG_TIDY) $^ -- $(BASE_CPPFLAGS) $(CPPFLAGS) $(CLANG_TIDY_FLAGS)
CPPCHECK = cppcheck
CPPCHECK_FLAGS = --std=c11 --error-exitcode=1 --enable=all --force \
@@ -212,6 +210,4 @@ CPPCHECK_FLAGS = --std=c11 --error-exitcode=1 --enable=all --force \
-D CPPCHECK_6936
cppcheck: $(PASST_SRCS) $(PASST_HEADERS) seccomp.h
- $(CPPCHECK) $(CPPCHECK_FLAGS) \
- $(filter -D%,$(BASE_CPPFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) $(CFLAGS)) $^ \
- $^
+ $(CPPCHECK) $(CPPCHECK_FLAGS) $(BASE_CPPFLAGS) $^
--
2.54.0