From 340cdc7966fbda1a28ce011cbaaeb6878b0b6064 Mon Sep 17 00:00:00 2001 From: bnewbold Date: Sun, 5 Sep 2010 19:11:01 -0400 Subject: debug verbosity levels --- libmaple/util.h | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) (limited to 'libmaple/util.h') diff --git a/libmaple/util.h b/libmaple/util.h index 053731a..63e305d 100644 --- a/libmaple/util.h +++ b/libmaple/util.h @@ -32,6 +32,8 @@ #ifndef _UTIL_H_ #define _UTIL_H_ +#include "libmaple.h" + #define BIT(shift) (1 << (shift)) #define BIT_MASK_SHIFT(mask, shift) ((mask) << (shift)) @@ -70,9 +72,14 @@ void _fail(const char*, int, const char*); #endif -/* Assert for sanity checks, undefine MAPLE_DEBUG to compile - * out these checks */ -#if MAPLE_DEBUG +// Asserts for sanity checks, redefine DEBUG_LEVEL in libmaple.h to compile out +// these checks + +#define DEBUG_NONE 0 +#define DEBUG_FAULT 1 +#define DEBUG_ALL 2 + +#if DEBUG_LEVEL >= DEBUG_ALL #define ASSERT(exp) \ if (exp) \ {} \ @@ -82,5 +89,15 @@ void _fail(const char*, int, const char*); #define ASSERT(exp) (void)((0)) #endif +#if DEBUG_LEVEL >= DEBUG_FAULT +#define ASSERT_FAULT(exp) \ + if (exp) \ + {} \ + else \ + _fail(__FILE__, __LINE__, #exp) +#else +#define ASSERT_FAULT(exp) (void)((0)) +#endif + #endif -- cgit v1.2.3