From owner-dev-commits-src-all@freebsd.org Tue Apr 20 00:46:59 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9978D5DCB2F; Tue, 20 Apr 2021 00:46:59 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FPQ4M3zHrz3J8D; Tue, 20 Apr 2021 00:46:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7725A1138; Tue, 20 Apr 2021 00:46:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 13K0kx6d036842; Tue, 20 Apr 2021 00:46:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13K0kxqY036841; Tue, 20 Apr 2021 00:46:59 GMT (envelope-from git) Date: Tue, 20 Apr 2021 00:46:59 GMT Message-Id: <202104200046.13K0kxqY036841@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alex Richardson Subject: git: ba1182e26376 - main - bsd.compiler.mk: detect Apple Clang for cross-builds MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ba1182e26376987fe424707b2abc4d6532b28623 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Apr 2021 00:46:59 -0000 The branch main has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=ba1182e26376987fe424707b2abc4d6532b28623 commit ba1182e26376987fe424707b2abc4d6532b28623 Author: Alex Richardson AuthorDate: 2021-04-20 00:46:36 +0000 Commit: Alex Richardson CommitDate: 2021-04-20 00:46:36 +0000 bsd.compiler.mk: detect Apple Clang for cross-builds Apple clang uses a different versioning scheme, so if we enable or disable certain warnings for Clang 11+, those might not be supported in Apple Clang 11+. This adds 'apple-clang' to COMPILER_FEATURES, so that bootstrap tools Makefiles can avoid warnings on macOS. Reviewed By: imp Differential Revision: https://reviews.freebsd.org/D29680 --- share/mk/bsd.compiler.mk | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/share/mk/bsd.compiler.mk b/share/mk/bsd.compiler.mk index 0d8f02489f00..97198f70d5b6 100644 --- a/share/mk/bsd.compiler.mk +++ b/share/mk/bsd.compiler.mk @@ -26,6 +26,12 @@ # mitigation. # - init-all: supports stack variable initialization. # +# When bootstrapping on macOS, 'apple-clang' will be set in COMPILER_FEATURES +# to differentiate Apple's version of Clang. Apple Clang uses a different +# versioning scheme and may not support the same -W/-Wno warning flags. For a +# mapping of Apple Clang versions to upstream clang versions see +# https://en.wikipedia.org/wiki/Xcode#Xcode_7.0_-_12.x_(since_Free_On-Device_Development) +# # These variables with an X_ prefix will also be provided if XCC is set. # # This file may be included multiple times, but only has effect the first time. @@ -202,6 +208,10 @@ ${X_}COMPILER_TYPE:= gcc .if !defined(${X_}COMPILER_VERSION) ${X_}COMPILER_VERSION!=echo "${_v:M[1-9]*.[0-9]*}" | awk -F. '{print $$1 * 10000 + $$2 * 100 + $$3;}' .endif +# Detect apple clang when bootstrapping to select appropriate warning flags. +.if !defined(${X_}COMPILER_FEATURES) && ${_v:[*]:M*Apple clang version*} +${X_}COMPILER_FEATURES= apple-clang +.endif .undef _v .endif .if !defined(${X_}COMPILER_FREEBSD_VERSION) @@ -218,7 +228,7 @@ ${X_}COMPILER_FREEBSD_VERSION= unknown ${X_}COMPILER_RESOURCE_DIR!= ${${cc}:N${CCACHE_BIN}} -print-resource-dir 2>/dev/null || echo unknown .endif -${X_}COMPILER_FEATURES= c++11 c++14 +${X_}COMPILER_FEATURES+= c++11 c++14 .if ${${X_}COMPILER_TYPE} == "clang" || \ (${${X_}COMPILER_TYPE} == "gcc" && ${${X_}COMPILER_VERSION} >= 70000) ${X_}COMPILER_FEATURES+= c++17