[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20251214131528.3648-1-david.laight.linux@gmail.com>
Date: Sun, 14 Dec 2025 13:15:28 +0000
From: david.laight.linux@...il.com
To: Nathan Chancellor <nathan@...nel.org>,
Arnd Bergmann <arnd@...db.de>,
Nicolas Schier <nsc@...nel.org>,
linux-kbuild@...r.kernel.org,
linux-kernel@...r.kernel.org
Cc: David Laight <david.laight.linux@...il.com>
Subject: [PATCH 1/1] kbuild: Only enable -Wtautological-constant-out-of-range-compare for W=2
From: David Laight <david.laight.linux@...il.com>
The kernel code style is to use !(expr) rather that (expr) == 0.
But clang complains that converting some constant expressions
(eg (0xffffu << 16)) to a boolean always evalutes to true.
This happens often in the validity checks in #defines.
Move tautological-constant-out-of-range-compare to W=2 (along with the
similar type-limits).
Signed-off-by: David Laight <david.laight.linux@...il.com>
---
scripts/Makefile.warn | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/Makefile.warn b/scripts/Makefile.warn
index 68e6fafcb80c..e2d467835c5b 100644
--- a/scripts/Makefile.warn
+++ b/scripts/Makefile.warn
@@ -151,7 +151,6 @@ KBUILD_CFLAGS += -Wformat-insufficient-args
endif
endif
KBUILD_CFLAGS += $(call cc-option, -Wno-pointer-to-enum-cast)
-KBUILD_CFLAGS += -Wno-tautological-constant-out-of-range-compare
KBUILD_CFLAGS += $(call cc-option, -Wno-unaligned-access)
KBUILD_CFLAGS += -Wno-enum-compare-conditional
endif
@@ -179,6 +178,7 @@ KBUILD_CFLAGS += -Wno-shift-negative-value
ifdef CONFIG_CC_IS_CLANG
KBUILD_CFLAGS += -Wno-enum-enum-conversion
+KBUILD_CFLAGS += -Wno-tautological-constant-out-of-range-compare
endif
ifdef CONFIG_CC_IS_GCC
--
2.39.5
Powered by blists - more mailing lists