From owner-svn-src-head@FreeBSD.ORG Fri Dec 23 00:43:41 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 1233) id C16201065670; Fri, 23 Dec 2011 00:43:41 +0000 (UTC) Date: Fri, 23 Dec 2011 00:43:41 +0000 From: Alexander Best To: Dimitry Andric Message-ID: <20111223004341.GA59309@freebsd.org> References: <201112230023.pBN0NbRJ040161@svn.freebsd.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="vkogqOf2sHV7VnPd" Content-Disposition: inline In-Reply-To: <201112230023.pBN0NbRJ040161@svn.freebsd.org> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r228822 - head/sys/conf X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 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: Fri, 23 Dec 2011 00:43:41 -0000 --vkogqOf2sHV7VnPd Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Fri Dec 23 11, Dimitry Andric wrote: > Author: dim > Date: Fri Dec 23 00:23:37 2011 > New Revision: 228822 > URL: http://svn.freebsd.org/changeset/base/228822 > > Log: > When building the kernel with clang, it produces several warnings which > might be useful in some cases, but which are not severe enough to error > out the whole kernel build. Display them anyway, so there is at least > some incentive to fix them eventually. > > Start with -Wtautological-compare warnings. These usually occur when > people check if unsigned quantities are negative, or similar cases. To > clean these up would be painful, and might give problems if the base > type which is compared against changes to signed later on. ... or is signed on one arch, but unsigned on another. ;) any reason you add -Wno-error-tautological-compare to CWARNFLAGS seperately and not in the upper CWARNFLAGS?= definition? the way you implemented it here makes it impossible to specify custom CWARNFLAGS, where users might want to keep -Wtautological-compare as an error and not turn it into a warning. i already sent you the following patch, which takes a different approach towards the issue you're trying to solve. of course it's debatable, whether -Wno-error-tautological-compare should be mandatory, or not. -fno-strict-aliasing e.g. is a flag which also gets appended (only to COPTFLAGS) even when users set custom COPTFLAGS cheers. alex > > MFC after: 1 week > > Modified: > head/sys/conf/kern.mk > > Modified: head/sys/conf/kern.mk > ============================================================================== > --- head/sys/conf/kern.mk Fri Dec 23 00:19:17 2011 (r228821) > +++ head/sys/conf/kern.mk Fri Dec 23 00:23:37 2011 (r228822) > @@ -19,6 +19,10 @@ NO_WCONSTANT_CONVERSION= -Wno-constant-c > NO_WARRAY_BOUNDS= -Wno-array-bounds > NO_WSHIFT_COUNT_NEGATIVE= -Wno-shift-count-negative > NO_WSHIFT_COUNT_OVERFLOW= -Wno-shift-count-overflow > +# Several other warnings which might be useful in some cases, but not severe > +# enough to error out the whole kernel build. Display them anyway, so there is > +# some incentive to fix them eventually. > +CWARNFLAGS+= -Wno-error-tautological-compare > .endif > > # --vkogqOf2sHV7VnPd Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="kern.conf.diff" Index: conf/kern.mk =================================================================== --- conf/kern.mk (revision 228556) +++ conf/kern.mk (working copy) @@ -1,12 +1,24 @@ # $FreeBSD$ # +# Clang implies -Wtautological-compare when -Wall was specified. Since this +# will produce errors for valid code, we need to disable -Wtautological-compare. +# GCC doesn't recognize this warning, nor does it have a similar warning flag. +# However specifying -Wextra implies -Wtautological-compare semantics. +# +.if ${CC:T:Mclang} == "clang" +NO_TAUTCOMP= -Wno-tautological-compare +.else +NO_TAUTCOMP= +.endif + +# # Warning flags for compiling the kernel and components of the kernel: # CWARNFLAGS?= -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes \ -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual \ -Wundef -Wno-pointer-sign -fformat-extensions \ - -Wmissing-include-dirs -fdiagnostics-show-option + -Wmissing-include-dirs -fdiagnostics-show-option ${NO_TAUTCOMP} # # The following flags are next up for working on: # -Wextra --vkogqOf2sHV7VnPd--