From owner-svn-src-user@freebsd.org Wed Apr 10 22:19:48 2019 Return-Path: Delivered-To: svn-src-user@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8DE08156F712 for ; Wed, 10 Apr 2019 22:19:48 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 329B68EA12; Wed, 10 Apr 2019 22:19:48 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0A30BDD2; Wed, 10 Apr 2019 22:19:48 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x3AMJlpc006059; Wed, 10 Apr 2019 22:19:47 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x3AMJlRu006058; Wed, 10 Apr 2019 22:19:47 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201904102219.x3AMJlRu006058@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Enji Cooper Date: Wed, 10 Apr 2019 22:19:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r346108 - user/ngie/fix-up-cxxstd/share/mk X-SVN-Group: user X-SVN-Commit-Author: ngie X-SVN-Commit-Paths: user/ngie/fix-up-cxxstd/share/mk X-SVN-Commit-Revision: 346108 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 329B68EA12 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.97)[-0.967,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Apr 2019 22:19:48 -0000 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