git: 42fb28cef42e - main - Explicitly set CXXSTD to c++11 for old C++ code using std::auto_ptr<>.

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Mon, 05 Dec 2022 00:25:37 UTC
The branch main has been updated by jhb:

URL: https://cgit.FreeBSD.org/src/commit/?id=42fb28cef42e883d808c9efadd44016563248817

commit 42fb28cef42e883d808c9efadd44016563248817
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2022-11-30 22:56:19 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2022-12-05 00:25:21 +0000

    Explicitly set CXXSTD to c++11 for old C++ code using std::auto_ptr<>.
    
    GCC 12 defaults to C++17 which removes (not just deprecates)
    std::auto_ptr<>.  Trying to use CXXSTD of c++03 doesn't work with
    libc++ headers, but c++11 does.
    
    Reviewed by:    brooks, imp, emaste
    Differential Revision:  https://reviews.freebsd.org/D37531
---
 lib/atf/Makefile.inc           | 3 +++
 lib/liblutok/Makefile          | 1 +
 libexec/atf/atf-check/Makefile | 1 +
 usr.bin/kyua/Makefile          | 1 +
 4 files changed, 6 insertions(+)

diff --git a/lib/atf/Makefile.inc b/lib/atf/Makefile.inc
index 392bbb23b236..5904a859a15c 100644
--- a/lib/atf/Makefile.inc
+++ b/lib/atf/Makefile.inc
@@ -28,3 +28,6 @@
 CFLAGS+=	-DHAVE_CONFIG_H
 
 WARNS?=		3
+
+# Permit use of auto_ptr for compilers defaulting to C++17 or later
+CXXSTD=		c++11
diff --git a/lib/liblutok/Makefile b/lib/liblutok/Makefile
index dccbcaf773e4..0071d7b55070 100644
--- a/lib/liblutok/Makefile
+++ b/lib/liblutok/Makefile
@@ -22,5 +22,6 @@ SHLIB_MAJOR=	0
 
 # lutok uses auto_ptr
 CFLAGS+=	-Wno-deprecated-declarations
+CXXSTD=		c++11
 
 .include <bsd.lib.mk>
diff --git a/libexec/atf/atf-check/Makefile b/libexec/atf/atf-check/Makefile
index 6711d1744430..1a87a14f354d 100644
--- a/libexec/atf/atf-check/Makefile
+++ b/libexec/atf/atf-check/Makefile
@@ -41,6 +41,7 @@ CFLAGS+=	-DATF_SHELL='"/bin/sh"'
 
 # Silence warnings about usage of deprecated std::auto_ptr
 CXXWARNFLAGS+=	-Wno-deprecated-declarations
+CXXSTD=		c++11
 
 LIBADD=		atf_cxx
 
diff --git a/usr.bin/kyua/Makefile b/usr.bin/kyua/Makefile
index 966927709a06..e23899afd1e5 100644
--- a/usr.bin/kyua/Makefile
+++ b/usr.bin/kyua/Makefile
@@ -37,6 +37,7 @@ CFLAGS+=	-I${SRCTOP}/contrib/lutok/include
 CFLAGS+=	-I${SRCTOP}/contrib/sqlite3
 # kyua uses auto_ptr
 CFLAGS+=	-Wno-deprecated-declarations
+CXXSTD=		c++11
 CFLAGS+=	-DHAVE_CONFIG_H
 
 # We compile the kyua libraries as part of the main executable as this saves