Skip to contentSkip to conversation

kbuild-enable-wformat-truncation-on-clang.patch removed from -mm tree

merged mm-nonmm-stable Andrew Morton 1 participant 1 message May 19, 2024

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: kbuild: enable -Wformat-truncation on clang
has been removed from the -mm tree. Its filename was
kbuild-enable-wformat-truncation-on-clang.patch

This patch was dropped because it was merged into the mm-nonmm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

------------------------------------------------------
From: Arnd Bergmann <[email protected]>
Subject: kbuild: enable -Wformat-truncation on clang
Date: Mon, 15 Apr 2024 14:20:35 +0200

This warning option still produces output on gcc but is now clean when building with clang, so enable it conditionally on the compiler for now.

As far as I can tell, the remaining warnings with gcc are the result of analysing the code more deeply across inlining, while clang only does this within a function.

---

 scripts/Makefile.extrawarn |    7 +++++++
 1 file changed, 7 insertions(+)
scripts/Makefile.extrawarn renamed from scripts/Makefile.extrawarn~kbuild-enable-wformat-truncation-on-clang +7 -0
@@ -100,7 +100,14 @@ KBUILD_CFLAGS += $(call cc-disable-warni
 KBUILD_CFLAGS += $(call cc-disable-warning, unused-const-variable)
 KBUILD_CFLAGS += $(call cc-disable-warning, packed-not-aligned)
 KBUILD_CFLAGS += $(call cc-disable-warning, format-overflow)
+ifdef CONFIG_CC_IS_GCC
 KBUILD_CFLAGS += $(call cc-disable-warning, format-truncation)
+else
+# Clang checks for overflow/truncation with '%p', while GCC does not:
+# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111219
+KBUILD_CFLAGS += $(call cc-disable-warning, format-overflow-non-kprintf)
+KBUILD_CFLAGS += $(call cc-disable-warning, format-truncation-non-kprintf)
+endif
 KBUILD_CFLAGS += $(call cc-disable-warning, stringop-truncation)
 
 KBUILD_CFLAGS += -Wno-override-init # alias for -Wno-initializer-overrides in clang

_

Patches currently in -mm which might be from [email protected] are