This is an automated email from the ASF dual-hosted git repository.
xiaoxiang781216 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git
The following commit(s) were added to refs/heads/master by this push:
new 4718c7c88 testing/mm/kasantest: pass the GCC-only flags to all but
Clang
4718c7c88 is described below
commit 4718c7c88d8bd965a842c5ec157d5d57e5352414
Author: huojianchao <[email protected]>
AuthorDate: Mon Nov 30 11:17:15 2026 +0800
testing/mm/kasantest: pass the GCC-only flags to all but Clang
-Wno-use-after-free and -Wno-stringop-overflow were added only when
CONFIG_ARCH_TOOLCHAIN_GCC is set. Not every GCC toolchain selects that
symbol: the RISC-V GNU toolchains select only ARCH_TOOLCHAIN_GNU, and
x86_64, mips and others select none, so these builds lost the two
flags. Leave them out only for the Clang and armclang toolchains, the
compilers that do not know them.
Also correct the comments: Clang warns about the unknown -Wno- options
(-Wunknown-warning-option), it does not reject them, and GCC accepts
-Wno-unknown-warning-option silently unless some other diagnostic is
emitted, which kasantest always does.
Assisted-by: Kiro:claude-opus-5-5
Signed-off-by: huojianchao <[email protected]>
---
testing/mm/kasantest/CMakeLists.txt | 13 ++++++++-----
testing/mm/kasantest/Makefile | 12 +++++++-----
2 files changed, 15 insertions(+), 10 deletions(-)
diff --git a/testing/mm/kasantest/CMakeLists.txt
b/testing/mm/kasantest/CMakeLists.txt
index 3a1d6d7dc..1034f6531 100644
--- a/testing/mm/kasantest/CMakeLists.txt
+++ b/testing/mm/kasantest/CMakeLists.txt
@@ -30,12 +30,15 @@ if(CONFIG_TESTING_KASAN)
-Wno-free-nonheap-object
"-O0")
- # -Wuse-after-free and -Wstringop-overflow exist only in GCC; clang rejects
- # the -Wno- forms with -Wunknown-warning-option. Passing
- # -Wno-unknown-warning-option instead is not a fix either, because GCC does
- # not know that flag and warns about it in turn.
+ # -Wuse-after-free and -Wstringop-overflow exist only in GCC, and Clang warns
+ # about the -Wno- forms (-Wunknown-warning-option).
+ # -Wno-unknown-warning-option does not help: GCC does not know it either, and
+ # kasantest always emits other diagnostics, so GCC then prints a note about
+ # it. Not every GCC toolchain selects ARCH_TOOLCHAIN_GCC (the RISC-V GNU
+ # toolchains select only ARCH_TOOLCHAIN_GNU), so leave the flags out only for
+ # the Clang toolchains.
- if(CONFIG_ARCH_TOOLCHAIN_GCC)
+ if(NOT CONFIG_ARCH_TOOLCHAIN_CLANG AND NOT CONFIG_ARCH_TOOLCHAIN_ARMCLANG)
list(APPEND CFLAGS -Wno-use-after-free -Wno-stringop-overflow)
endif()
diff --git a/testing/mm/kasantest/Makefile b/testing/mm/kasantest/Makefile
index 96c685af1..44739b44b 100644
--- a/testing/mm/kasantest/Makefile
+++ b/testing/mm/kasantest/Makefile
@@ -34,12 +34,14 @@ CFLAGS += -Wno-array-bounds -Wno-free-nonheap-object
CFLAGS += -Wno-unused-value -Wno-unused-variable
CFLAGS += -fno-builtin "-O0"
-# -Wuse-after-free and -Wstringop-overflow exist only in GCC; clang rejects the
-# -Wno- forms with -Wunknown-warning-option. Passing
-# -Wno-unknown-warning-option instead is not a fix either, because GCC does not
-# know that flag and warns about it in turn.
+# -Wuse-after-free and -Wstringop-overflow exist only in GCC, and Clang warns
+# about the -Wno- forms (-Wunknown-warning-option).
-Wno-unknown-warning-option
+# does not help: GCC does not know it either, and kasantest always emits other
+# diagnostics, so GCC then prints a note about it. Not every GCC toolchain
+# selects ARCH_TOOLCHAIN_GCC (the RISC-V GNU toolchains select only
+# ARCH_TOOLCHAIN_GNU), so leave the flags out only for the Clang toolchains.
-ifeq ($(CONFIG_ARCH_TOOLCHAIN_GCC),y)
+ifeq ($(CONFIG_ARCH_TOOLCHAIN_CLANG)$(CONFIG_ARCH_TOOLCHAIN_ARMCLANG),)
CFLAGS += -Wno-use-after-free -Wno-stringop-overflow
endif