From 6bbebf8328ef9a0fceb13bc3bec2523263c5c93b Mon Sep 17 00:00:00 2001 From: christos Date: Tue, 17 May 2011 01:12:34 +0000 Subject: [PATCH] Enable c99 mode by default. This has the side effect of complaining for missing prototypes implicit type declarations and missing return statements. NB: I've only ran a build on amd64, so other platforms MI code might break. If you can't wait for me to fix them, revert this commit. --- share/mk/bsd.kmodule.mk | 3 +-- share/mk/bsd.sys.mk | 10 ++++++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/share/mk/bsd.kmodule.mk b/share/mk/bsd.kmodule.mk index 04447c458fbd..7989b91e5b2e 100644 --- a/share/mk/bsd.kmodule.mk +++ b/share/mk/bsd.kmodule.mk @@ -1,4 +1,4 @@ -# $NetBSD: bsd.kmodule.mk,v 1.28 2011/04/17 09:47:40 mrg Exp $ +# $NetBSD: bsd.kmodule.mk,v 1.29 2011/05/17 01:12:34 christos Exp $ # We are not building this with PIE MKPIE=no @@ -17,7 +17,6 @@ CFLAGS+= -ffreestanding ${COPTS} CPPFLAGS+= -nostdinc -I. -I${.CURDIR} -isystem $S -isystem $S/arch CPPFLAGS+= -isystem ${S}/../common/include CPPFLAGS+= -D_KERNEL -D_LKM -D_MODULE -CPPFLAGS+= -std=gnu99 # XXX until the kernel is fixed again... .if (defined(HAVE_GCC) && ${HAVE_GCC} == 4) || defined(HAVE_PCC) diff --git a/share/mk/bsd.sys.mk b/share/mk/bsd.sys.mk index 7d300040e85f..a2728ac20f2a 100644 --- a/share/mk/bsd.sys.mk +++ b/share/mk/bsd.sys.mk @@ -1,4 +1,4 @@ -# $NetBSD: bsd.sys.mk,v 1.193 2010/12/25 18:56:45 joerg Exp $ +# $NetBSD: bsd.sys.mk,v 1.194 2011/05/17 01:12:34 christos Exp $ # # Build definitions used for NetBSD source tree builds. @@ -10,6 +10,13 @@ CPPFLAGS+= -Wp,-iremap,${NETBSDSRCDIR}:/usr/src CPPFLAGS+= -Wp,-iremap,${DESTDIR}/:/ .endif +# Enable c99 mode by default. +# This has the side effect of complaining for missing prototypes +# implicit type declarations and missing return statements. +.if defined(HAVE_GCC) && ${HAVE_GCC} >= 3 +CFLAGS+= -std=gnu99 +.endif + .if defined(WARNS) .if ${WARNS} > 0 CFLAGS+= -Wall -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith @@ -47,7 +54,6 @@ CXXFLAGS+= -Wctor-dtor-privacy -Wnon-virtual-dtor -Wreorder \ .endif .if ${WARNS} > 3 && defined(HAVE_GCC) && ${HAVE_GCC} >= 3 CFLAGS+= -Wsign-compare -CFLAGS+= -std=gnu99 .endif .endif