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
This commit is contained in:
Ben Gras 2011-02-16 18:58:30 +00:00
parent 7840456b77
commit 287fee89cb
3 changed files with 11 additions and 1 deletions

View file

@ -16,6 +16,11 @@
#include <minix/vfsif.h> #include <minix/vfsif.h>
/* Is vnode pointer reasonable? */ /* 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 SANEVP(v) ((((v) >= &vnode[0] && (v) < &vnode[NR_VNODES])))
#define BADVP(v, f, l) printf("%s:%d: bad vp %p\n", f, l, v) #define BADVP(v, f, l) printf("%s:%d: bad vp %p\n", f, l, v)
@ -29,6 +34,7 @@
/* vp check that panics */ /* vp check that panics */
#define ASSERTVP(v) if(!SANEVP(v)) { \ #define ASSERTVP(v) if(!SANEVP(v)) { \
BADVP(v, __FILE__, __LINE__); panic("bad vp"); } BADVP(v, __FILE__, __LINE__); panic("bad vp"); }
#endif
/*===========================================================================* /*===========================================================================*
* get_free_vnode * * get_free_vnode *

View file

@ -16,6 +16,10 @@ AFLAGS += ${SMP_FLAGS}
MAKECONF?= /etc/make.conf MAKECONF?= /etc/make.conf
.-include "${MAKECONF}" .-include "${MAKECONF}"
.ifdef NOASSERTS
CFLAGS += -DNDEBUG=1
.endif
# #
# CPU model, derived from MACHINE_ARCH # CPU model, derived from MACHINE_ARCH
# #

View file

@ -8,7 +8,7 @@ then make $@
exit $? exit $?
fi fi
make world make NOASSERTS=yes world
cd tools cd tools
rm revision rm revision
rm /boot/image/* rm /boot/image/*