Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 10 Apr 2019 13:04:03 +0200
From:      Jan Beich <jbeich@FreeBSD.org>
To:        Enji Cooper <ngie@FreeBSD.org>
Cc:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   Re: svn commit: r345708 - in head: lib/clang lib/libc++ lib/libc++experimental lib/libc++fs lib/libclang_rt lib/libcxxrt lib/libgcc_eh lib/libomp lib/ofed/libibnetdisc share/mk usr.bin/dtc usr.sbin/pmc
Message-ID:  <tvf6-xgt8-wny@FreeBSD.org>
In-Reply-To: <201903291845.x2TIjRMb087865@repo.freebsd.org> (Enji Cooper's message of "Fri, 29 Mar 2019 18:45:27 %2B0000 (UTC)")
References:  <201903291845.x2TIjRMb087865@repo.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Enji Cooper <ngie@FreeBSD.org> writes:

> +.if ${COMPILER_FEATURES:Mc++11}
> +CXXSTD?=	c++11

POLA violation. Clang 6.0 or later defaults to gnu++14, not c++11.

> +.elif ${COMPILER_TYPE} == "gcc"
> +# Prior versions of g++ support C++98 with GNU extensions by default.
> +CXXSTD?=	gnu++98

POLA violation. GCC 6.0 or later defaults to gnu++14, not gnu++98.

> +CXXFLAGS+=	-std=${CXXSTD}

POLA violation. Breaks consumers that pass different -std= e.g.,

http://www.ipv6proxy.net/go.php?u=http://beefy12.nyi.freebsd.org/data/head-amd64-default/p498440_s346039/logs/errors/android-tools-adb-9.0.0.r3_2.log

Index: share/mk/bsd.sys.mk
===================================================================
--- share/mk/bsd.sys.mk	(revision 346076)
+++ share/mk/bsd.sys.mk	(working copy)
@@ -25,16 +25,19 @@ CFLAGS+=	-std=iso9899:1999
 CFLAGS+=	-std=${CSTD}
 .endif # CSTD
 
-.if ${COMPILER_FEATURES:Mc++11}
-CXXSTD?=	c++11
-.elif ${COMPILER_TYPE} == "gcc"
-# Prior versions of g++ support C++98 with GNU extensions by default.
+.if (${COMPILER_TYPE} == "clang" || ${COMPILER_TYPE} == "gcc") && ${COMPILER_VERSION} >= 60000
+CXXSTD?=	gnu++14
+.elif ${COMPILER_TYPE} == "clang" || ${COMPILER_TYPE} == "gcc"
+# Prior versions of clang++ and g++ support C++98 with GNU extensions by default.
 CXXSTD?=	gnu++98
 .else
 # Assume that the compiler supports at least C++98.
 CXXSTD?=	c++98
 .endif
+# Only pass -std= if missing to facilitate compatibility with previous FreeBSD versions
+.if empty(CXXFLAGS:M-std=*)
 CXXFLAGS+=	-std=${CXXSTD}
+.endif
 # CXXSTD
 
 # -pedantic is problematic because it also imposes namespace restrictions



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?tvf6-xgt8-wny>