|author||Nathan Chancellor <email@example.com>||2019-08-26 17:41:55 -0700|
|committer||Masahiro Yamada <firstname.lastname@example.org>||2019-08-30 04:00:37 +0900|
kbuild: Do not enable -Wimplicit-fallthrough for clang for now
This functionally reverts commit bfd77145f35c ("Makefile: Convert -Wimplicit-fallthrough=3 to just -Wimplicit-fallthrough for clang"). clang enabled support for -Wimplicit-fallthrough in C in r369414 , which causes a lot of warnings when building the kernel for two reasons: 1. Clang does not support the /* fall through */ comments. There seems to be a general consensus in the LLVM community that this is not something they want to support. Joe Perches wrote a script to convert all of the comments to a "fallthrough" keyword that will be added to compiler_attributes.h  , which catches the vast majority of the comments. There doesn't appear to be any consensus in the kernel community when to do this conversion. 2. Clang and GCC disagree about falling through to final case statements with no content or cases that simply break: https://godbolt.org/z/c8csDu This difference contributes at least 50 warnings in an allyesconfig build for x86, not considering other architectures. This difference will need to be discussed to see which compiler is right  . : https://github.com/llvm/llvm-project/commit/1e0affb6e564b7361b0aadb38805f26deff4ecfc : https://email@example.com/ : https://firstname.lastname@example.org/ : https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91432 : https://github.com/ClangBuiltLinux/linux/issues/636 Given these two problems need discussion and coordination, do not enable -Wimplicit-fallthrough with clang right now. Add a comment to explain what is going on as well. This commit should be reverted once these two issues are fully flushed out and resolved. Suggested-by: Masahiro Yamada <email@example.com> Signed-off-by: Nathan Chancellor <firstname.lastname@example.org> Acked-by: Miguel Ojeda <email@example.com> Acked-by: Nick Desaulniers <firstname.lastname@example.org> Acked-by: Gustavo A. R. Silva <email@example.com> Signed-off-by: Masahiro Yamada <firstname.lastname@example.org>
Diffstat (limited to 'Makefile')
1 files changed, 5 insertions, 3 deletions
@@ -774,6 +774,11 @@ else
# These warnings generated too much noise in a regular build.
# Use make W=1 to enable them (see scripts/Makefile.extrawarn)
KBUILD_CFLAGS += -Wno-unused-but-set-variable
+# Warn about unmarked fall-throughs in switch statement.
+# Disabled for clang while comment to attribute conversion happens and
+# https://github.com/ClangBuiltLinux/linux/issues/636 is discussed.
+KBUILD_CFLAGS += $(call cc-option,-Wimplicit-fallthrough,)
KBUILD_CFLAGS += $(call cc-disable-warning, unused-const-variable)
@@ -868,9 +873,6 @@ NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include)
# warn about C99 declaration after statement
KBUILD_CFLAGS += -Wdeclaration-after-statement
-# Warn about unmarked fall-throughs in switch statement.
-KBUILD_CFLAGS += $(call cc-option,-Wimplicit-fallthrough,)
# Variable Length Arrays (VLAs) should not be used anywhere in the kernel
KBUILD_CFLAGS += -Wvla