WSL2-Linux-Kernel/scripts
Nathan Chancellor 5273c56f3f kbuild: Move -Wenum-{compare-conditional,enum-conversion} into W=1
[ Upstream commit 75b5ab134bb5f657ef7979a59106dce0657e8d87 ]

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: stable@vger.kernel.org
Closes: https://github.com/ClangBuiltLinux/linux/issues/2002
Link: 8c2ae42b3e
Acked-by: Yonghong Song <yonghong.song@linux.dev>
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-04-10 16:18:41 +02:00
..
atomic atomics: Fix atomic64_{read_acquire,set_release} fallbacks 2022-04-08 14:23:57 +02:00
basic .gitignore: prefix local generated files with a slash 2021-05-02 00:43:35 +09:00
clang-tools gen_compile_commands: fix invalid escape sequence warning 2024-03-26 18:21:12 -04:00
coccinelle scripts: coccinelle: allow list_entry_is_head() to use pos 2021-08-08 22:00:49 +02:00
dtc kbuild: Allow kernel installation packaging to override pkg-config 2023-02-01 08:27:30 +01:00
dummy-tools kbuild: dummy-tools: avoid tmpdir leak in dummy gcc 2022-08-25 11:40:14 +02:00
gcc-plugins randstruct: Fix gcc-plugin performance mode to stay in group 2023-11-28 16:56:26 +00:00
gdb scripts/gdb: fix lx-timerlist for Python3 2023-05-11 23:00:39 +09:00
genksyms .gitignore: prefix local generated files with a slash 2021-05-02 00:43:35 +09:00
kconfig kconfig: fix infinite loop when expanding a macro at the end of file 2024-03-26 18:21:34 -04:00
ksymoops
mod modpost: trim leading spaces when processing source files list 2024-02-23 08:55:04 +01:00
package builddeb: clean generated package content 2023-03-10 09:39:44 +01:00
selinux selinux: use "grep -E" instead of "egrep" 2022-10-26 12:34:35 +02:00
tracing ftrace/scripts: Update the instructions for ftrace-bisect.sh 2023-02-01 08:27:23 +01:00
.gitignore .gitignore: prefix local generated files with a slash 2021-05-02 00:43:35 +09:00
Kbuild.include kbuild: remove the target in signal traps when interrupted 2022-10-26 12:35:27 +02:00
Kconfig.include
Lindent
Makefile kbuild: Allow kernel installation packaging to override pkg-config 2023-02-01 08:27:30 +01:00
Makefile.asm-generic
Makefile.build x86/retbleed: Add fine grained Kconfig knobs 2022-07-23 12:54:10 +02:00
Makefile.clang kbuild: Add -Werror=ignored-optimization-argument to CLANG_FLAGS 2021-09-19 10:55:18 +09:00
Makefile.clean
Makefile.compiler powerpc: remove checks for binutils older than 2.25 2024-01-25 14:52:32 -08:00
Makefile.dtbinst
Makefile.extrawarn kbuild: Move -Wenum-{compare-conditional,enum-conversion} into W=1 2024-04-10 16:18:41 +02:00
Makefile.gcc-plugins gcc-plugins: Undefine LATENT_ENTROPY_PLUGIN when plugin disabled for a file 2022-08-25 11:40:27 +02:00
Makefile.headersinst
Makefile.host
Makefile.kasan kasan: always respect CONFIG_KASAN_STACK 2021-09-24 16:13:35 -07:00
Makefile.kcov
Makefile.kcsan
Makefile.lib kbuild: move objtool_args back to scripts/Makefile.build 2022-05-15 20:18:50 +02:00
Makefile.modfinal kbuild: Disable GCOV for *.mod.o 2023-07-23 13:47:17 +02:00
Makefile.modinst
Makefile.modpost kbuild: Fix include path in scripts/Makefile.modpost 2022-09-05 10:30:06 +02:00
Makefile.package
Makefile.ubsan ubsan: remove CONFIG_UBSAN_OBJECT_SIZE 2022-04-13 20:59:27 +02:00
Makefile.userprogs
adjust_autoksyms.sh kbuild: redo fake deps at include/ksym/*.h 2021-09-03 08:17:21 +09:00
as-version.sh kbuild: Switch to 'f' variants of integrated assembler flag 2021-09-03 08:17:20 +09:00
asn1_compiler.c ASN.1: Fix check for strdup() success 2023-04-26 13:51:56 +02:00
bin2c.c
bloat-o-meter
bootgraph.pl
bpf_doc.py bpf, scripts: Correct GPL license name 2024-03-01 13:21:58 +01:00
cc-can-link.sh
cc-version.sh
check-sysctl-docs
check_extable.sh scripts: check_extable: fix typo in user error message 2021-09-08 11:50:28 -07:00
checkdeclares.pl scripts: make some scripts executable 2021-08-10 09:13:25 +09:00
checkincludes.pl
checkkconfigsymbols.py scripts: handle BrokenPipeError for python scripts 2023-03-17 08:49:02 +01:00
checkpatch.pl Compiler Attributes: add __alloc_size() for better bounds checking 2022-07-12 16:35:01 +02:00
checkstack.pl checkstack: fix printed address 2023-12-13 18:36:43 +01:00
checksyscalls.sh checksyscalls: Unconditionally ignore fstat{,at}64 2021-10-07 17:16:28 -07:00
checkversion.pl scripts: checkversion: modernize linux/version.h search strings 2021-08-05 20:55:39 +09:00
cleanfile
cleanpatch
coccicheck scripts: coccicheck: fix troubles on non-English builds 2021-05-18 11:09:59 +02:00
config
const_structs.checkpatch
decode_stacktrace.sh scripts/decode_stacktrace.sh: optionally use LLVM utilities 2024-02-23 08:55:13 +01:00
decodecode
depmod.sh
dev-needs.sh
diffconfig scripts: handle BrokenPipeError for python scripts 2023-03-17 08:49:02 +01:00
documentation-file-ref-check documentation-file-ref-check: Make git check work for multiple working directories 2021-06-04 11:20:52 -06:00
export_report.pl
extract-cert.c cert host tools: Stop complaining about deprecated OpenSSL functions 2022-11-16 09:58:28 +01:00
extract-ikconfig
extract-module-sig.pl
extract-sys-certs.pl
extract-vmlinux
extract_xc3028.pl
faddr2line scripts/faddr2line: Fix regression in name resolution on ppc64le 2022-12-08 11:28:38 +01:00
file-size.sh
find-unused-docs.sh
gcc-goto.sh
gcc-ld
gcc-x86_32-has-stack-protector.sh
gcc-x86_64-has-stack-protector.sh
gen_autoksyms.sh kbuild: Fix TRIM_UNUSED_KSYMS with LTO_CLANG 2021-09-03 08:12:39 +09:00
gen_ksymdeps.sh kbuild: redo fake deps at include/ksym/*.h 2021-09-03 08:17:21 +09:00
generate_initcall_order.pl
get_abi.pl scripts/get_abi: fix source path leak 2024-02-23 08:54:25 +01:00
get_dvb_firmware
get_feat.pl
get_maintainer.pl
gfp-translate
headerdep.pl
headers_check.pl
headers_install.sh
insert-sys-cert.c
jobserver-exec scripts/jobserver-exec: Fix a typo ("envirnoment") 2021-05-17 12:10:03 +09:00
kallsyms.c
kernel-doc stddef: Introduce DECLARE_FLEX_ARRAY() helper 2022-07-12 16:35:03 +02:00
ld-version.sh
leaking_addresses.pl leaking_addresses: Always print a trailing newline 2021-11-18 19:16:16 +01:00
link-vmlinux.sh kbuild: Fix changing ELF file type for output of gen_btf for big endian 2024-02-23 08:55:05 +01:00
makelst
markup_oops.pl
min-tool-version.sh Documentation: raise minimum supported version of GCC to 5.1 2021-09-13 10:18:28 -07:00
mkcompile_h kbuild: mkcompile_h: consider timestamp if KBUILD_BUILD_TIMESTAMP is set 2021-06-17 10:01:12 +09:00
mksysmap mksysmap: Fix the mismatch of 'L0' symbols in System.map 2022-09-23 14:15:51 +02:00
mkuboot.sh
module.lds.S modules: Ensure natural alignment for .altinstructions and __bug_table sections 2022-08-25 11:40:41 +02:00
modules-check.sh
nsdeps kbuild: replace LANG=C with LC_ALL=C 2021-05-02 00:43:35 +09:00
objdiff
pahole-flags.sh bpf: Add --skip_encoding_btf_inconsistent_proto, --btf_gen_optimized to pahole flags for v1.25 2024-01-25 14:52:31 -08:00
pahole-version.sh kbuild: Add CONFIG_PAHOLE_VERSION 2023-02-25 12:06:45 +01:00
parse-maintainers.pl
patch-kernel
profile2linkerlist.pl
prune-kernel
recordmcount.c recordmcount: Fix memory leaks in the uwrite function 2023-05-24 17:36:47 +01:00
recordmcount.h recordmcount: Correct st_shndx handling 2021-06-18 09:09:17 -04:00
recordmcount.pl recordmcount.pl: fix typo in s390 mcount regex 2022-01-05 12:42:33 +01:00
remove-stale-files kbuild: add a script to remove stale generated files 2021-05-02 00:43:35 +09:00
setlocalversion scripts/setlocalversion: fix a bug when LOCALVERSION is empty 2021-07-18 23:48:14 +09:00
show_delta
sign-file.c sign-file: Fix incorrect return values check 2023-12-20 15:17:37 +01:00
sorttable.c x86/extable: Rework the exception table mechanics 2022-07-29 17:25:25 +02:00
sorttable.h
spdxcheck-test.sh scripts/spdxcheck-test.sh: Drop python2 2021-07-21 15:59:32 +02:00
spdxcheck.py scripts/spdxcheck.py: Strictly read license files in utf-8 2021-07-12 09:56:50 -06:00
spelling.txt scripts/spelling.txt: add more spellings to spelling.txt 2021-06-29 10:53:45 -07:00
sphinx-pre-install scripts: sphinx-pre-install: Fix ctex support on Debian 2022-01-27 11:05:44 +01:00
split-man.pl
stackdelta
stackusage
subarch.include parisc: Fix compile failure when building 64-bit kernel natively 2021-09-01 21:52:02 +02:00
syscallhdr.sh scripts: check duplicated syscall number in syscall table 2021-07-09 04:00:39 +09:00
syscallnr.sh scripts: make some scripts executable 2021-08-10 09:13:25 +09:00
syscalltbl.sh scripts: check duplicated syscall number in syscall table 2021-07-09 04:00:39 +09:00
tags.sh scripts/tags.sh: Resolve gtags empty index generation 2023-07-05 18:25:05 +01:00
tools-support-relr.sh Makefile: fix GDB warning with CONFIG_RELR 2021-06-08 13:09:34 +01:00
unifdef.c
ver_linux Removed the oprofiled version option 2021-05-03 17:23:06 -06:00
xen-hypercalls.sh scripts: make some scripts executable 2021-08-10 09:13:25 +09:00
xz_wrap.sh