git: 80a1e92e4f54 - stable/13 - Silence GCC warnings when using libc++ headers.

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Wed, 03 May 2023 00:29:27 UTC
The branch stable/13 has been updated by jhb:

URL: https://cgit.FreeBSD.org/src/commit/?id=80a1e92e4f5408b08e441dcbe811a83f9584241b

commit 80a1e92e4f5408b08e441dcbe811a83f9584241b
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2022-11-30 22:50:35 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2023-05-02 23:42:17 +0000

    Silence GCC warnings when using libc++ headers.
    
    GCC 12 raises warnings about literal operator suffixes not preceded by
    '_' in libc++ headers such as <string_view> as it doesn't recognize
    libc++ headers being an implementation of the standard.
    
    GCC 12 also warns about clang-specific pragmas in <locale>.
    
    Disabling these warnings globally for all C++ code is not ideal, but
    is a better option than patching libc++ headers to ignore these
    warnings.
    
    Reviewed by:    emaste
    Differential Revision:  https://reviews.freebsd.org/D37530
    
    (cherry picked from commit 442295c1fe84b4dc3e4834acdbf4ede75affe3c4)
---
 share/mk/bsd.sys.mk | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/share/mk/bsd.sys.mk b/share/mk/bsd.sys.mk
index ad359727c32f..4a75e17ed2b6 100644
--- a/share/mk/bsd.sys.mk
+++ b/share/mk/bsd.sys.mk
@@ -227,6 +227,14 @@ CWARNFLAGS+=	-Wno-error=overflow
 .endif
 .endif
 
+# GCC 12.1.0
+.if ${COMPILER_VERSION} >= 120100
+# These warnings are raised by headers in libc++ so are disabled
+# globally for all C++
+CXXWARNFLAGS+=	-Wno-literal-suffix 			\
+		-Wno-error=unknown-pragmas
+.endif
+
 # GCC produces false positives for functions that switch on an
 # enum (GCC bug 87950)
 CWARNFLAGS+=	-Wno-return-type