linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] kbuild: Fix -Wimplicit-fallthrough=5 error for GCC 5.x and 6.x
@ 2021-11-15  1:13 Gustavo A. R. Silva
  2021-11-15  2:07 ` Linus Torvalds
  0 siblings, 1 reply; 2+ messages in thread
From: Gustavo A. R. Silva @ 2021-11-15  1:13 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: Nathan Chancellor, linux-kernel, Gustavo A. R. Silva, linux-hardening

-Wimplicit-fallthrough=5 was under cc-option because it was only
available in GCC 7.x and newer so the build is now broken for GCC 5.x
and 6.x:

gcc: error: unrecognized command line option '-Wimplicit-fallthrough=5';
did you mean '-Wno-fallthrough'?

Fix this by moving -Wimplicit-fallthrough=5 under cc-option.

Reported-by: Nathan Chancellor <nathan@kernel.org>
Co-developed-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
---
 init/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/init/Kconfig b/init/Kconfig
index 036b750e8d8a..85882c317235 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -887,7 +887,7 @@ config CC_HAS_INT128
 
 config CC_IMPLICIT_FALLTHROUGH
 	string
-	default "-Wimplicit-fallthrough=5" if CC_IS_GCC
+	default "-Wimplicit-fallthrough=5" if $(cc-option,-Wimplicit-fallthrough=5)
 	default "-Wimplicit-fallthrough" if CC_IS_CLANG && $(cc-option,-Wunreachable-code-fallthrough)
 
 #
-- 
2.27.0


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

* Re: [PATCH] kbuild: Fix -Wimplicit-fallthrough=5 error for GCC 5.x and 6.x
  2021-11-15  1:13 [PATCH] kbuild: Fix -Wimplicit-fallthrough=5 error for GCC 5.x and 6.x Gustavo A. R. Silva
@ 2021-11-15  2:07 ` Linus Torvalds
  0 siblings, 0 replies; 2+ messages in thread
From: Linus Torvalds @ 2021-11-15  2:07 UTC (permalink / raw)
  To: Gustavo A. R. Silva
  Cc: Nathan Chancellor, Linux Kernel Mailing List, linux-hardening

On Sun, Nov 14, 2021 at 5:08 PM Gustavo A. R. Silva
<gustavoars@kernel.org> wrote:
>
> -Wimplicit-fallthrough=5 was under cc-option because it was only
> available in GCC 7.x and newer so the build is now broken for GCC 5.x
> and 6.x:

Annoying. And I obviously never saw it because I don't carry ancient
compiler versions.

That said:

> -       default "-Wimplicit-fallthrough=5" if CC_IS_GCC
> +       default "-Wimplicit-fallthrough=5" if $(cc-option,-Wimplicit-fallthrough=5)

I think it would be better to keep the CC_IS_GCC part of the test, for
the simple reason that the clang "make config" is already very slow.

I'm not sure why, but it's annoyingly noticeable, and I've complained
about clang performance before in this area (and the likely cause is
the default build for clang being this horribly inefficient shared
library setup, so it spends ages just doing dynamic linking)

Whenever I do "make oldconfig" with a clang build, and my machine is
under any reasonable load (typically because I'm also doing another
build in another terminal at the same time), it takes several seconds.

Doing the same thing with gcc is noticeably much faster.

In fact, it doesn't even need to be a very loaded machine, this is
basically an empty "re-do config" with gcc vs clang (basically same
config, except obviously for compiler-induced config differences):

  gcc$ time make oldconfig
  real 0m0.929s

  clang$ time make oldconfig
  real 0m1.917s

Two seconds may not seem like a lot, but when the machine is under my
usual build load, that almost 2s easily becomes a "do I need to go for
coffee" delay, since I'm just waiting for the config to finish before
I start the build (since I may end up having to answer questions).

And yeah, it's sad how much faster gcc is.

There was a time when the clang people were proud of their
compile-time performance. Pepperidge farm remembers.

Anyway, I'd prefer to not ask for the clang build to do even more
work, since we know it will fail that '=5' case.

             Linus

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

end of thread, other threads:[~2021-11-15  2:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-15  1:13 [PATCH] kbuild: Fix -Wimplicit-fallthrough=5 error for GCC 5.x and 6.x Gustavo A. R. Silva
2021-11-15  2:07 ` Linus Torvalds

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).