From owner-svn-src-all@FreeBSD.ORG Fri Oct 1 21:00:27 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 981601065672; Fri, 1 Oct 2010 21:00:27 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (cl-327.ede-01.nl.sixxs.net [IPv6:2001:7b8:2ff:146::2]) by mx1.freebsd.org (Postfix) with ESMTP id 555348FC20; Fri, 1 Oct 2010 21:00:27 +0000 (UTC) Received: from [IPv6:2001:7b8:3a7:0:75a8:594d:1806:1e34] (unknown [IPv6:2001:7b8:3a7:0:75a8:594d:1806:1e34]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id 895355C43; Fri, 1 Oct 2010 23:00:26 +0200 (CEST) Message-ID: <4CA64BF1.9080401@FreeBSD.org> Date: Fri, 01 Oct 2010 23:00:33 +0200 From: Dimitry Andric Organization: The FreeBSD Project User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.9.2.11pre) Gecko/20100929 Lanikai/3.1.5pre MIME-Version: 1.0 To: Anonymous References: <201009212141.o8LLfjHX007646@svn.freebsd.org> <86mxqx7q9o.fsf@gmail.com> In-Reply-To: <86mxqx7q9o.fsf@gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r212979 - in head: gnu/lib/libobjc sys/boot/i386/boot2 sys/boot/pc98/boot2 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Oct 2010 21:00:27 -0000 On 2010-10-01 19:54, Anonymous wrote: >> -.if ${CC:T:Mclang} == "clang" >> -CC=gcc >> -.endif >> +CC:=${CC:C/^(.*\/)?clang$/gcc/1} > > How about clearing some user-defined variable together with the substitution > > CLANG_FLAGS = # set to empty value > CC := ${CC:C/^(.*\/)?clang$/gcc/1} > > in which user can store clang-specific flags (via src.conf), e.g. > > CC = clang ${CLANG_FLAGS} > CLANG_FLAGS = -Qunused-arguments # too much noise for `make -s' build > > or > > CPUTYPE ?= native > CLANG_FLAGS = -mno-sse4 # don't feed as(1) unknown opcodes > > Otherwise, substitution occurs too late and gcc(1) chokes on unknown > options. Adding your clang-specific flags to CC will not work, because the CC:=${CC:C/^(.*\/)?clang$/gcc/1} expression explicitly does not filter out any command line arguments. This is needed for the build32 stage on amd64, for instance. Note the -Qunused-arguments flags is really just a quick hack, to stop Clang from warning about unused arguments. It reduces warnings during compilation, but the warnings should in fact be fixed, by not providing redundant arguments anymore. However, it will take a while to do this properly. The particular case of libobjc is special, because it is the only Makefile that both modifies CC, and takes the default CFLAGS from make.conf. The only other cases where we *must* compile with gcc for now, are boot2 for i386 and pc98, but these set their CFLAGS to a hardcoded value. A solution could be to always use hardcoded CFLAGS for libobjc. Otherwise, we could check for a GCC_CFLAGS in libobjc's Makefile, and substitute these for the regular CFLAGS, iff clang is used to build world. Does that sound acceptable?