summaryrefslogtreecommitdiffstats
path: root/src/include/compiler.h
diff options
context:
space:
mode:
authorMichael Brown2005-04-25 18:28:07 +0200
committerMichael Brown2005-04-25 18:28:07 +0200
commitf972f256e69c955f2dd23145331588265ac34ad7 (patch)
treed5b7730981e75a41fca01d1afa80eaa57084642f /src/include/compiler.h
parentPrevent hundreds of errors from "make symcheck". The prefix exit path (diff)
downloadipxe-f972f256e69c955f2dd23145331588265ac34ad7.tar.gz
ipxe-f972f256e69c955f2dd23145331588265ac34ad7.tar.xz
ipxe-f972f256e69c955f2dd23145331588265ac34ad7.zip
Allow for multiple debug levels
Diffstat (limited to 'src/include/compiler.h')
-rw-r--r--src/include/compiler.h23
1 files changed, 18 insertions, 5 deletions
diff --git a/src/include/compiler.h b/src/include/compiler.h
index 58422d65..6aa1f9e7 100644
--- a/src/include/compiler.h
+++ b/src/include/compiler.h
@@ -40,17 +40,30 @@ __asm__ ( ".equ\t" OBJECT_SYMBOL_STR ", 0" );
/*
* If debug_OBJECT is set to a true value, the macro DBG(...) will
* expand to printf(...) when compiling OBJECT, and the symbol
- * WITH_DEBUG_MESSAGES will be inserted into the object file.
+ * DEBUG_LEVEL will be inserted into the object file.
*
*/
#define DEBUG_SYMBOL _H2 ( debug_, OBJECT )
+
#if DEBUG_SYMBOL
#include "console.h"
-#define DBG(...) printf ( __VA_ARGS__ )
#define DEBUG_SYMBOL_STR _XSTR ( DEBUG_SYMBOL )
-__asm__ ( ".equ\tWITH_DEBUG_MESSAGES, 0" );
-#else
-#define DBG(...)
+__asm__ ( ".equ\tDEBUG_LEVEL, " DEBUG_SYMBOL_STR );
+#endif
+
+#define DBG_PRINT(...) printf ( __VA_ARGS__ )
+#define DBG_DISCARD(...)
+#define DBG DBG_DISCARD
+#define DBG2 DBG_DISCARD
+
+#if DEBUG_SYMBOL >= 1
+#undef DBG
+#define DBG DBG_PRINT
+#endif
+
+#if DEBUG_SYMBOL >= 2
+#undef DBG2
+#define DBG2 DBG_PRINT
#endif
#define PACKED __attribute__((packed))