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 = []<bool _False = false>() -> 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
This commit is contained in:
Dimitry Andric 2025-12-25 19:44:34 +01:00
parent e51047118c
commit 63d1c3c436

View file

@ -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\