@@ -119,23 +119,30 @@ if (MSVC)
119119 # Make sure Windows doesn't define min/max macros that interfere with STL
120120 add_definitions (-DNOMINMAX )
121121else ()
122- # Avoid megabytes of warnings like:
123- # util/math/vector.h:178:16: warning: optimization attribute on
124- # ‘double sqrt(double)’ follows definition but the attribute doesn’t
125- # match [-Wattributes]
126- add_definitions (-Wno-attributes )
127- add_definitions (-Wno-deprecated-declarations )
128- add_definitions (-Wno-nullability-completeness )
129- # Suppress noisy AArch64 ABI notes about parameter passing changes in
130- # GCC 10.1. Irrelevant since we don't mix objects from old compilers.
131- # TODO: Use check_cxx_compiler_flag(-Wno-psabi) to guard this.
132- add_compile_options (-Wno-psabi )
133- # Some files use sized deallocation, which should be enabled by
134- # default for C++14 and later. There appears to be a bug with clang
135- # < 19 causing this not to be enabled.
136- # https://github.com/google/s2geometry/issues/411#issuecomment-2726949607
137- # This can be removed when clang19 is the minimum supported version.
138- add_compile_options (-fsized-deallocation )
122+ # OSS #458: silence only observed warning churn, guarded by toolchain support.
123+
124+ check_cxx_compiler_flag (-Wno-attributes S2_CXX_SUPPORTS_WNO_ATTRIBUTES )
125+ if (S2_CXX_SUPPORTS_WNO_ATTRIBUTES)
126+ add_compile_options ($<$<COMPILE_LANGUAGE :CXX >:-Wno -attributes >)
127+ endif ()
128+
129+ check_cxx_compiler_flag (-Wno-nullability-completeness
130+ S2_CXX_SUPPORTS_WNO_NULLABILITY_COMPLETENESS )
131+ if (S2_CXX_SUPPORTS_WNO_NULLABILITY_COMPLETENESS)
132+ add_compile_options ($<$<COMPILE_LANGUAGE :CXX >:-Wno -nullability -completeness >)
133+ endif ()
134+
135+ check_cxx_compiler_flag (-Wno-psabi S2_CXX_SUPPORTS_WNO_PSABI )
136+ if (S2_CXX_SUPPORTS_WNO_PSABI)
137+ add_compile_options ($<$<COMPILE_LANGUAGE :CXX >:-Wno -psabi >)
138+ endif ()
139+
140+ if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
141+ check_cxx_compiler_flag (-fsized-deallocation S2_CXX_SUPPORTS_FSIZED_DEALLOCATION )
142+ if (S2_CXX_SUPPORTS_FSIZED_DEALLOCATION)
143+ add_compile_options ($<$<COMPILE_LANGUAGE :CXX >:-fsized -deallocation >)
144+ endif ()
145+ endif ()
139146endif ()
140147
141148# If OpenSSL is installed in a non-standard location, configure with
0 commit comments