aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Brown <mcb30@etherboot.org>2006-09-27 11:09:56 +0000
committerMichael Brown <mcb30@etherboot.org>2006-09-27 11:09:56 +0000
commitb16de6ae6670dfd7ef479d4dd76ab75706abc54e (patch)
treeb1abeeec4f8935abb3f510cd45395cd86513d79c
parent88e38fa1483891f273f063f92ef71a5c33fe5406 (diff)
downloadipxe-b16de6ae6670dfd7ef479d4dd76ab75706abc54e.zip
ipxe-b16de6ae6670dfd7ef479d4dd76ab75706abc54e.tar.gz
ipxe-b16de6ae6670dfd7ef479d4dd76ab75706abc54e.tar.bz2
Inhibit compiler warnings on DBG() when building a non-debug object,
while retaining the format string checking.
-rw-r--r--src/include/compiler.h14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/include/compiler.h b/src/include/compiler.h
index 3aee4a6..f4ea32e 100644
--- a/src/include/compiler.h
+++ b/src/include/compiler.h
@@ -123,9 +123,19 @@ __asm__ ( ".equ\t" OBJECT_SYMBOL_STR ", 0" );
__asm__ ( ".equ\tDEBUG_LEVEL, " DEBUG_SYMBOL_STR );
#endif
+/** Do not print
+ *
+ * This function is used only for printf()-style format string
+ * checking. The function body does not exist, and no reference to it
+ * should ever appear in any compiled object.
+ */
+extern int __attribute__ (( format ( printf, 1, 2 ) ))
+__do_not_printf ( const char *fmt, ... );
+
#define DBG_PRINT(...) printf ( __VA_ARGS__ )
-#define DBG_DISCARD(...) do { if ( 0 ) printf ( __VA_ARGS__ ); } while ( 0 )
-/*#define DBG_DISCARD(...) do {} while ( 0 )*/
+#define DBG_DISCARD(...) do { \
+ if ( 0 ) __do_not_printf ( __VA_ARGS__ ); \
+ } while ( 0 )
#define DBG DBG_DISCARD
#define DBG2 DBG_DISCARD