-
Notifications
You must be signed in to change notification settings - Fork 178
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
src: Add patch to disable -Wenum-enum-conversion
We add KCFLAGS=-Wno-error to turn off -Werror but unfortunately, there are some files that turn on -Werror unconditionally, which breaks the build. Add the patch that will disable -Wenum-enum-conversion for the normal kernel, which is a part of the 6.9 Kbuild pull request. Signed-off-by: Nathan Chancellor <[email protected]>
- Loading branch information
1 parent
76e5c94
commit 1c8abe1
Showing
1 changed file
with
69 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
From 75b5ab134bb5f657ef7979a59106dce0657e8d87 Mon Sep 17 00:00:00 2001 | ||
From: Nathan Chancellor <[email protected]> | ||
Date: Tue, 5 Mar 2024 15:12:47 -0700 | ||
Subject: kbuild: Move -Wenum-{compare-conditional,enum-conversion} into W=1 | ||
|
||
Clang enables -Wenum-enum-conversion and -Wenum-compare-conditional | ||
under -Wenum-conversion. A recent change in Clang strengthened these | ||
warnings and they appear frequently in common builds, primarily due to | ||
several instances in common headers but there are quite a few drivers | ||
that have individual instances as well. | ||
|
||
include/linux/vmstat.h:508:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion] | ||
508 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS + | ||
| ~~~~~~~~~~~~~~~~~~~~~ ^ | ||
509 | item]; | ||
| ~~~~ | ||
|
||
drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c:955:24: warning: conditional expression between different enumeration types ('enum iwl_mac_beacon_flags' and 'enum iwl_mac_beacon_flags_v1') [-Wenum-compare-conditional] | ||
955 | flags |= is_new_rate ? IWL_MAC_BEACON_CCK | ||
| ^ ~~~~~~~~~~~~~~~~~~ | ||
956 | : IWL_MAC_BEACON_CCK_V1; | ||
| ~~~~~~~~~~~~~~~~~~~~~ | ||
drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c:1120:21: warning: conditional expression between different enumeration types ('enum iwl_mac_beacon_flags' and 'enum iwl_mac_beacon_flags_v1') [-Wenum-compare-conditional] | ||
1120 | 0) > 10 ? | ||
| ^ | ||
1121 | IWL_MAC_BEACON_FILS : | ||
| ~~~~~~~~~~~~~~~~~~~ | ||
1122 | IWL_MAC_BEACON_FILS_V1; | ||
| ~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
Doing arithmetic between or returning two different types of enums could | ||
be a bug, so each of the instance of the warning needs to be evaluated. | ||
Unfortunately, as mentioned above, there are many instances of this | ||
warning in many different configurations, which can break the build when | ||
CONFIG_WERROR is enabled. | ||
|
||
To avoid introducing new instances of the warnings while cleaning up the | ||
disruption for the majority of users, disable these warnings for the | ||
default build while leaving them on for W=1 builds. | ||
|
||
Cc: [email protected] | ||
Closes: https://github.com/ClangBuiltLinux/linux/issues/2002 | ||
Link: https://github.com/llvm/llvm-project/commit/8c2ae42b3e1c6aa7c18f873edcebff7c0b45a37e | ||
Acked-by: Yonghong Song <[email protected]> | ||
Signed-off-by: Nathan Chancellor <[email protected]> | ||
Acked-by: Arnd Bergmann <[email protected]> | ||
Signed-off-by: Masahiro Yamada <[email protected]> | ||
--- | ||
Link: https://git.kernel.org/masahiroy/linux-kbuild/c/75b5ab134bb5f657ef7979a59106dce0657e8d87 | ||
--- | ||
scripts/Makefile.extrawarn | 2 ++ | ||
1 file changed, 2 insertions(+) | ||
|
||
diff --git a/scripts/Makefile.extrawarn b/scripts/Makefile.extrawarn | ||
index a9e552a1e9105b..2f25a1de129d10 100644 | ||
--- a/scripts/Makefile.extrawarn | ||
+++ b/scripts/Makefile.extrawarn | ||
@@ -132,6 +132,8 @@ KBUILD_CFLAGS += $(call cc-disable-warning, pointer-to-enum-cast) | ||
KBUILD_CFLAGS += -Wno-tautological-constant-out-of-range-compare | ||
KBUILD_CFLAGS += $(call cc-disable-warning, unaligned-access) | ||
KBUILD_CFLAGS += $(call cc-disable-warning, cast-function-type-strict) | ||
+KBUILD_CFLAGS += -Wno-enum-compare-conditional | ||
+KBUILD_CFLAGS += -Wno-enum-enum-conversion | ||
endif | ||
|
||
endif | ||
-- | ||
cgit 1.2.3-korg | ||
|