Bladeren bron

Allow for multiple debug levels

tags/v0.9.3
Michael Brown 19 jaren geleden
bovenliggende
commit
f972f256e6
1 gewijzigde bestanden met toevoegingen van 18 en 5 verwijderingen
  1. 18
    5
      src/include/compiler.h

+ 18
- 5
src/include/compiler.h Bestand weergeven

@@ -40,17 +40,30 @@ __asm__ ( ".equ\t" OBJECT_SYMBOL_STR ", 0" );
40 40
 /*
41 41
  * If debug_OBJECT is set to a true value, the macro DBG(...) will
42 42
  * expand to printf(...) when compiling OBJECT, and the symbol
43
- * WITH_DEBUG_MESSAGES will be inserted into the object file.
43
+ * DEBUG_LEVEL will be inserted into the object file.
44 44
  *
45 45
  */
46 46
 #define DEBUG_SYMBOL _H2 ( debug_, OBJECT )
47
+
47 48
 #if DEBUG_SYMBOL
48 49
 #include "console.h"
49
-#define DBG(...) printf ( __VA_ARGS__ )
50 50
 #define DEBUG_SYMBOL_STR _XSTR ( DEBUG_SYMBOL )
51
-__asm__ ( ".equ\tWITH_DEBUG_MESSAGES, 0" );
52
-#else
53
-#define DBG(...)
51
+__asm__ ( ".equ\tDEBUG_LEVEL, " DEBUG_SYMBOL_STR );
52
+#endif
53
+
54
+#define DBG_PRINT(...) printf ( __VA_ARGS__ )
55
+#define DBG_DISCARD(...)
56
+#define DBG  DBG_DISCARD
57
+#define DBG2 DBG_DISCARD
58
+
59
+#if DEBUG_SYMBOL >= 1
60
+#undef DBG
61
+#define DBG DBG_PRINT
62
+#endif
63
+
64
+#if DEBUG_SYMBOL >= 2
65
+#undef DBG2
66
+#define DBG2 DBG_PRINT
54 67
 #endif
55 68
 
56 69
 #define PACKED __attribute__((packed))

Laden…
Annuleren
Opslaan