Просмотр исходного кода

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

tags/v0.9.3
Michael Brown 19 лет назад
Родитель
Сommit
dcd573afcb
1 измененных файлов: 20 добавлений и 0 удалений
  1. 20
    0
      src/include/compiler.h

+ 20
- 0
src/include/compiler.h Просмотреть файл

@@ -29,9 +29,29 @@
29 29
 __asm__ ( ".globl\t" OBJECT_SYMBOL_STR );
30 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 37
 #define REQUIRE_OBJECT(object) \
33 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 55
 #define PACKED __attribute__((packed))
36 56
 #define __unused __attribute__((unused))
37 57
 #define __used __attribute__((used))

Загрузка…
Отмена
Сохранить