From 3a8d37ecc453a73088b5469e2604c98c79f63a4e Mon Sep 17 00:00:00 2001 From: Mark Wang Date: Fri, 5 Dec 2025 10:12:51 +0800 Subject: [PATCH] libsbc: Fix compiler-specific warning flag for non-GNU compilers The -Wno-stringop-overflow flag is specific to GCC and causes issues with other compilers like Clang. Separate the compiler options so that the warning suppression flag is only applied when using GCC. This change wraps the -Wno-stringop-overflow flag in a compiler ID check while keeping the optimization flags (-O3 -std=c11 -ffast-math) applied for all compilers. Signed-off-by: Mark Wang --- modules/libsbc/CMakeLists.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/libsbc/CMakeLists.txt b/modules/libsbc/CMakeLists.txt index ff64f821e24..d0a639611df 100644 --- a/modules/libsbc/CMakeLists.txt +++ b/modules/libsbc/CMakeLists.txt @@ -1,10 +1,13 @@ if(CONFIG_LIBSBC) zephyr_library_named(libsbc) +zephyr_library_compile_options(-O3 -std=c11 -ffast-math) # -Wno-stringop-overflow was added as otherwise gcc 13.3 produces multiple warnings in this library # Newer version of gcc do not produce them, and this code is taken from Android where it was # validated. So these warnings are presumed to be false positives. -zephyr_library_compile_options(-O3 -std=c11 -ffast-math -Wno-stringop-overflow) +if(CMAKE_C_COMPILER_ID MATCHES "GNU") + zephyr_library_compile_options(-Wno-stringop-overflow) +endif() zephyr_include_directories( ${ZEPHYR_LIBSBC_MODULE_DIR}/encoder/include