bsd.sys.mk: Disable -Wdangling-reference for GCC 13+

GCC raises this warning for libc++'s istream.  It raises false
positives in other cases as well (GCC bugs 109640, 109642, 109671).

Warning from <istream>:

/usr/include/c++/v1/istream:1464:34: error: possibly dangling reference to a temporary [-Werror=dangling-reference]
 1464 |             const ctype<_CharT>& __ct = std::use_facet<ctype<_CharT> >(__is.getloc());
      |                                  ^~~~
/usr/include/c++/v1/istream:1464:71: note: the temporary was destroyed at the end of the full expression 'std::__1::use_facet<ctype<char> >(std::__1::ios_base::getloc() const())'
 1464 |             const ctype<_CharT>& __ct = std::use_facet<ctype<_CharT> >(__is.getloc());
      |                                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~

Reviewed by:	imp, emaste
Differential Revision:	https://reviews.freebsd.org/D42579
This commit is contained in:
John Baldwin 2023-11-14 18:35:04 -08:00
parent ab43851b0c
commit 28fc837b70

View file

@ -234,6 +234,13 @@ CXXWARNFLAGS+= -Wno-literal-suffix \
-Wno-error=unknown-pragmas
.endif
# GCC 13.1.0
.if ${COMPILER_VERSION} >= 130100
# These warnings are raised by headers in libc++ so are disabled
# globally for all C++
CXXWARNFLAGS+= -Wno-dangling-reference
.endif
# GCC produces false positives for functions that switch on an
# enum (GCC bug 87950)
CWARNFLAGS+= -Wno-return-type