svn commit: r346108 - user/ngie/fix-up-cxxstd/share/mk

Enji Cooper ngie at
Tue Sep 3 14:06:40 UTC 2019

Author: ngie
Date: Wed Apr 10 22:19:47 2019
New Revision: 346108

  Rework r345708
  * Default to gnu++14 with clang++ and g++ 6.x+ according to the defaults of
    each compile toolchain.
  * Do not override user-specified values for `-std=*`. Some ports rely on this
  This patch is similar to the one submitted by jbeich, however, it aims to
  optimize the latter case by not testing the compiler version, etc, at all.
  Reported by:	jbeich


Modified: user/ngie/fix-up-cxxstd/share/mk/
--- user/ngie/fix-up-cxxstd/share/mk/	Wed Apr 10 22:16:50 2019	(r346107)
+++ user/ngie/fix-up-cxxstd/share/mk/	Wed Apr 10 22:19:47 2019	(r346108)
@@ -25,16 +25,21 @@ CFLAGS+=	-std=iso9899:1999
 CFLAGS+=	-std=${CSTD}
 .endif # CSTD
-CXXSTD?=	c++11
-.elif ${COMPILER_TYPE} == "gcc"
+# Only pass -std= if not specified to facilitate compatibility with previous
+# FreeBSD versions. Third-party packages might specify -std=*.
+.if empty(CXXFLAGS:M-std=*)
+.if ${COMPILER_TYPE} == "clang" || ${COMPILER_TYPE} == "gcc"
+.if ${COMPILER_VERSION} >= 60000
+CXXSTD?=	gnu++14
 # Prior versions of g++ support C++98 with GNU extensions by default.
 CXXSTD?=	gnu++98
 # Assume that the compiler supports at least C++98.
 CXXSTD?=	c++98
 # -pedantic is problematic because it also imposes namespace restrictions

More information about the svn-src-user mailing list