summaryrefslogtreecommitdiffstats
path: root/src/include/compiler.h
diff options
context:
space:
mode:
authorMichael Brown2005-04-14 13:35:45 +0200
committerMichael Brown2005-04-14 13:35:45 +0200
commitdcd573afcb28574182bdba73bfe3c04b9395c3d9 (patch)
treea0d927bc3652601391996d30ac0112dc4871e32b /src/include/compiler.h
parentUse the magic of common symbols to allow struct dev to effectively grow at (diff)
downloadipxe-dcd573afcb28574182bdba73bfe3c04b9395c3d9.tar.gz
ipxe-dcd573afcb28574182bdba73bfe3c04b9395c3d9.tar.xz
ipxe-dcd573afcb28574182bdba73bfe3c04b9395c3d9.zip
Automatically create DBG() macro based on debug_<object> macro.
Diffstat (limited to 'src/include/compiler.h')
-rw-r--r--src/include/compiler.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/include/compiler.h b/src/include/compiler.h
index 401d4e45..82aea0e3 100644
--- a/src/include/compiler.h
+++ b/src/include/compiler.h
@@ -29,9 +29,29 @@
__asm__ ( ".globl\t" OBJECT_SYMBOL_STR );
__asm__ ( ".equ\t" OBJECT_SYMBOL_STR ", 0" );
+/*
+ * Macro to allow objects to explicitly drag in other objects by
+ * object name. Used by config.c.
+ *
+ */
#define REQUIRE_OBJECT(object) \
__asm__ ( ".equ\tneed_" #object ", obj_" #object );
+/*
+ * 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.
+ *
+ */
+#define DEBUG_SYMBOL _H2 ( debug_, OBJECT )
+#if DEBUG_SYMBOL
+#define DBG(...) printf ( __VA_ARGS__ )
+#define DEBUG_SYMBOL_STR _XSTR ( DEBUG_SYMBOL )
+__asm__ ( ".equ\tWITH_DEBUG_MESSAGES, 0" );
+#else
+#define DBG(...)
+#endif
+
#define PACKED __attribute__((packed))
#define __unused __attribute__((unused))
#define __used __attribute__((used))