Procházet zdrojové kódy

Automatically create DBG() macro based on debug_<object> macro.

tags/v0.9.3
Michael Brown před 19 roky
rodič
revize
dcd573afcb
1 změnil soubory, kde provedl 20 přidání a 0 odebrání
  1. 20
    0
      src/include/compiler.h

+ 20
- 0
src/include/compiler.h Zobrazit soubor

29
 __asm__ ( ".globl\t" OBJECT_SYMBOL_STR );
29
 __asm__ ( ".globl\t" OBJECT_SYMBOL_STR );
30
 __asm__ ( ".equ\t" OBJECT_SYMBOL_STR ", 0" );
30
 __asm__ ( ".equ\t" OBJECT_SYMBOL_STR ", 0" );
31
 
31
 
32
+/*
33
+ * Macro to allow objects to explicitly drag in other objects by
34
+ * object name.  Used by config.c.
35
+ *
36
+ */
32
 #define REQUIRE_OBJECT(object) \
37
 #define REQUIRE_OBJECT(object) \
33
 	__asm__ ( ".equ\tneed_" #object ", obj_" #object );
38
 	__asm__ ( ".equ\tneed_" #object ", obj_" #object );
34
 
39
 
40
+/*
41
+ * If debug_OBJECT is set to a true value, the macro DBG(...) will
42
+ * expand to printf(...) when compiling OBJECT, and the symbol
43
+ * WITH_DEBUG_MESSAGES will be inserted into the object file.
44
+ *
45
+ */
46
+#define DEBUG_SYMBOL _H2 ( debug_, OBJECT )
47
+#if DEBUG_SYMBOL
48
+#define DBG(...) printf ( __VA_ARGS__ )
49
+#define DEBUG_SYMBOL_STR _XSTR ( DEBUG_SYMBOL )
50
+__asm__ ( ".equ\tWITH_DEBUG_MESSAGES, 0" );
51
+#else
52
+#define DBG(...)
53
+#endif
54
+
35
 #define PACKED __attribute__((packed))
55
 #define PACKED __attribute__((packed))
36
 #define __unused __attribute__((unused))
56
 #define __unused __attribute__((unused))
37
 #define __used __attribute__((used))
57
 #define __used __attribute__((used))

Načítá se…
Zrušit
Uložit