aboutsummaryrefslogtreecommitdiffstats
path: root/libmaple/util.h
diff options
context:
space:
mode:
authorbnewbold <bnewbold@robocracy.org>2010-09-05 19:11:01 -0400
committerbnewbold <bnewbold@robocracy.org>2010-09-05 22:59:16 -0400
commit340cdc7966fbda1a28ce011cbaaeb6878b0b6064 (patch)
treee14de3f9d6db73fa7d015214b675ca31c250895f /libmaple/util.h
parentb6e3624a705b36b15e7f4c0637d133c7dab059bd (diff)
downloadlibrambutan-340cdc7966fbda1a28ce011cbaaeb6878b0b6064.tar.gz
librambutan-340cdc7966fbda1a28ce011cbaaeb6878b0b6064.zip
debug verbosity levels
Diffstat (limited to 'libmaple/util.h')
-rw-r--r--libmaple/util.h23
1 files changed, 20 insertions, 3 deletions
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