linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] kbuild: Require W=1 for -Wimplicit-fallthrough with clang
@ 2019-08-15 18:20 Nathan Huckleberry
  2019-08-15 20:45 ` Nathan Chancellor
  0 siblings, 1 reply; 18+ messages in thread
From: Nathan Huckleberry @ 2019-08-15 18:20 UTC (permalink / raw)
  To: yamada.masahiro, michal.lkml, joe, miguel.ojeda.sandonis
  Cc: linux-kbuild, linux-kernel, clang-built-linux, Nathan Huckleberry

Clang is updating to support -Wimplicit-fallthrough on C
https://reviews.llvm.org/D64838. Since clang does not
support the comment version of fallthrough annotations
this update causes an additional 50k warnings. Most
of these warnings (>49k) are duplicates from header files.

This patch is intended to be reverted after the warnings
have been cleaned up.

Signed-off-by: Nathan Huckleberry <nhuck@google.com>
---
 Makefile                   | 4 ++++
 scripts/Makefile.extrawarn | 3 +++
 2 files changed, 7 insertions(+)

diff --git a/Makefile b/Makefile
index 1b23f95db176..93b9744e66a2 100644
--- a/Makefile
+++ b/Makefile
@@ -846,7 +846,11 @@ NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include)
 KBUILD_CFLAGS += -Wdeclaration-after-statement
 
 # Warn about unmarked fall-throughs in switch statement.
+# If the compiler is clang, this warning is only enabled if W=1 in
+# Makefile.extrawarn
+ifndef CONFIG_CC_IS_CLANG
 KBUILD_CFLAGS += $(call cc-option,-Wimplicit-fallthrough,)
+endif
 
 # Variable Length Arrays (VLAs) should not be used anywhere in the kernel
 KBUILD_CFLAGS += -Wvla
diff --git a/scripts/Makefile.extrawarn b/scripts/Makefile.extrawarn
index a74ce2e3c33e..e12359d69bb7 100644
--- a/scripts/Makefile.extrawarn
+++ b/scripts/Makefile.extrawarn
@@ -30,6 +30,9 @@ 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)
+ifdef CONFIG_CC_IS_CLANG
+KBUILD_CFLAGS += $(call cc-option,-Wimplicit-fallthrough,)
+endif
 # The following turn off the warnings enabled by -Wextra
 warning-1 += -Wno-missing-field-initializers
 warning-1 += -Wno-sign-compare
-- 
2.23.0.rc1.153.gdeed80330f-goog


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

end of thread, other threads:[~2019-08-29 17:19 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-15 18:20 [PATCH] kbuild: Require W=1 for -Wimplicit-fallthrough with clang Nathan Huckleberry
2019-08-15 20:45 ` Nathan Chancellor
2019-08-15 22:50   ` Nick Desaulniers
2019-08-15 22:58     ` [PATCH v2] " Nathan Huckleberry
2019-08-15 23:04       ` Nick Desaulniers
2019-08-18 16:43       ` Masahiro Yamada
2019-08-18 18:43         ` Nathan Chancellor
2019-08-19  3:05           ` Masahiro Yamada
2019-08-27  0:41       ` [PATCH] kbuild: Do not enable -Wimplicit-fallthrough for clang for now Nathan Chancellor
2019-08-28 16:20         ` Masahiro Yamada
2019-08-28 16:44           ` Miguel Ojeda
2019-08-28 17:39             ` Nick Desaulniers
2019-08-28 17:44               ` Nick Desaulniers
2019-08-29 17:18                 ` Masahiro Yamada
2019-08-28 18:02           ` Gustavo A. R. Silva
2019-08-15 22:59   ` [PATCH] kbuild: Require W=1 for -Wimplicit-fallthrough with clang Miguel Ojeda
2019-08-15 23:05     ` Nick Desaulniers
2019-08-15 23:53       ` Miguel Ojeda

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