From 287fee89cb5eaf6e40ba59143fcd7509d64f74bb Mon Sep 17 00:00:00 2001 From: Ben Gras Date: Wed, 16 Feb 2011 18:58:30 +0000 Subject: [PATCH] add NOASSERTS make flag that disables assert()s (NDEBUG=1). . made some checks in vfs/vnode.c also respond to NDEBUG=1. . turned on in release builds --- servers/vfs/vnode.c | 6 ++++++ share/mk/bsd.own.mk | 4 ++++ tools/chrootmake.sh | 2 +- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/servers/vfs/vnode.c b/servers/vfs/vnode.c index b98ff2572..9e1a9e03a 100644 --- a/servers/vfs/vnode.c +++ b/servers/vfs/vnode.c @@ -16,6 +16,11 @@ #include /* Is vnode pointer reasonable? */ +#if NDEBUG +#define SANEVP(v) +#define CHECKVN(v) +#define ASSERTVP(v) +#else #define SANEVP(v) ((((v) >= &vnode[0] && (v) < &vnode[NR_VNODES]))) #define BADVP(v, f, l) printf("%s:%d: bad vp %p\n", f, l, v) @@ -29,6 +34,7 @@ /* vp check that panics */ #define ASSERTVP(v) if(!SANEVP(v)) { \ BADVP(v, __FILE__, __LINE__); panic("bad vp"); } +#endif /*===========================================================================* * get_free_vnode * diff --git a/share/mk/bsd.own.mk b/share/mk/bsd.own.mk index f81646817..724ebdf26 100644 --- a/share/mk/bsd.own.mk +++ b/share/mk/bsd.own.mk @@ -16,6 +16,10 @@ AFLAGS += ${SMP_FLAGS} MAKECONF?= /etc/make.conf .-include "${MAKECONF}" +.ifdef NOASSERTS +CFLAGS += -DNDEBUG=1 +.endif + # # CPU model, derived from MACHINE_ARCH # diff --git a/tools/chrootmake.sh b/tools/chrootmake.sh index 4f07698e0..c030dc059 100755 --- a/tools/chrootmake.sh +++ b/tools/chrootmake.sh @@ -8,7 +8,7 @@ then make $@ exit $? fi -make world +make NOASSERTS=yes world cd tools rm revision rm /boot/image/* -- 2.44.0