Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 22 Oct 2009 15:48:32 +0400
From:      Ruslan Ermilov <ru@FreeBSD.org>
To:        Roman Divacky <rdivacky@FreeBSD.org>
Cc:        svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org
Subject:   Re: svn commit: r198335 - head/share/mk
Message-ID:  <20091022114832.GA21442@edoofus.dev.vega.ru>
In-Reply-To: <20091022070638.GA97875@freebsd.org>
References:  <200910211707.n9LH7kHx005204@svn.freebsd.org> <20091021210707.GB5410@edoofus.dev.vega.ru> <20091022070638.GA97875@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Hi,

On Thu, Oct 22, 2009 at 09:06:38AM +0200, Roman Divacky wrote:
> On Thu, Oct 22, 2009 at 01:07:07AM +0400, Ruslan Ermilov wrote:
> > On Wed, Oct 21, 2009 at 05:07:46PM +0000, Roman Divacky wrote:
> > > Author: rdivacky
> > > Date: Wed Oct 21 17:07:46 2009
> > > New Revision: 198335
> > > URL: http://svn.freebsd.org/changeset/base/198335
> > > 
> > > Log:
> > >   Set CSTD in all cases except when CC=icc and NO_WARNS is set. This
> > >   way we can set desired C standard even for cross tools etc.
> > >   
> > I think you meant to say "always set CFLAGS based on CSTD".
> > Unfortunately the actual change does not only that, it also
> > breaks NO_WARNS (by ignoring it) for anything that's not "icc".
> 
> yes, it sets the C standard regardless of NO_WARNS

But it does NOT only that, it also causes NO_WARNS to be a no-op
(see below).

> > It also breaks "icc" compiles without NO_WARNS by passing
> > unrecognized flags to the compiler.  A correct change would
> > be to move setting of CFLAGS based on CSTD out of the control
> > of NO_WARNS, like this:
> 
> previously it did:
> 
> NO_WARNS ICC	CFLAGS includes CSTD
> 0	 0	1
> 0	 1	0
> 1	 0	0
> 1	 1	0
> 
> 
> now it does
> 
> NO_WARNS ICC	CFLAGS includes CSTD
> 0	 0	1
> 0	 1	1
> 1	 0	1
> 1	 1	0
> 
> so you are saying that for ICC and !NO_WARNS the CFLAGS should not
> include CSTD? ie:
> 
> NO_WARNS ICC	CFLAGS includes CSTD
> 0	 0	1
> 0	 1	0
> 1	 0	1
> 1	 1	0
> 
> am I right? my intention was to set the C standard regardless of NO_WARNS
> for "clang" (because it default to C99 and gcc breaks with it).

I understand your intentions.  icc has different command-line options
to support conformance to standards, mostly incompatible with gcc.
>From a manpage:

: -ansi
:     Support all ANSI standard C programs, equivalent to the -ansi option of gcc. 
: -[no-]c99
:     Enable [disable] C99 support for C programs. 
: -std=c99
:     Enable C99 support for C programs 
: -strict-ansi
:     Select strict ANSI C/C++ conformance dialect 

> feel free to fix my commit if this is the case

Your commit also causes warning options (those starting with -W) to leak
into CFLAGS when NO_WARNS is set, thus making NO_WARNS a no-op, and that
is a bigger problem I was talking about.

Before your change:
# make -f bsd.own.mk -f bsd.sys.mk WARNS=6 -DNO_WARNS CSTD=c99 -V CFLAGS
-O2 -pipe  -fstack-protector 

After your change:
# make -f bsd.own.mk -f bsd.sys.mk WARNS=6 -DNO_WARNS CSTD=c99 -V CFLAGS
-O2 -pipe  -std=iso9899:1999 -fstack-protector -Wsystem-headers -Werror -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wcast-align -Wunused-parameter -Wchar-subscripts -Winline -Wnested-externs -Wredundant-decls -Wno-pointer-sign

With my fix:
# make -f bsd.own.mk -f bsd.sys.mk WARNS=6 -DNO_WARNS CSTD=c99 -V CFLAGS
-O2 -pipe  -std=iso9899:1999 -fstack-protector 

FYI, I've committed my fix.


Cheers,
-- 
Ruslan Ermilov
ru@FreeBSD.org
FreeBSD committer



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