Skip to content

Commit 3b7fcf6

Browse files
nathanchancemehmetb0
authored andcommitted
kbuild: Move -Wenum-enum-conversion to W=2
BugLink: https://bugs.launchpad.net/bugs/2114239 commit 8f6629c upstream. -Wenum-enum-conversion was strengthened in clang-19 to warn for C, which caused the kernel to move it to W=1 in commit 75b5ab1 ("kbuild: Move -Wenum-{compare-conditional,enum-conversion} into W=1") because there were numerous instances that would break builds with -Werror. Unfortunately, this is not a full solution, as more and more developers, subsystems, and distributors are building with W=1 as well, so they continue to see the numerous instances of this warning. Since the move to W=1, there have not been many new instances that have appeared through various build reports and the ones that have appeared seem to be following similar existing patterns, suggesting that most instances of this warning will not be real issues. The only alternatives for silencing this warning are adding casts (which is generally seen as an ugly practice) or refactoring the enums to macro defines or a unified enum (which may be undesirable because of type safety in other parts of the code). Move the warning to W=2, where warnings that occur frequently but may be relevant should reside. Cc: [email protected] Fixes: 75b5ab1 ("kbuild: Move -Wenum-{compare-conditional,enum-conversion} into W=1") Link: https://lore.kernel.org/[email protected]/ Signed-off-by: Nathan Chancellor <[email protected]> Acked-by: Arnd Bergmann <[email protected]> Signed-off-by: Linus Torvalds <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]> Signed-off-by: Noah Wager <[email protected]> Signed-off-by: Mehmet Basaran <[email protected]>
1 parent 282feed commit 3b7fcf6

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

scripts/Makefile.extrawarn

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,6 @@ KBUILD_CFLAGS += -Wno-tautological-constant-out-of-range-compare
135135
KBUILD_CFLAGS += $(call cc-disable-warning, unaligned-access)
136136
KBUILD_CFLAGS += $(call cc-disable-warning, cast-function-type-strict)
137137
KBUILD_CFLAGS += -Wno-enum-compare-conditional
138-
KBUILD_CFLAGS += -Wno-enum-enum-conversion
139138
endif
140139

141140
endif
@@ -162,6 +161,10 @@ KBUILD_CFLAGS += -Wno-missing-field-initializers
162161
KBUILD_CFLAGS += -Wno-type-limits
163162
KBUILD_CFLAGS += -Wno-shift-negative-value
164163

164+
ifdef CONFIG_CC_IS_CLANG
165+
KBUILD_CFLAGS += -Wno-enum-enum-conversion
166+
endif
167+
165168
ifdef CONFIG_CC_IS_GCC
166169
KBUILD_CFLAGS += -Wno-maybe-uninitialized
167170
endif

0 commit comments

Comments
 (0)