Skip to contentSkip to conversation

kbuild: uapi: use -fsyntax-only rather than -S

PATCH In review Nick Desaulniers 2 participants 2 messages Mar 30, 2022 – Apr 5, 2022 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kbuild: uapi: use -fsyntax-only rather than -S

The UAPI header tests are checking that the generated headers do not have syntax errors. There's no need to run the rest of the compilation pipeline after semantic analysis has run. Replace -S -o /dev/null with -fsyntax-only.

---
 usr/include/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
usr/include/Makefile +1 -1
index 7b283d43f00d..bf193e205dbe 100644
@@ -89,7 +89,7 @@ extra-y := $(patsubst $(obj)/%.h,%.hdrtest, $(shell find $(obj) -name '*.h' 2>/d
 # Include the header twice to detect missing include guard.
 quiet_cmd_hdrtest = HDRTEST $<
       cmd_hdrtest = \
-		$(CC) $(c_flags) -S -o /dev/null -x c /dev/null \
+		$(CC) $(c_flags) -fsyntax-only -x c /dev/null \
 			$(if $(filter-out $(no-header-test), $*.h), -include $< -include $<); \
 		$(PERL) $(srctree)/$(src)/headers_check.pl $(obj) $(SRCARCH) $<; \
 		touch $@

base-commit: 74164d284b2909de0ba13518cc063e9ea9334749

Signature · 1 line
2.35.1.1021.g381101b075-goog
#1 lore raw
Quoted 6 lines · Nick Desaulniers

The UAPI header tests are checking that the generated headers do not have syntax errors. There's no need to run the rest of the compilation pipeline after semantic analysis has run. Replace -S -o /dev/null with -fsyntax-only.

Applied to linux-kbuild.
Thanks.

Quoted 23 lines
---
 usr/include/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
usr/include/Makefile +1 -1
index 7b283d43f00d..bf193e205dbe 100644
@@ -89,7 +89,7 @@ extra-y := $(patsubst $(obj)/%.h,%.hdrtest, $(shell find $(obj) -name '*.h' 2>/d
 # Include the header twice to detect missing include guard.
 quiet_cmd_hdrtest = HDRTEST $<
       cmd_hdrtest = \
-               $(CC) $(c_flags) -S -o /dev/null -x c /dev/null \
+               $(CC) $(c_flags) -fsyntax-only -x c /dev/null \
                        $(if $(filter-out $(no-header-test), $*.h), -include $< -include $<); \
                $(PERL) $(srctree)/$(src)/headers_check.pl $(obj) $(SRCARCH) $<; \
                touch $@

base-commit: 74164d284b2909de0ba13518cc063e9ea9334749 --
2.35.1.1021.g381101b075-goog

Signature · 2 lines
Best Regards
Masahiro Yamada