Skip to contentSkip to conversation

ftrace: Build with CPPFLAGS to get -Qunused-arguments

PATCH In review Joel Stanley 3 participants 3 messages Sep 17, 2018 – Sep 19, 2018 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ftrace: Build with CPPFLAGS to get -Qunused-arguments

When building to record the mcount locations the kernel uses KBUILD_CFLAGS but not KBUILD_CPPFLAGS. This means it lacks -Qunused-arguments when building with clang, resulting in a lot of noisy warnings.

---
Not sure why -Qunused-arguments is in CPP instead of KBUILD_CFLAGS. We could instead put it in KBUILD_CFLAGS, and not need this patch.

 scripts/Makefile.build | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/Makefile.build +1 -1
index 5a2d1c9578a0..54da4b070db3 100644
@@ -219,7 +219,7 @@ else
 sub_cmd_record_mcount = set -e ; perl $(srctree)/scripts/recordmcount.pl "$(ARCH)" \
 	"$(if $(CONFIG_CPU_BIG_ENDIAN),big,little)" \
 	"$(if $(CONFIG_64BIT),64,32)" \
-	"$(OBJDUMP)" "$(OBJCOPY)" "$(CC) $(KBUILD_CFLAGS)" \
+	"$(OBJDUMP)" "$(OBJCOPY)" "$(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS)" \
 	"$(LD) $(KBUILD_LDFLAGS)" "$(NM)" "$(RM)" "$(MV)" \
 	"$(if $(part-of-module),1,0)" "$(@)";
 recordmcount_source := $(srctree)/scripts/recordmcount.pl
Signature · 1 line
2.17.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 10 lines · Joel Stanley

When building to record the mcount locations the kernel uses KBUILD_CFLAGS but not KBUILD_CPPFLAGS. This means it lacks -Qunused-arguments when building with clang, resulting in a lot of noisy warnings.

---
Not sure why -Qunused-arguments is in CPP instead of KBUILD_CFLAGS. We could instead put it in KBUILD_CFLAGS, and not need this patch.

The preprocessor has flags that can change the definitions of macros. So there might be unused flags there. I'm not a fan of covering up those warnings via -Qunused-arguments; the flags should be feature detected via cc-option and friends rather than always added then silenced if excessive. That hides flags that are long dead/unused.

Thanks for this patch!

Quoted 20 lines
 scripts/Makefile.build | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/Makefile.build +1 -2
index 5a2d1c9578a0..54da4b070db3 100644
@@ -219,7 +219,7 @@ else
 sub_cmd_record_mcount = set -e ; perl $(srctree)/scripts/recordmcount.pl "$(ARCH)" \
        "$(if $(CONFIG_CPU_BIG_ENDIAN),big,little)" \
        "$(if $(CONFIG_64BIT),64,32)" \
-       "$(OBJDUMP)" "$(OBJCOPY)" "$(CC) $(KBUILD_CFLAGS)" \
+       "$(OBJDUMP)" "$(OBJCOPY)" "$(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS)" \
        "$(LD) $(KBUILD_LDFLAGS)" "$(NM)" "$(RM)" "$(MV)" \
        "$(if $(part-of-module),1,0)" "$(@)";
 recordmcount_source := $(srctree)/scripts/recordmcount.pl
--

2.17.1

Signature · 2 lines
Thanks,
~Nick Desaulniers
#2 lore raw

2018-09-18 2:24 GMT+09:00 Nick Desaulniers <[email protected]>:

Quoted 12 lines · Joel Stanley
Quoted 10 lines

When building to record the mcount locations the kernel uses KBUILD_CFLAGS but not KBUILD_CPPFLAGS. This means it lacks -Qunused-arguments when building with clang, resulting in a lot of noisy warnings.

---
Not sure why -Qunused-arguments is in CPP instead of KBUILD_CFLAGS. We could instead put it in KBUILD_CFLAGS, and not need this patch.

Quoted 13 lines

The preprocessor has flags that can change the definitions of macros. So there might be unused flags there. I'm not a fan of covering up those warnings via -Qunused-arguments; the flags should be feature detected via cc-option and friends rather than always added then silenced if excessive. That hides flags that are long dead/unused.

Thanks for this patch!

Quoted 4 lines
 scripts/Makefile.build | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Applied to linux-kbuild/fixes. Thanks!

Signature · 2 lines
Best Regards
Masahiro Yamada