git: 28fc837b7037 - main - bsd.sys.mk: Disable -Wdangling-reference for GCC 13+
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 15 Nov 2023 02:37:44 UTC
The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=28fc837b70372a1a99c28ef4f74325bce711960a commit 28fc837b70372a1a99c28ef4f74325bce711960a Author: John Baldwin <jhb@FreeBSD.org> AuthorDate: 2023-11-15 02:35:04 +0000 Commit: John Baldwin <jhb@FreeBSD.org> CommitDate: 2023-11-15 02:35:04 +0000 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 --- share/mk/bsd.sys.mk | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/share/mk/bsd.sys.mk b/share/mk/bsd.sys.mk index 4cbe01404876..de91e00d8cc7 100644 --- a/share/mk/bsd.sys.mk +++ b/share/mk/bsd.sys.mk @@ -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