Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

kbuild: Enable -Wtautological-compare

Currently, we disable -Wtautological-compare, which in turn disables a
bunch of more specific tautological comparison warnings that are useful
for the kernel such as -Wtautological-bitwise-compare. See clang's
documentation below for the other warnings that are suppressed by
-Wtautological-compare. Now that all of the major/noisy warnings have
been fixed, enable -Wtautological-compare so that more issues can be
caught at build time by various continuous integration setups.

-Wtautological-constant-out-of-range-compare is kept disabled under a
normal build but visible at W=1 because there are places in the kernel
where a constant or variable size can change based on the kernel
configuration. These are not fixed in a clean/concise way and the ones
I have audited so far appear to be harmless. It is not a subgroup but
rather just one warning so we do not lose out on much coverage by
default.

Link: https://github.com/ClangBuiltLinux/linux/issues/488
Link: http://releases.llvm.org/10.0.0/tools/clang/docs/DiagnosticsReference.html#wtautological-compare
Link: https://bugs.llvm.org/show_bug.cgi?id=42666
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>

authored by

Nathan Chancellor and committed by
Masahiro Yamada
afe956c5 e6abef61

+1 -2
-2
Makefile
··· 747 747 KBUILD_CPPFLAGS += -Qunused-arguments 748 748 KBUILD_CFLAGS += -Wno-format-invalid-specifier 749 749 KBUILD_CFLAGS += -Wno-gnu 750 - # Quiet clang warning: comparison of unsigned expression < 0 is always false 751 - KBUILD_CFLAGS += -Wno-tautological-compare 752 750 # CLANG uses a _MergedGlobals as optimization, but this breaks modpost, as the 753 751 # source of a reference will be _MergedGlobals and not on of the whitelisted names. 754 752 # See modpost pattern 2
+1
scripts/Makefile.extrawarn
··· 49 49 KBUILD_CFLAGS += -Wno-sign-compare 50 50 KBUILD_CFLAGS += -Wno-format-zero-length 51 51 KBUILD_CFLAGS += $(call cc-disable-warning, pointer-to-enum-cast) 52 + KBUILD_CFLAGS += -Wno-tautological-constant-out-of-range-compare 52 53 endif 53 54 54 55 endif