All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ftrace: Build with CPPFLAGS to get -Qunused-arguments
@ 2018-09-17  7:37 Joel Stanley
  2018-09-17 17:24 ` Nick Desaulniers
  0 siblings, 1 reply; 3+ messages in thread
From: Joel Stanley @ 2018-09-17  7:37 UTC (permalink / raw)
  To: Masahiro Yamada, Michal Marek
  Cc: linux-kbuild, linux-kernel, Nick Desaulniers

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.

Signed-off-by: Joel Stanley <joel@jms.id.au>
---
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(-)

diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index 5a2d1c9578a0..54da4b070db3 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] ftrace: Build with CPPFLAGS to get -Qunused-arguments
  2018-09-17  7:37 [PATCH] ftrace: Build with CPPFLAGS to get -Qunused-arguments Joel Stanley
@ 2018-09-17 17:24 ` Nick Desaulniers
  2018-09-19 14:54   ` Masahiro Yamada
  0 siblings, 1 reply; 3+ messages in thread
From: Nick Desaulniers @ 2018-09-17 17:24 UTC (permalink / raw)
  To: joel; +Cc: Masahiro Yamada, Michal Marek, Linux Kbuild mailing list, LKML

On Mon, Sep 17, 2018 at 12:38 AM Joel Stanley <joel@jms.id.au> wrote:
>
> 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.
>
> Signed-off-by: Joel Stanley <joel@jms.id.au>
> ---
> 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!
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>

>
>  scripts/Makefile.build | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/scripts/Makefile.build b/scripts/Makefile.build
> index 5a2d1c9578a0..54da4b070db3 100644
> --- a/scripts/Makefile.build
> +++ b/scripts/Makefile.build
> @@ -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
>


-- 
Thanks,
~Nick Desaulniers

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ftrace: Build with CPPFLAGS to get -Qunused-arguments
  2018-09-17 17:24 ` Nick Desaulniers
@ 2018-09-19 14:54   ` Masahiro Yamada
  0 siblings, 0 replies; 3+ messages in thread
From: Masahiro Yamada @ 2018-09-19 14:54 UTC (permalink / raw)
  To: Nick Desaulniers
  Cc: Joel Stanley, Michal Marek, Linux Kbuild mailing list, LKML

2018-09-18 2:24 GMT+09:00 Nick Desaulniers <ndesaulniers@google.com>:
> On Mon, Sep 17, 2018 at 12:38 AM Joel Stanley <joel@jms.id.au> wrote:
>>
>> 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.
>>
>> Signed-off-by: Joel Stanley <joel@jms.id.au>
>> ---
>> 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!
> Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
>
>>
>>  scripts/Makefile.build | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>


Applied to linux-kbuild/fixes. Thanks!


-- 
Best Regards
Masahiro Yamada

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-09-19 14:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-17  7:37 [PATCH] ftrace: Build with CPPFLAGS to get -Qunused-arguments Joel Stanley
2018-09-17 17:24 ` Nick Desaulniers
2018-09-19 14:54   ` Masahiro Yamada

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.