linux-stable/scripts
Nathan Chancellor 39460da051 kbuild: Move -Wenum-{compare-conditional,enum-conversion} into W=1
[ Upstream commit 75b5ab134b ]

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-13 12:50:06 +02:00
..
basic kbuild: move bin2c back to scripts/ from scripts/basic/ 2018-07-18 01:18:05 +09:00
coccinelle fs: stream_open - opener for stream-like files so that read and write can run simultaneously without deadlock 2019-05-08 07:21:51 +02:00
dtc scripts/dtc: dtx_diff: remove broken example from help text 2022-01-27 09:04:33 +01:00
gcc-plugins randstruct: Fix gcc-plugin performance mode to stay in group 2023-11-28 16:46:34 +00:00
gdb scripts/gdb: fix lx-symbols 'gdb.error' while loading modules 2020-07-29 10:16:51 +02:00
genksyms genksyms: Teach parser about 128-bit built-in types 2019-07-31 07:27:02 +02:00
kconfig kconfig: fix infinite loop when expanding a macro at the end of file 2024-03-26 18:22:42 -04:00
ksymoops
mod modpost: add missing else to the "of" check 2023-10-10 21:45:01 +02:00
package kbuild: deb-pkg: fix bindeb-pkg breakage when O= is used 2019-04-17 08:38:45 +02:00
selinux selinux: use "grep -E" instead of "egrep" 2022-10-26 13:19:24 +02:00
tracing scripts/tracing: fix the bug that can't parse raw_trace_func 2021-08-12 13:19:42 +02:00
.gitignore kbuild: move bin2c back to scripts/ from scripts/basic/ 2018-07-18 01:18:05 +09:00
Kbuild.include kbuild: improve cc-option to clean up all temporary files 2020-06-30 23:17:15 -04:00
Kconfig.include kbuild: use -S instead of -E for precise cc-option test in Kconfig 2020-02-24 08:34:50 +01:00
Lindent
Makefile scripts: set proper OpenSSL include dir also for sign-file 2021-03-04 09:39:29 +01:00
Makefile.asm-generic
Makefile.build kbuild: generate modules.order only in directories visited by obj-y/m 2023-03-17 08:31:43 +01:00
Makefile.clean kbuild: remove deprecated host-progs variable 2018-08-09 21:51:17 +09:00
Makefile.dtbinst
Makefile.extrawarn kbuild: Move -Wenum-{compare-conditional,enum-conversion} into W=1 2024-04-13 12:50:06 +02:00
Makefile.gcc-plugins gcc-plugins: Undefine LATENT_ENTROPY_PLUGIN when plugin disabled for a file 2022-08-25 11:15:42 +02:00
Makefile.headersinst
Makefile.host kbuild: Rename HOST_LOADLIBES to KBUILD_HOSTLDLIBS 2018-07-18 01:18:05 +09:00
Makefile.kasan
Makefile.kcov
Makefile.lib kbuild: disable dtc simple_bus_reg warnings by default 2019-12-13 08:52:18 +01:00
Makefile.modbuiltin Kbuild: Makefile.modbuiltin: include auto.conf and tristate.conf mandatory 2018-08-03 00:47:00 +09:00
Makefile.modinst kbuild: remove duplicated comments about PHONY 2018-07-06 22:04:03 +09:00
Makefile.modpost kbuild: Fix include path in scripts/Makefile.modpost 2022-09-05 10:26:33 +02:00
Makefile.modsign kbuild: remove duplicated comments about PHONY 2018-07-06 22:04:03 +09:00
Makefile.ubsan lib/ubsan: remove null-pointer checks 2018-08-10 20:19:58 -07:00
adjust_autoksyms.sh
asn1_compiler.c ASN.1: Fix check for strdup() success 2023-04-26 11:21:53 +02:00
bin2c.c kbuild: move bin2c back to scripts/ from scripts/basic/ 2018-07-18 01:18:05 +09:00
bloat-o-meter scripts: switch explicitly to Python 3 2021-05-22 10:59:50 +02:00
bootgraph.pl
bpf_helpers_doc.py scripts/bpf: Fix xdp_md forward declaration typo 2024-03-01 13:06:11 +01:00
cc-can-link.sh
check_00index.sh
check_extable.sh
checkincludes.pl
checkkconfigsymbols.py
checkpatch.pl checkpatch: fix unescaped left brace 2020-12-30 11:26:04 +01:00
checkstack.pl scripts/checkstack.pl: Fix arm64 wrong or unknown architecture 2019-06-25 11:35:58 +08:00
checksyscalls.sh
checkversion.pl
clang-version.sh kbuild: Add a space after `!` to prevent parsing as file pattern 2018-08-22 23:21:40 +09:00
cleanfile
cleanpatch
coccicheck coccicheck: return proper error code on fail 2018-08-14 08:58:56 +09:00
config tweewide: Fix most Shebang lines 2021-05-22 10:59:50 +02:00
conmakehash.c
const_structs.checkpatch
decode_stacktrace.sh scripts/decode_stacktrace: strip basepath from all paths 2020-07-29 10:16:51 +02:00
decodecode scripts/decodecode: fix trapping instruction formatting 2020-05-14 07:57:23 +02:00
depmod.sh depmod: handle the case of /sbin/depmod without /sbin in PATH 2021-01-12 20:10:16 +01:00
diffconfig scripts: switch explicitly to Python 3 2021-05-22 10:59:50 +02:00
documentation-file-ref-check
export_report.pl
extract-cert.c cert host tools: Stop complaining about deprecated OpenSSL functions 2022-11-25 17:40:20 +01:00
extract-ikconfig
extract-module-sig.pl
extract-sys-certs.pl
extract-vmlinux scripts: teach extract-vmlinux about LZ4 and ZSTD 2018-07-08 09:32:32 +09:00
extract_xc3028.pl
faddr2line scripts/faddr2line: Fix regression in name resolution on ppc64le 2022-12-08 11:18:32 +01:00
file-size.sh
find-unused-docs.sh scripts/find-unused-docs: Fix massive false positives 2020-02-11 04:34:01 -08:00
gcc-goto.sh jump_label: move 'asm goto' support test to Kconfig 2019-06-04 08:02:34 +02:00
gcc-ld
gcc-plugin.sh
gcc-version.sh
gcc-x86_32-has-stack-protector.sh
gcc-x86_64-has-stack-protector.sh
get_dvb_firmware
get_maintainer.pl get_maintainer: allow option --mpath <directory> to read all files in <directory> 2018-08-22 10:52:48 -07:00
gfp-translate
headerdep.pl
headers.sh
headers_check.pl
headers_install.sh
insert-sys-cert.c
kallsyms.c scripts/kallsyms: fix definitely-lost memory leak 2020-01-04 19:13:09 +01:00
kernel-doc scripts/kernel-doc: Escape all literal braces in regexes 2018-08-06 13:36:20 -06:00
ld-version.sh
leaking_addresses.pl leaking_addresses: Always print a trailing newline 2021-11-26 11:36:06 +01:00
link-vmlinux.sh kbuild: rename LDFLAGS to KBUILD_LDFLAGS 2018-08-24 08:22:08 +09:00
makelst
markup_oops.pl
mkcompile_h kbuild: mkcompile_h: consider timestamp if KBUILD_BUILD_TIMESTAMP is set 2021-07-28 11:13:43 +02:00
mkmakefile
mksysmap mksysmap: Fix the mismatch of 'L0' symbols in System.map 2022-09-28 11:02:53 +02:00
mkuboot.sh
module-common.lds
namespace.pl namespace: fix namespace.pl script to support relative paths 2019-10-29 09:19:36 +01:00
objdiff
parse-maintainers.pl parse-maintainers: Mark as executable 2020-03-25 08:06:08 +01:00
patch-kernel
pnmtologo.c
profile2linkerlist.pl
prune-kernel
recordmcount.c recordmcount: Fix memory leaks in the uwrite function 2023-05-30 12:42:10 +01:00
recordmcount.h recordmcount: Fix spurious mcount entries on powerpc 2019-07-31 07:27:03 +02:00
recordmcount.pl recordmcount.pl: fix typo in s390 mcount regex 2022-01-05 12:34:58 +01:00
setlocalversion scripts/setlocalversion: make git describe output more reliable 2020-11-05 11:08:31 +01:00
show_delta
sign-file.c sign-file: Fix incorrect return values check 2023-12-20 15:38:01 +01:00
sortextable.c
sortextable.h
spdxcheck.py scripts/spdxcheck.py: always open files in binary mode 2018-12-19 19:19:50 +01:00
spelling.txt treewide: correct "differenciate" and "instanciate" typos 2018-08-23 18:48:43 -07:00
sphinx-pre-install scripts/sphinx-pre-install: fix script for RHEL/CentOS 2019-08-16 10:12:44 +02:00
split-man.pl tweewide: Fix most Shebang lines 2021-05-22 10:59:50 +02:00
stackdelta
stackusage
subarch.include selftests: add headers_install to lib.mk 2018-09-05 08:12:09 -06:00
tags.sh scripts/tags.sh: Resolve gtags empty index generation 2023-08-11 11:45:01 +02:00
unifdef.c unifdef: use memcpy instead of strncpy 2018-12-08 12:59:06 +01:00
ver_linux ver_linux: Do not check for ver_linux pattern in version function 2018-07-07 17:44:52 +02:00
xen-hypercalls.sh
xz_wrap.sh