Skip to content

Commit 31732ab

Browse files
nathanchanceopsiff
authored andcommitted
kbuild: Move -Wenum-enum-conversion to W=2
stable inclusion from stable-v6.6.78 commit 3ae5615f48cd95c98f8067ded6075ec90e897ec1 category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/IBX1M5 Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=3ae5615f48cd95c98f8067ded6075ec90e897ec1 -------------------------------- commit 8f6629c004b193d23612641c3607e785819e97ab 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 75b5ab134bb5 ("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: 75b5ab134bb5 ("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]> (cherry picked from commit 3ae5615f48cd95c98f8067ded6075ec90e897ec1) Signed-off-by: Wentao Guan <[email protected]>
1 parent 6f6042f commit 31732ab

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Diff for: scripts/Makefile.extrawarn

+4-1
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,6 @@ KBUILD_CFLAGS += -Wno-tautological-constant-out-of-range-compare
144144
KBUILD_CFLAGS += $(call cc-disable-warning, unaligned-access)
145145
KBUILD_CFLAGS += $(call cc-disable-warning, cast-function-type-strict)
146146
KBUILD_CFLAGS += -Wno-enum-compare-conditional
147-
KBUILD_CFLAGS += -Wno-enum-enum-conversion
148147
endif
149148

150149
endif
@@ -175,6 +174,10 @@ KBUILD_CFLAGS += -Wno-missing-field-initializers
175174
KBUILD_CFLAGS += -Wno-type-limits
176175
KBUILD_CFLAGS += -Wno-shift-negative-value
177176

177+
ifdef CONFIG_CC_IS_CLANG
178+
KBUILD_CFLAGS += -Wno-enum-enum-conversion
179+
endif
180+
178181
ifdef CONFIG_CC_IS_CLANG
179182
KBUILD_CFLAGS += -Wno-initializer-overrides
180183
else

0 commit comments

Comments
 (0)