From a7397897750dc915f386f731fcd64c1e38b2031c Mon Sep 17 00:00:00 2001 From: Max Lv Date: Wed, 14 Oct 2026 21:17:25 +0800 Subject: [PATCH] Keep GCC's C++-only warnings off for modules converted from C GCC's C++ -Wall includes -Wsign-compare and -Wclass-memaccess, which C's -Wall does not, so the converted modules failed -Werror on GCC (Linux, UCRT64) although nothing in them changed. They keep the warning set they were written against; code under ss_strict_warnings() re-enables both. --- cmake/ProjectOptions.cmake | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/cmake/ProjectOptions.cmake b/cmake/ProjectOptions.cmake index 82726baa..4daa0958 100644 --- a/cmake/ProjectOptions.cmake +++ b/cmake/ProjectOptions.cmake @@ -31,6 +31,11 @@ function(ss_project_options target) # it when they are rewritten. target_compile_options(${target} PRIVATE $<$:-fno-exceptions -fno-rtti -fno-threadsafe-statics>) + # GCC's C++ -Wall adds -Wsign-compare and -Wclass-memaccess, which C's + # -Wall does not have. Modules converted from C keep the warning set + # they were written against; ss_strict_warnings() turns both back on. + target_compile_options(${target} PRIVATE + $<$:-Wno-sign-compare -Wno-class-memaccess>) if(SS_WARNINGS_AS_ERRORS) target_compile_options(${target} PRIVATE -Werror) endif() @@ -61,6 +66,7 @@ endfunction() # tests). function(ss_strict_warnings target) if(NOT MSVC) - target_compile_options(${target} PRIVATE $<$:-Wextra>) + target_compile_options(${target} PRIVATE $<$:-Wextra> + $<$:-Wsign-compare -Wclass-memaccess>) endif() endfunction()