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

Jan Beich jbeich at FreeBSD.org
Tue Sep 3 14:07:19 UTC 2019


Enji Cooper <ngie at 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




More information about the svn-src-all mailing list