svn commit: r198335 - head/share/mk
Ruslan Ermilov
ru at FreeBSD.org
Thu Oct 22 11:48:38 UTC 2009
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 at FreeBSD.org
FreeBSD committer
More information about the svn-src-all
mailing list