Thread (10 messages) 10 messages, 3 authors, 2021-08-31

[LTP] [PATCH 2/2] Add CHECK_NOFLAGS and checkpatch.pl to 'make check'

From: Richard Palethorpe <hidden>
Date: 2021-08-27 09:52:10
Subsystem: the rest · Maintainer: Linus Torvalds

Add another check command type. CHECK_NOFLAGS just takes the source
file name as an argument. By default it is set to
scripts/checkpatch.pl which is probably the only thing we want to use
it for. OTOH you can set it to clang-tidy instead.

It is run with '-' because of the large number of errors it presently
produces. Also of course, check errors are not actually fatal. If we
wish to stop on errors in the future (e.g. for CI) then a "strict"
option can be introduced.

Signed-off-by: Richard Palethorpe <redacted>
Suggested-by: Cyril Hrubis <chrubis@suse.cz>
---
 include/mk/env_post.mk | 1 +
 include/mk/rules.mk    | 6 ++++--
 2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/include/mk/env_post.mk b/include/mk/env_post.mk
index 4722da907..eb76b38a4 100644
--- a/include/mk/env_post.mk
+++ b/include/mk/env_post.mk
@@ -92,6 +92,7 @@ endif
 CHECK_TARGETS			?= $(addprefix check-,$(notdir $(patsubst %.c,%,$(sort $(wildcard $(abs_srcdir)/*.c)))))
 CHECK_TARGETS			:= $(filter-out $(addprefix check-, $(FILTER_OUT_MAKE_TARGETS)), $(CHECK_TARGETS))
 CHECK				?= $(abs_top_srcdir)/tools/sparse/sparse-ltp
+CHECK_NOFLAGS			?= $(abs_top_srcdir)/scripts/checkpatch.pl -f --no-tree --terse --no-summary --ignore CONST_STRUCT,VOLATILE,SPLIT_STRING
 
 ifeq ($(CHECK),$(abs_top_srcdir)/tools/sparse/sparse-ltp)
 CHECK_DEPS			+= $(CHECK)
diff --git a/include/mk/rules.mk b/include/mk/rules.mk
index 2a04b2b67..6bd184841 100644
--- a/include/mk/rules.mk
+++ b/include/mk/rules.mk
@@ -41,8 +41,10 @@ endif
 .PHONY: $(CHECK_TARGETS)
 $(CHECK_TARGETS): check-%: %.c
 ifdef VERBOSE
-	$(CHECK) $(CHECK_FLAGS) $(CPPFLAGS) $(CFLAGS) $<
+	-$(CHECK_NOFLAGS) $<
+	-$(CHECK) $(CHECK_FLAGS) $(CPPFLAGS) $(CFLAGS) $<
 else
-	@$(CHECK) $(CHECK_FLAGS) $(CPPFLAGS) $(CFLAGS) $<
 	@echo CHECK $(target_rel_dir)$<
+	@-$(CHECK_NOFLAGS) $<
+	@-$(CHECK) $(CHECK_FLAGS) $(CPPFLAGS) $(CFLAGS) $<
 endif
-- 
2.31.1
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help