Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 16 Mar 2003 14:52:02 +0100
From:      des@ofug.org (Dag-Erling =?iso-8859-1?q?Sm=F8rgrav?=)
To:        arch@freebsd.org
Cc:        Maxime Henrion <mux@freebsd.org>
Subject:   Re: WARNS=6 changes
Message-ID:  <xzpllzfctbx.fsf@flood.ping.uio.no>
In-Reply-To: <xzpof4bcu8b.fsf@flood.ping.uio.no> (des@ofug.org's message of "Sun, 16 Mar 2003 14:32:36 %2B0100")
References:  <20030313192045.GG3819@elvis.mu.org> <20030316062315.GA75492@dragon.nuxi.com> <xzpof4bcu8b.fsf@flood.ping.uio.no>

next in thread | previous in thread | raw e-mail | index | archive | help
--=-=-=
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable

des@ofug.org (Dag-Erling Sm=F8rgrav) writes:
> Hmm, I think it should be a separate knob.  We can merge it into WARNS
> later, but for now, we should just remove -ansi / -pedantic from
> WARNS, and add a CSTD knob which can be either c89 or c99.

See the attached patch.

DES
--=20
Dag-Erling Smorgrav - des@ofug.org


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment; filename=cstd.diff

Index: bsd.sys.mk
===================================================================
RCS file: /home/ncvs/src/share/mk/bsd.sys.mk,v
retrieving revision 1.11
diff -u -r1.11 bsd.sys.mk
--- bsd.sys.mk	13 Nov 2002 13:49:29 -0000	1.11
+++ bsd.sys.mk	16 Mar 2003 13:39:28 -0000
@@ -9,6 +9,17 @@
 # for GCC:  http://gcc.gnu.org/onlinedocs/gcc-3.0.4/gcc_3.html#IDX143
 
 .if !defined(NO_WARNS)
+. if defined(CSTD)
+.  if ${CSTD} == "K&R"
+CFLAGS		+= -traditional
+.  elsif ${CSTD} == "c89" || ${CSTD} == "c90"
+CFLAGS		+= -std=iso9899:1990
+.  elsif ${CSTD} == "c94" || ${CSTD} == "c95"
+CFLAGS		+= -std=iso9899:199409
+.  elsif ${CSTD} == "c99"
+CFLAGS		+= -std=iso9899:1999
+.  endif
+. endif
 . if defined(WARNS)
 .  if ${WARNS} > 0
 .   if !defined(NO_WERROR)
@@ -19,17 +30,20 @@
 CFLAGS		+=	-Wall -Wno-format-y2k
 .  endif
 .  if ${WARNS} > 2
-CFLAGS		+=	-W -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith
+CFLAGS		+=	-W -Wstrict-prototypes -Wmissing-prototypes \
+			-Wpointer-arith
 .  endif
 .  if ${WARNS} > 3
-CFLAGS		+=	-Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wcast-align
+CFLAGS		+=	-Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch \
+			-Wshadow -Wcast-align
 .  endif
 .  if ${WARNS} > 4
 CFLAGS		+=	-Wuninitialized
 .  endif
 # BDECFLAGS
 .  if ${WARNS} > 5
-CFLAGS		+=	-ansi -pedantic -Wbad-function-cast -Wchar-subscripts -Winline -Wnested-externs -Wredundant-decls
+CFLAGS		+=	-pedantic -Wbad-function-cast -Wchar-subscripts \
+			-Winline -Wnested-externs -Wredundant-decls
 .  endif
 .  if ${WARNS} > 1 && ${WARNS} < 5
 # XXX Delete -Wuninitialized by default for now -- the compiler doesn't
@@ -43,7 +57,8 @@
 . endif
 . if defined(WFORMAT)
 .  if ${WFORMAT} > 0
-#CFLAGS		+=	-Wformat-nonliteral -Wformat-security -Wno-format-extra-args
+#CFLAGS		+=	-Wformat-nonliteral -Wformat-security \
+#			-Wno-format-extra-args
 CFLAGS		+=	-Wformat=2 -Wno-format-extra-args
 .   if !defined(NO_WERROR)
 CFLAGS		+=	-Werror

--=-=-=--

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-arch" in the body of the message




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