LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] kbuild: add some extra warning flags unconditionally
@ 2019-05-09  6:46 Masahiro Yamada
  2019-05-09  7:11 ` Sedat Dilek
  2019-05-09 11:17 ` Nathan Chancellor
  0 siblings, 2 replies; 6+ messages in thread
From: Masahiro Yamada @ 2019-05-09  6:46 UTC (permalink / raw)
  To: linux-kbuild
  Cc: Nick Desaulniers, Nathan Chancellor, Arnd Bergmann,
	clang-built-linux, Masahiro Yamada, Michal Marek, linux-kernel

These flags are documented in the GCC 4.6 manual, and recognized by
Clang as well. Let's rip off the cc-option / cc-disable-warning switches.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---

 scripts/Makefile.extrawarn | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/scripts/Makefile.extrawarn b/scripts/Makefile.extrawarn
index 523c4cafe2dc..3ab8d1a303cd 100644
--- a/scripts/Makefile.extrawarn
+++ b/scripts/Makefile.extrawarn
@@ -23,15 +23,16 @@ warning-  := $(empty)
 warning-1 := -Wextra -Wunused -Wno-unused-parameter
 warning-1 += -Wmissing-declarations
 warning-1 += -Wmissing-format-attribute
-warning-1 += $(call cc-option, -Wmissing-prototypes)
+warning-1 += -Wmissing-prototypes
 warning-1 += -Wold-style-definition
-warning-1 += $(call cc-option, -Wmissing-include-dirs)
+warning-1 += -Wmissing-include-dirs
 warning-1 += $(call cc-option, -Wunused-but-set-variable)
 warning-1 += $(call cc-option, -Wunused-const-variable)
 warning-1 += $(call cc-option, -Wpacked-not-aligned)
 warning-1 += $(call cc-option, -Wstringop-truncation)
-warning-1 += $(call cc-disable-warning, missing-field-initializers)
-warning-1 += $(call cc-disable-warning, sign-compare)
+# The following turn off the warnings enabled by -Wextra
+warning-1 += -Wno-missing-field-initializers
+warning-1 += -Wno-sign-compare
 
 warning-2 := -Waggregate-return
 warning-2 += -Wcast-align
@@ -39,8 +40,8 @@ warning-2 += -Wdisabled-optimization
 warning-2 += -Wnested-externs
 warning-2 += -Wshadow
 warning-2 += $(call cc-option, -Wlogical-op)
-warning-2 += $(call cc-option, -Wmissing-field-initializers)
-warning-2 += $(call cc-option, -Wsign-compare)
+warning-2 += -Wmissing-field-initializers
+warning-2 += -Wsign-compare
 warning-2 += $(call cc-option, -Wmaybe-uninitialized)
 warning-2 += $(call cc-option, -Wunused-macros)
 
-- 
2.17.1


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

* Re: [PATCH] kbuild: add some extra warning flags unconditionally
  2019-05-09  6:46 [PATCH] kbuild: add some extra warning flags unconditionally Masahiro Yamada
@ 2019-05-09  7:11 ` Sedat Dilek
  2019-05-09  7:25   ` Masahiro Yamada
  2019-05-09 11:17 ` Nathan Chancellor
  1 sibling, 1 reply; 6+ messages in thread
From: Sedat Dilek @ 2019-05-09  7:11 UTC (permalink / raw)
  To: Masahiro Yamada
  Cc: linux-kbuild, Nick Desaulniers, Nathan Chancellor, Arnd Bergmann,
	Clang-Built-Linux ML, Michal Marek, linux-kernel

On Thu, May 9, 2019 at 8:47 AM Masahiro Yamada
<yamada.masahiro@socionext.com> wrote:
>
> These flags are documented in the GCC 4.6 manual, and recognized by
> Clang as well. Let's rip off the cc-option / cc-disable-warning switches.
>

BTW, is this a speedup when doing CC/LD FLAGS etc checks unconditionally?
Asking in general - do you have any numbers :-)?

- Sedat -

> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
> ---
>
>  scripts/Makefile.extrawarn | 13 +++++++------
>  1 file changed, 7 insertions(+), 6 deletions(-)
>
> diff --git a/scripts/Makefile.extrawarn b/scripts/Makefile.extrawarn
> index 523c4cafe2dc..3ab8d1a303cd 100644
> --- a/scripts/Makefile.extrawarn
> +++ b/scripts/Makefile.extrawarn
> @@ -23,15 +23,16 @@ warning-  := $(empty)
>  warning-1 := -Wextra -Wunused -Wno-unused-parameter
>  warning-1 += -Wmissing-declarations
>  warning-1 += -Wmissing-format-attribute
> -warning-1 += $(call cc-option, -Wmissing-prototypes)
> +warning-1 += -Wmissing-prototypes
>  warning-1 += -Wold-style-definition
> -warning-1 += $(call cc-option, -Wmissing-include-dirs)
> +warning-1 += -Wmissing-include-dirs
>  warning-1 += $(call cc-option, -Wunused-but-set-variable)
>  warning-1 += $(call cc-option, -Wunused-const-variable)
>  warning-1 += $(call cc-option, -Wpacked-not-aligned)
>  warning-1 += $(call cc-option, -Wstringop-truncation)
> -warning-1 += $(call cc-disable-warning, missing-field-initializers)
> -warning-1 += $(call cc-disable-warning, sign-compare)
> +# The following turn off the warnings enabled by -Wextra
> +warning-1 += -Wno-missing-field-initializers
> +warning-1 += -Wno-sign-compare
>
>  warning-2 := -Waggregate-return
>  warning-2 += -Wcast-align
> @@ -39,8 +40,8 @@ warning-2 += -Wdisabled-optimization
>  warning-2 += -Wnested-externs
>  warning-2 += -Wshadow
>  warning-2 += $(call cc-option, -Wlogical-op)
> -warning-2 += $(call cc-option, -Wmissing-field-initializers)
> -warning-2 += $(call cc-option, -Wsign-compare)
> +warning-2 += -Wmissing-field-initializers
> +warning-2 += -Wsign-compare
>  warning-2 += $(call cc-option, -Wmaybe-uninitialized)
>  warning-2 += $(call cc-option, -Wunused-macros)
>
> --
> 2.17.1
>
> --
> You received this message because you are subscribed to the Google Groups "Clang Built Linux" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to clang-built-linux+unsubscribe@googlegroups.com.
> To post to this group, send email to clang-built-linux@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/clang-built-linux/20190509064635.1445-1-yamada.masahiro%40socionext.com.
> For more options, visit https://groups.google.com/d/optout.

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

* Re: [PATCH] kbuild: add some extra warning flags unconditionally
  2019-05-09  7:11 ` Sedat Dilek
@ 2019-05-09  7:25   ` Masahiro Yamada
  2019-05-09 16:47     ` Nick Desaulniers
  0 siblings, 1 reply; 6+ messages in thread
From: Masahiro Yamada @ 2019-05-09  7:25 UTC (permalink / raw)
  To: Sedat Dilek
  Cc: Linux Kbuild mailing list, Nick Desaulniers, Nathan Chancellor,
	Arnd Bergmann, Clang-Built-Linux ML, Michal Marek,
	Linux Kernel Mailing List

On Thu, May 9, 2019 at 4:11 PM Sedat Dilek <sedat.dilek@gmail.com> wrote:
>
> On Thu, May 9, 2019 at 8:47 AM Masahiro Yamada
> <yamada.masahiro@socionext.com> wrote:
> >
> > These flags are documented in the GCC 4.6 manual, and recognized by
> > Clang as well. Let's rip off the cc-option / cc-disable-warning switches.
> >
>
> BTW, is this a speedup when doing CC/LD FLAGS etc checks unconditionally?

Yes.
cc-option is somewhat costly because it invoked the compiler to
check if the given flag is supported.

So, I want to get rid of as many cc-option calls as possible.


> Asking in general - do you have any numbers :-)?

Removing a couple of cc-options does not make
a measurable difference in general use-cases.

But, this might be more beneficial for chrome OS
because $(CC) is a wrapper and invoking it is much more expensive.




>
> - Sedat -
>
> > Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
> > ---
> >
> >  scripts/Makefile.extrawarn | 13 +++++++------
> >  1 file changed, 7 insertions(+), 6 deletions(-)
> >
> > diff --git a/scripts/Makefile.extrawarn b/scripts/Makefile.extrawarn
> > index 523c4cafe2dc..3ab8d1a303cd 100644
> > --- a/scripts/Makefile.extrawarn
> > +++ b/scripts/Makefile.extrawarn
> > @@ -23,15 +23,16 @@ warning-  := $(empty)
> >  warning-1 := -Wextra -Wunused -Wno-unused-parameter
> >  warning-1 += -Wmissing-declarations
> >  warning-1 += -Wmissing-format-attribute
> > -warning-1 += $(call cc-option, -Wmissing-prototypes)
> > +warning-1 += -Wmissing-prototypes
> >  warning-1 += -Wold-style-definition
> > -warning-1 += $(call cc-option, -Wmissing-include-dirs)
> > +warning-1 += -Wmissing-include-dirs
> >  warning-1 += $(call cc-option, -Wunused-but-set-variable)
> >  warning-1 += $(call cc-option, -Wunused-const-variable)
> >  warning-1 += $(call cc-option, -Wpacked-not-aligned)
> >  warning-1 += $(call cc-option, -Wstringop-truncation)
> > -warning-1 += $(call cc-disable-warning, missing-field-initializers)
> > -warning-1 += $(call cc-disable-warning, sign-compare)
> > +# The following turn off the warnings enabled by -Wextra
> > +warning-1 += -Wno-missing-field-initializers
> > +warning-1 += -Wno-sign-compare
> >
> >  warning-2 := -Waggregate-return
> >  warning-2 += -Wcast-align
> > @@ -39,8 +40,8 @@ warning-2 += -Wdisabled-optimization
> >  warning-2 += -Wnested-externs
> >  warning-2 += -Wshadow
> >  warning-2 += $(call cc-option, -Wlogical-op)
> > -warning-2 += $(call cc-option, -Wmissing-field-initializers)
> > -warning-2 += $(call cc-option, -Wsign-compare)
> > +warning-2 += -Wmissing-field-initializers
> > +warning-2 += -Wsign-compare
> >  warning-2 += $(call cc-option, -Wmaybe-uninitialized)
> >  warning-2 += $(call cc-option, -Wunused-macros)
> >
> > --
> > 2.17.1
> >
> > --
> > You received this message because you are subscribed to the Google Groups "Clang Built Linux" group.
> > To unsubscribe from this group and stop receiving emails from it, send an email to clang-built-linux+unsubscribe@googlegroups.com.
> > To post to this group, send email to clang-built-linux@googlegroups.com.
> > To view this discussion on the web visit https://groups.google.com/d/msgid/clang-built-linux/20190509064635.1445-1-yamada.masahiro%40socionext.com.
> > For more options, visit https://groups.google.com/d/optout.



-- 
Best Regards
Masahiro Yamada

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

* Re: [PATCH] kbuild: add some extra warning flags unconditionally
  2019-05-09  6:46 [PATCH] kbuild: add some extra warning flags unconditionally Masahiro Yamada
  2019-05-09  7:11 ` Sedat Dilek
@ 2019-05-09 11:17 ` Nathan Chancellor
  1 sibling, 0 replies; 6+ messages in thread
From: Nathan Chancellor @ 2019-05-09 11:17 UTC (permalink / raw)
  To: Masahiro Yamada
  Cc: linux-kbuild, Nick Desaulniers, Arnd Bergmann, clang-built-linux,
	Michal Marek, linux-kernel

On Thu, May 09, 2019 at 03:46:35PM +0900, Masahiro Yamada wrote:
> These flags are documented in the GCC 4.6 manual, and recognized by
> Clang as well. Let's rip off the cc-option / cc-disable-warning switches.
> 
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

Reviewed-by: Nathan Chancellor <natechancellor@gmail.com>

> ---
> 
>  scripts/Makefile.extrawarn | 13 +++++++------
>  1 file changed, 7 insertions(+), 6 deletions(-)
> 
> diff --git a/scripts/Makefile.extrawarn b/scripts/Makefile.extrawarn
> index 523c4cafe2dc..3ab8d1a303cd 100644
> --- a/scripts/Makefile.extrawarn
> +++ b/scripts/Makefile.extrawarn
> @@ -23,15 +23,16 @@ warning-  := $(empty)
>  warning-1 := -Wextra -Wunused -Wno-unused-parameter
>  warning-1 += -Wmissing-declarations
>  warning-1 += -Wmissing-format-attribute
> -warning-1 += $(call cc-option, -Wmissing-prototypes)
> +warning-1 += -Wmissing-prototypes
>  warning-1 += -Wold-style-definition
> -warning-1 += $(call cc-option, -Wmissing-include-dirs)
> +warning-1 += -Wmissing-include-dirs
>  warning-1 += $(call cc-option, -Wunused-but-set-variable)
>  warning-1 += $(call cc-option, -Wunused-const-variable)
>  warning-1 += $(call cc-option, -Wpacked-not-aligned)
>  warning-1 += $(call cc-option, -Wstringop-truncation)
> -warning-1 += $(call cc-disable-warning, missing-field-initializers)
> -warning-1 += $(call cc-disable-warning, sign-compare)
> +# The following turn off the warnings enabled by -Wextra
> +warning-1 += -Wno-missing-field-initializers
> +warning-1 += -Wno-sign-compare
>  
>  warning-2 := -Waggregate-return
>  warning-2 += -Wcast-align
> @@ -39,8 +40,8 @@ warning-2 += -Wdisabled-optimization
>  warning-2 += -Wnested-externs
>  warning-2 += -Wshadow
>  warning-2 += $(call cc-option, -Wlogical-op)
> -warning-2 += $(call cc-option, -Wmissing-field-initializers)
> -warning-2 += $(call cc-option, -Wsign-compare)
> +warning-2 += -Wmissing-field-initializers
> +warning-2 += -Wsign-compare
>  warning-2 += $(call cc-option, -Wmaybe-uninitialized)
>  warning-2 += $(call cc-option, -Wunused-macros)
>  
> -- 
> 2.17.1
> 

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

* Re: [PATCH] kbuild: add some extra warning flags unconditionally
  2019-05-09  7:25   ` Masahiro Yamada
@ 2019-05-09 16:47     ` Nick Desaulniers
  2019-05-13  2:23       ` Masahiro Yamada
  0 siblings, 1 reply; 6+ messages in thread
From: Nick Desaulniers @ 2019-05-09 16:47 UTC (permalink / raw)
  To: Masahiro Yamada
  Cc: Sedat Dilek, Linux Kbuild mailing list, Nathan Chancellor,
	Arnd Bergmann, Clang-Built-Linux ML, Michal Marek,
	Linux Kernel Mailing List, chromeos-toolchain, Android-LLVM

From: Masahiro Yamada <yamada.masahiro@socionext.com>
> On Thu, May 9, 2019 at 4:11 PM Sedat Dilek <sedat.dilek@gmail.com> wrote:
> > BTW, is this a speedup when doing CC/LD FLAGS etc checks unconditionally?
>
> Yes.
> cc-option is somewhat costly because it invoked the compiler to
> check if the given flag is supported.
>
> So, I want to get rid of as many cc-option calls as possible.
>
>
> > Asking in general - do you have any numbers :-)?
>
> Removing a couple of cc-options does not make
> a measurable difference in general use-cases.
>
> But, this might be more beneficial for chrome OS
> because $(CC) is a wrapper and invoking it is much more expensive.

Android does too, which we plan on removing as we recently measured
the performance cost of 5% for having a Python wrapper to aid in
bisection.

Anyways, I checked these options with clang 4 and gcc 4.6.4 in godbolt.
Tested-by: Nick Desaulniers <ndesaulniers@google.com>
-- 
Thanks,
~Nick Desaulniers

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

* Re: [PATCH] kbuild: add some extra warning flags unconditionally
  2019-05-09 16:47     ` Nick Desaulniers
@ 2019-05-13  2:23       ` Masahiro Yamada
  0 siblings, 0 replies; 6+ messages in thread
From: Masahiro Yamada @ 2019-05-13  2:23 UTC (permalink / raw)
  To: Nick Desaulniers
  Cc: Sedat Dilek, Linux Kbuild mailing list, Nathan Chancellor,
	Arnd Bergmann, Clang-Built-Linux ML, Michal Marek,
	Linux Kernel Mailing List, chromeos-toolchain, Android-LLVM

On Fri, May 10, 2019 at 1:47 AM Nick Desaulniers
<ndesaulniers@google.com> wrote:
>
> From: Masahiro Yamada <yamada.masahiro@socionext.com>
> > On Thu, May 9, 2019 at 4:11 PM Sedat Dilek <sedat.dilek@gmail.com> wrote:
> > > BTW, is this a speedup when doing CC/LD FLAGS etc checks unconditionally?
> >
> > Yes.
> > cc-option is somewhat costly because it invoked the compiler to
> > check if the given flag is supported.
> >
> > So, I want to get rid of as many cc-option calls as possible.
> >
> >
> > > Asking in general - do you have any numbers :-)?
> >
> > Removing a couple of cc-options does not make
> > a measurable difference in general use-cases.
> >
> > But, this might be more beneficial for chrome OS
> > because $(CC) is a wrapper and invoking it is much more expensive.
>
> Android does too, which we plan on removing as we recently measured
> the performance cost of 5% for having a Python wrapper to aid in
> bisection.
>
> Anyways, I checked these options with clang 4 and gcc 4.6.4 in godbolt.
> Tested-by: Nick Desaulniers <ndesaulniers@google.com>
> --
> Thanks,
> ~Nick Desaulniers

Applied to linux-kbuild.


-- 
Best Regards
Masahiro Yamada

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

end of thread, other threads:[~2019-05-13  2:24 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-09  6:46 [PATCH] kbuild: add some extra warning flags unconditionally Masahiro Yamada
2019-05-09  7:11 ` Sedat Dilek
2019-05-09  7:25   ` Masahiro Yamada
2019-05-09 16:47     ` Nick Desaulniers
2019-05-13  2:23       ` Masahiro Yamada
2019-05-09 11:17 ` Nathan Chancellor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).