Skip to contentSkip to conversation

kbuild: run the checker after the compiler

PATCH In review Luc Van Oostenryck 2 participants 2 messages Jun 22, 2020 – Jun 23, 2020 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kbuild: run the checker after the compiler

Since the pre-git time the checker is run first, before the compiler. But if the source file contains some syntax error, the warnings from the compiler are more useful than those from sparse (and other checker most probably too).

So move the 'check' command to run after the compiler.

---
 scripts/Makefile.build | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
scripts/Makefile.build +2 -2
index 2e8810b7e5ed..7ba6a752d5bd 100644
@@ -252,9 +252,9 @@ cmd_gen_ksymdeps = \
 endif
 
 define rule_cc_o_c
-	$(call cmd,checksrc)
 	$(call cmd_and_fixdep,cc_o_c)
 	$(call cmd,gen_ksymdeps)
+	$(call cmd,checksrc)
 	$(call cmd,checkdoc)
 	$(call cmd,objtool)
 	$(call cmd,modversions_c)
@@ -277,8 +277,8 @@ endif
 
 # Built-in and composite module parts
 $(obj)/%.o: $(src)/%.c $(recordmcount_source) $(objtool_dep) FORCE
-	$(call cmd,force_checksrc)
 	$(call if_changed_rule,cc_o_c)
+	$(call cmd,force_checksrc)
 
 cmd_mod = { \
 	echo $(if $($*-objs)$($*-y)$($*-m), $(addprefix $(obj)/, $($*-objs) $($*-y) $($*-m)), $(@:.mod=.o)); \

base-commit: 48778464bb7d346b47157d21ffde2af6b2d39110

Signature · 1 line
2.27.0
#1 lore raw
Quoted 9 lines · Luc Van Oostenryck

Since the pre-git time the checker is run first, before the compiler. But if the source file contains some syntax error, the warnings from the compiler are more useful than those from sparse (and other checker most probably too).

So move the 'check' command to run after the compiler.

Applied to linux-kbuild.
Thanks.

Quoted 34 lines
---
 scripts/Makefile.build | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
scripts/Makefile.build +2 -2
index 2e8810b7e5ed..7ba6a752d5bd 100644
@@ -252,9 +252,9 @@ cmd_gen_ksymdeps = \
 endif
 
 define rule_cc_o_c
-       $(call cmd,checksrc)
        $(call cmd_and_fixdep,cc_o_c)
        $(call cmd,gen_ksymdeps)
+       $(call cmd,checksrc)
        $(call cmd,checkdoc)
        $(call cmd,objtool)
        $(call cmd,modversions_c)
@@ -277,8 +277,8 @@ endif
 
 # Built-in and composite module parts
 $(obj)/%.o: $(src)/%.c $(recordmcount_source) $(objtool_dep) FORCE
-       $(call cmd,force_checksrc)
        $(call if_changed_rule,cc_o_c)
+       $(call cmd,force_checksrc)
 
 cmd_mod = { \
        echo $(if $($*-objs)$($*-y)$($*-m), $(addprefix $(obj)/, $($*-objs) $($*-y) $($*-m)), $(@:.mod=.o)); \

base-commit: 48778464bb7d346b47157d21ffde2af6b2d39110 --
2.27.0

Signature · 2 lines
Best Regards
Masahiro Yamada