summaryrefslogtreecommitdiff
path: root/debug.h
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2007-04-20 02:14:53 +0000
committerJohn Wiegley <johnw@newartisans.com>2008-04-13 03:38:28 -0400
commitb84f676946941df6f7e8476d77d1db0cbe7736c5 (patch)
tree9ee7c7a2d3b7496b38ad127519210adfeced2241 /debug.h
parent539370ff1b37772e9f11439f652ffd3583beeedb (diff)
downloadfork-ledger-b84f676946941df6f7e8476d77d1db0cbe7736c5.tar.gz
fork-ledger-b84f676946941df6f7e8476d77d1db0cbe7736c5.tar.bz2
fork-ledger-b84f676946941df6f7e8476d77d1db0cbe7736c5.zip
Did some optimization and memory cleanup
Diffstat (limited to 'debug.h')
-rw-r--r--debug.h23
1 files changed, 17 insertions, 6 deletions
diff --git a/debug.h b/debug.h
index 842b0e4d..ea53d2cc 100644
--- a/debug.h
+++ b/debug.h
@@ -11,29 +11,38 @@
#define DEBUG_LEVEL NO_SEATBELT
#endif
+#include "trace.h"
+
#if DEBUG_LEVEL >= RELEASE
-#include "error.h"
#ifdef assert
#undef assert
#endif
+
#if DEBUG_LEVEL >= BETA
-void debug_assert(const std::string& reason,
- const std::string& file,
- unsigned long line);
+
+void debug_assert(const ledger::string& reason,
+ const ledger::string& file,
+ unsigned long line);
+
#define assert(x) \
if (! (x)) \
debug_assert(#x, __FILE__, __LINE__)
+
#else
+
#define assert(x) \
if (! (x)) \
throw new fatal_assert(#x, new file_context(__FILE__, __LINE__))
#endif
+
#else
+
#ifdef assert
#undef assert
#endif
#define assert(x)
+
#endif
//////////////////////////////////////////////////////////////////////
@@ -99,8 +108,6 @@ bool _debug_active(const char * const cls);
#define VALIDATE(x)
#endif
-#include "trace.h"
-
#if 0
void * operator new(std::size_t) throw (std::bad_alloc);
void * operator new[](std::size_t) throw (std::bad_alloc);
@@ -134,21 +141,25 @@ void operator delete[](void*, const std::nothrow_t&) throw();
#define assert(x)
#define CONFIRM(x)
+#ifndef TRACE_CTOR
#define TRACE_CTOR(cls)
#define TRACE_DTOR(cls)
#define TRACE(cat, msg)
#define TRACE_PUSH(cat, msg)
#define TRACE_POP(cat, msg)
+#endif
#elif DEBUG_LEVEL == RELEASE
#define CONFIRM(x)
+#ifndef TRACE_CTOR
#define TRACE_CTOR(cls)
#define TRACE_DTOR(cls)
#define TRACE(cat, msg)
#define TRACE_PUSH(cat, msg)
#define TRACE_POP(cat, msg)
+#endif
#elif DEBUG_LEVEL >= BETA