Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 23 Dec 2011 00:46:23 +0000
From:      Alexander Best <arundel@freebsd.org>
To:        Dimitry Andric <dim@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
Message-ID:  <20111223004623.GA63192@freebsd.org>
In-Reply-To: <20111223004341.GA59309@freebsd.org>
References:  <201112230023.pBN0NbRJ040161@svn.freebsd.org> <20111223004341.GA59309@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri Dec 23 11, Alexander Best wrote:
> 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
> >  
> >  #

> 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

s/-Wno-tautological-compare/-Wno-error-tautological-compare/

sorry.

> +.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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20111223004623.GA63192>