From owner-svn-src-head@FreeBSD.ORG Sat May 10 16:37:45 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9B5A0A2D; Sat, 10 May 2014 16:37:45 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 888551FF; Sat, 10 May 2014 16:37:45 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s4AGbjxG006255; Sat, 10 May 2014 16:37:45 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s4AGbjrg006253; Sat, 10 May 2014 16:37:45 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201405101637.s4AGbjrg006253@svn.freebsd.org> From: Warner Losh Date: Sat, 10 May 2014 16:37:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r265829 - head/share/mk X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 May 2014 16:37:45 -0000 Author: imp Date: Sat May 10 16:37:44 2014 New Revision: 265829 URL: http://svnweb.freebsd.org/changeset/base/265829 Log: Support, to the extent we generate proper command lines, compiling with clang 3.3. Useful for test building -current on a -stable system in individual directories. Potentially useful if we ever want to support, say, gcc 4.8 or 4.9's new warnings when building with an external toolchain (but such support not yet committed). Document the bsd.compiler.mk interface. Modified: head/share/mk/bsd.compiler.mk head/share/mk/bsd.sys.mk Modified: head/share/mk/bsd.compiler.mk ============================================================================== --- head/share/mk/bsd.compiler.mk Sat May 10 16:37:39 2014 (r265828) +++ head/share/mk/bsd.compiler.mk Sat May 10 16:37:44 2014 (r265829) @@ -1,27 +1,46 @@ # $FreeBSD$ +# Setup variables for the compiler +# +# COMPILTER_TYPE is the major type of compiler. Currently gcc and clang support +# automatic detetion. Other compiler types can be shoe-horned in, but require explicit +# setting of the compiler type. The compiler type can also be set explicitly if, say, +# you install gcc as clang... +# +# COMPILER_VERSION is a numeric constant equal to major * 10000 + minor * 100 + tiny. It +# too can be overriden on the command line. When testing it, be sure to make sure that you +# are limiting the test to a specific compiler. Testing against 30300 for gcc likely isn't +# what you wanted (since versions of gcc prior to 4.2 likely have no prayer of working). +# +# COMPILER_FEATURES will contain one or more of the following, based on compiler support +# for that feature: c++11 (supports full (or nearly full) C++11 programming environment). +# +# This file may be included multiple times, but only has effect the first time. +# + .if !target(____) ____: +_v!= ${CC} --version .if !defined(COMPILER_TYPE) . if ${CC:T:Mgcc*} COMPILER_TYPE:= gcc . elif ${CC:T:Mclang} COMPILER_TYPE:= clang -. else -_COMPILER_VERSION!= ${CC} --version -. if ${_COMPILER_VERSION:Mgcc} +. elif ${_v:Mgcc} COMPILER_TYPE:= gcc -. elif ${_COMPILER_VERSION:M\(GCC\)} +. elif ${_v:M\(GCC\)} COMPILER_TYPE:= gcc -. elif ${_COMPILER_VERSION:Mclang} +. elif ${_v:Mclang} COMPILER_TYPE:= clang -. else +. else .error Unable to determine compiler type for ${CC}. Consider setting COMPILER_TYPE. -. endif -. undef _COMPILER_VERSION . endif .endif +.if !defined(COMPILER_VERSION) +COMPILER_VERSION!=echo ${_v:M[1-9].[0-9]*} | awk -F. '{print $$1 * 10000 + $$2 * 100 + $$3;}' +.endif +.undef _v .if ${COMPILER_TYPE} == "clang" COMPILER_FEATURES= c++11 Modified: head/share/mk/bsd.sys.mk ============================================================================== --- head/share/mk/bsd.sys.mk Sat May 10 16:37:39 2014 (r265828) +++ head/share/mk/bsd.sys.mk Sat May 10 16:37:44 2014 (r265829) @@ -64,7 +64,10 @@ CWARNFLAGS+= -Wno-pointer-sign # Clang has more warnings enabled by default, and when using -Wall, so if WARNS # is set to low values, these have to be disabled explicitly. .if ${WARNS} <= 6 -CWARNFLAGS.clang+= -Wno-empty-body -Wno-string-plus-int -Wno-unused-const-variable +CWARNFLAGS.clang+= -Wno-empty-body -Wno-string-plus-int +.if ${COMPILER_TYPE} == "clang" && ${COMPILER_VERSION} > 30300 +CWARNFLAGS.clang+= -Wno-unused-const-variable +.endif .endif # WARNS <= 6 .if ${WARNS} <= 3 CWARNFLAGS.clang+= -Wno-tautological-compare -Wno-unused-value\