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

Enji Cooper ngie at FreeBSD.org
Wed Apr 10 22:19:48 UTC 2019


Author: ngie
Date: Wed Apr 10 22:19:47 2019
New Revision: 346108
URL: https://svnweb.freebsd.org/changeset/base/346108

Log:
  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
    functionality.
  
  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/bsd.sys.mk

Modified: user/ngie/fix-up-cxxstd/share/mk/bsd.sys.mk
==============================================================================
--- user/ngie/fix-up-cxxstd/share/mk/bsd.sys.mk	Wed Apr 10 22:16:50 2019	(r346107)
+++ user/ngie/fix-up-cxxstd/share/mk/bsd.sys.mk	Wed Apr 10 22:19:47 2019	(r346108)
@@ -25,16 +25,21 @@ CFLAGS+=	-std=iso9899:1999
 CFLAGS+=	-std=${CSTD}
 .endif # CSTD
 
-.if ${COMPILER_FEATURES:Mc++11}
-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
+.else
 # Prior versions of g++ support C++98 with GNU extensions by default.
 CXXSTD?=	gnu++98
-.else
+.endif
+.endif
 # Assume that the compiler supports at least C++98.
 CXXSTD?=	c++98
-.endif
 CXXFLAGS+=	-std=${CXXSTD}
+.endif
 # CXXSTD
 
 # -pedantic is problematic because it also imposes namespace restrictions


More information about the svn-src-user mailing list