If a header test fails, the output should not be updated.
Otherwise the next make invocation will not rerun the test.
Also headers_check.pl should only run if the syntax check invocation
before succeeded.
Add explicit sequencening.
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
---
usr/include/Makefile | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/usr/include/Makefile b/usr/include/Makefile
index c7f164952b33acf6c7b8eb7ce91cd192bfc39ad2..6868d183f36d532cd3d4023b936c67b8a58a9ba5 100644
--- a/usr/include/Makefile
+++ b/usr/include/Makefile
@@ -81,8 +81,8 @@ always-y := $(patsubst $(obj)/%.h,%.hdrtest, $(shell find $(obj) -name '*.h' 2>/
quiet_cmd_hdrtest = HDRTEST $<
cmd_hdrtest = \
$(CC) $(c_flags) -fsyntax-only -x c /dev/null \
- $(if $(filter-out $(no-header-test), $*.h), -include $< -include $<); \
- $(PERL) $(src)/headers_check.pl $(obj) $<; \
+ $(if $(filter-out $(no-header-test), $*.h), -include $< -include $<) && \
+ $(PERL) $(src)/headers_check.pl $(obj) $< && \
touch $@
$(obj)/%.hdrtest: $(obj)/%.h $(src)/headers_check.pl FORCE
--
2.50.1
On Tue, Aug 12, 2025 at 2:33 PM Thomas Weißschuh <thomas.weissschuh@linutronix.de> wrote: > > If a header test fails, the output should not be updated. > Otherwise the next make invocation will not rerun the test. > > Also headers_check.pl should only run if the syntax check invocation > before succeeded. > > Add explicit sequencening. Did you test this? See scripts/Kbuild.include line 153 The macro 'cmd' has "set -e". Any single error in a series of commands bails out. > > Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de> > --- > usr/include/Makefile | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/usr/include/Makefile b/usr/include/Makefile > index c7f164952b33acf6c7b8eb7ce91cd192bfc39ad2..6868d183f36d532cd3d4023b936c67b8a58a9ba5 100644 > --- a/usr/include/Makefile > +++ b/usr/include/Makefile > @@ -81,8 +81,8 @@ always-y := $(patsubst $(obj)/%.h,%.hdrtest, $(shell find $(obj) -name '*.h' 2>/ > quiet_cmd_hdrtest = HDRTEST $< > cmd_hdrtest = \ > $(CC) $(c_flags) -fsyntax-only -x c /dev/null \ > - $(if $(filter-out $(no-header-test), $*.h), -include $< -include $<); \ > - $(PERL) $(src)/headers_check.pl $(obj) $<; \ > + $(if $(filter-out $(no-header-test), $*.h), -include $< -include $<) && \ > + $(PERL) $(src)/headers_check.pl $(obj) $< && \ > touch $@ > > $(obj)/%.hdrtest: $(obj)/%.h $(src)/headers_check.pl FORCE > > -- > 2.50.1 > > -- Best Regards Masahiro Yamada
On Wed, Aug 13, 2025 at 09:29:31AM +0900, Masahiro Yamada wrote: > On Tue, Aug 12, 2025 at 2:33 PM Thomas Weißschuh > <thomas.weissschuh@linutronix.de> wrote: > > > > If a header test fails, the output should not be updated. > > Otherwise the next make invocation will not rerun the test. > > > > Also headers_check.pl should only run if the syntax check invocation > > before succeeded. > > > > Add explicit sequencening. > > Did you test this? > > See scripts/Kbuild.include line 153 > > The macro 'cmd' has "set -e". > > Any single error in a series of commands > bails out. Ah thanks! Yes, for me it works correct w/o the patch. I was struggling with this: If I apply this patch, make no more forwards the error code if headers_check.pl exits with error. It's actually a bit funny: W/o this patch, we have a command sequence like: set -e; date ; false ; true; date which bails out at false at stops processing subsequent commands. Replacing the semicolons by '&&' set -e; date && false && true; date will prevent 'true' to be run, but the trailing 'date' will still be executed. Kind regards, Nicolas
On Wed, Aug 13, 2025 at 09:29:31AM +0900, Masahiro Yamada wrote: > On Tue, Aug 12, 2025 at 2:33 PM Thomas Weißschuh > <thomas.weissschuh@linutronix.de> wrote: > > > > If a header test fails, the output should not be updated. > > Otherwise the next make invocation will not rerun the test. > > > > Also headers_check.pl should only run if the syntax check invocation > > before succeeded. > > > > Add explicit sequencening. > > Did you test this? At least I thought so. > See scripts/Kbuild.include line 153 > > The macro 'cmd' has "set -e". > > Any single error in a series of commands > bails out. Indeed, this patch is pointless. I will drop it. Thanks! > > > > Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de> > > --- > > usr/include/Makefile | 4 ++-- > > 1 file changed, 2 insertions(+), 2 deletions(-) > > > > diff --git a/usr/include/Makefile b/usr/include/Makefile > > index c7f164952b33acf6c7b8eb7ce91cd192bfc39ad2..6868d183f36d532cd3d4023b936c67b8a58a9ba5 100644 > > --- a/usr/include/Makefile > > +++ b/usr/include/Makefile > > @@ -81,8 +81,8 @@ always-y := $(patsubst $(obj)/%.h,%.hdrtest, $(shell find $(obj) -name '*.h' 2>/ > > quiet_cmd_hdrtest = HDRTEST $< > > cmd_hdrtest = \ > > $(CC) $(c_flags) -fsyntax-only -x c /dev/null \ > > - $(if $(filter-out $(no-header-test), $*.h), -include $< -include $<); \ > > - $(PERL) $(src)/headers_check.pl $(obj) $<; \ > > + $(if $(filter-out $(no-header-test), $*.h), -include $< -include $<) && \ > > + $(PERL) $(src)/headers_check.pl $(obj) $< && \ > > touch $@ > > > > $(obj)/%.hdrtest: $(obj)/%.h $(src)/headers_check.pl FORCE
© 2016 - 2025 Red Hat, Inc.