Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 13 Jan 2009 22:55:20 +0100
From:      Roman Divacky <rdivacky@freebsd.org>
To:        current@freebsd.org
Subject:   [PATCH]: set C dialect when compiling world
Message-ID:  <20090113215520.GA29635@freebsd.org>

next in thread | raw e-mail | index | archive | help

--d6Gm4EdcadzBjdND
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

hi

in my effort to make world compile in gnu99 mode I'd like this
patch to be commited:

Index: bsd.sys.mk
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /home/ncvs/src/share/mk/bsd.sys.mk,v
retrieving revision 1.47
diff -u -r1.47 bsd.sys.mk
--- bsd.sys.mk	23 Jul 2008 06:14:21 -0000	1.47
+++ bsd.sys.mk	13 Jan 2009 21:36:04 -0000
@@ -8,8 +8,11 @@
=20
 # for GCC:  http://gcc.gnu.org/onlinedocs/gcc-3.0.4/gcc_3.html#IDX143
=20
-.if !defined(NO_WARNS) && ${CC} !=3D "icc"
-. if defined(CSTD)
+# the default is gnu89 for now
+. if !defined(CSTD)
+CSTD		=3D gnu89
+. endif
+
 .  if ${CSTD} =3D=3D "k&r"
 CFLAGS		+=3D -traditional
 .  elif ${CSTD} =3D=3D "c89" || ${CSTD} =3D=3D "c90"
@@ -23,7 +26,8 @@
 .  endif
 # -pedantic is problematic because it also imposes namespace restrictions
 #CFLAGS		+=3D -pedantic
-. endif
+
+.if !defined(NO_WARNS) && ${CC} !=3D "icc"
 . if defined(WARNS)
 .  if ${WARNS} >=3D 1
 CWARNFLAGS	+=3D	-Wsystem-headers


the rationale behind this:

we set CSTD to gnu89 so typical {library|app|whatever} build gets added=20
".... -std=3Dgnu89 ...." to its CFLAGS. the command line looks like this for
example:

cc -O2 -pipe -DMALLOC_PRODUCTION -march=3Dnative -I/usr/src/lib/libc/includ=
e -I/usr/src/lib/libc/../../include
-I/usr/src/lib/libc/i386 -D__DBINTERFACE_PRIVATE -I/usr/src/lib/libc/../../=
contrib/gdtoa -DINET6
-I/usr/obj/usr/src/lib/libc -I/usr/src/lib/libc/resolv -DPOSIX_MISTAKE -I/u=
sr/src/lib/libc/locale -DBROKEN_DES
-DPORTMAP -DDES_BUILTIN -I/usr/src/lib/libc/rpc -DYP -DNS_CACHING -DSYMBOL_=
VERSIONING -std=3Dgnu89 -fstack-protector
-Wsystem-headers -Werror -Wall -Wno-format-y2k -Wno-uninitialized -Wno-poin=
ter-sign -c getppid.S

it's nicely hidden in the 4th line near the end ;)

I want this to be able to easily switch the C dialect used for various part=
s of
the world. We dont want to mess with expected C dialect of contributed soft=
ware.
Hence once I switch the default to gnu99 I can just put CSTD=3Dgnu89 to cdd=
l/Makefile
etc. and be fine.=20

note that this change is a nop as gcc defaults to gnu89 mode but we need it=
 because
of the intended switch to gnu89.

comments?

	roman

--d6Gm4EdcadzBjdND
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.10 (FreeBSD)

iEYEARECAAYFAkltDcYACgkQLVEj6D3CBEyBBQCfTfUeVqnwFqlhqA38RG1HciS6
ab8AnR3NQCNcPSFpkBh8MCmjUKj1Cxia
=ASfG
-----END PGP SIGNATURE-----

--d6Gm4EdcadzBjdND--



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