Added two new macros, ASSERT(), and DIE().

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2048 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2002-11-21 20:15:25 +00:00
parent eac71506d6
commit 537e538aa6
+10 -1
View File
@@ -22,7 +22,8 @@
#endif #endif
// Which debugger should be used when? // Which debugger should be used when?
// The DEBUGGER() macro actually has no effect if DEBUG is not defined... // The DEBUGGER() macro actually has no effect if DEBUG is not defined,
// use the DIE() macro if you really want to die.
#ifdef DEBUG #ifdef DEBUG
# ifdef USER # ifdef USER
# define DEBUGGER(x) debugger x # define DEBUGGER(x) debugger x
@@ -33,6 +34,12 @@
# define DEBUGGER(x) ; # define DEBUGGER(x) ;
#endif #endif
#ifdef USER
# define DIE(x) debugger x
#else
# define DIE(x) kernel_debugger x
#endif
// Short overview over the debug output macros: // Short overview over the debug output macros:
// PRINT() // PRINT()
// is for general messages that very unlikely should appear in a release build // is for general messages that very unlikely should appear in a release build
@@ -58,6 +65,7 @@
#define FUNCTION() ; #define FUNCTION() ;
// #define FUNCTION_START(x) ; // #define FUNCTION_START(x) ;
#define D(x) {x;}; #define D(x) {x;};
#define ASSERT(x) { if (!(x)) DEBUGGER(("bfs: assert failed: " #x "\n")); }
#else #else
#define PRINT(x) ; #define PRINT(x) ;
#define REPORT_ERROR(status) ; #define REPORT_ERROR(status) ;
@@ -67,6 +75,7 @@
#define FUNCTION() ; #define FUNCTION() ;
#define FUNCTION_START(x) ; #define FUNCTION_START(x) ;
#define D(x) ; #define D(x) ;
#define ASSERT(x) ;
#endif #endif
#ifdef DEBUG #ifdef DEBUG