From 63d1c3c43690ff3c3e76e1fb03c8640fe30a2663 Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Thu, 25 Dec 2025 19:44:34 +0100 Subject: [PATCH] bsd.sys.mk: suppress some new clang 21 warnings for C++ Otherwise, these lead to many -Werror warnings in libc++ headers, due to our use of -Wsystem-headers, which is not officially supported upstream: Suppress -Wc++20-extensions, due to: /usr/include/c++/v1/__algorithm/simd_utils.h:96:50: error: explicit template parameter list for lambdas is a C++20 extension [-Werror,-Wc++20-extensions] 96 | inline constexpr size_t __simd_vector_size_v = []() -> size_t { | ^ Suppress -Wc++23-lambda-attributes, due to: /usr/include/c++/v1/__format/format_functions.h:462:32: error: an attribute specifier sequence in this position is a C++23 extension [-Werror,-Wc++23-lambda-attributes] 462 | if (bool __is_identity = [&] [[__gnu__::__pure__]] // Make sure the compiler knows this call can be eliminated | ^ Suppress -Wnullability-completeness, due to: /usr/include/c++/v1/string:1068:80: error: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Werror,-Wnullability-completeness] 1068 | _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string(const _CharT* __s, size_type __n) { | ^ MFC after: 3 days --- share/mk/bsd.sys.mk | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/share/mk/bsd.sys.mk b/share/mk/bsd.sys.mk index 2134886abcf5..50eb04b9fd15 100644 --- a/share/mk/bsd.sys.mk +++ b/share/mk/bsd.sys.mk @@ -93,6 +93,11 @@ CWARNFLAGS.clang+= -Wno-error=unused-but-set-parameter # Similar to gcc >= 8.1 -Wno-error=cast-function-type below CWARNFLAGS.clang+= -Wno-error=cast-function-type-mismatch .endif +.if ${COMPILER_TYPE} == "clang" && ${COMPILER_VERSION} >= 210000 +CXXWARNFLAGS.clang+= -Wno-c++20-extensions +CXXWARNFLAGS.clang+= -Wno-c++23-lambda-attributes +CXXWARNFLAGS.clang+= -Wno-nullability-completeness +.endif .endif # WARNS <= 6 .if ${WARNS} <= 3 CWARNFLAGS.clang+= -Wno-tautological-compare -Wno-unused-value\