From 24ea7f3ece30a586a149dfb60c49b6a6f92dd17e Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Mon, 20 Jun 2011 21:19:17 -0700 Subject: dprintf: add the ability to log to stdio Add the ability to redirect dprintf to stdio when there is no other choice. Signed-off-by: H. Peter Anvin --- com32/include/dprintf.h | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'com32/include/dprintf.h') diff --git a/com32/include/dprintf.h b/com32/include/dprintf.h index 30a21ada..4bdf7a76 100644 --- a/com32/include/dprintf.h +++ b/com32/include/dprintf.h @@ -7,15 +7,29 @@ #ifdef DEBUG -#include +# include +# ifdef DEBUG_STDIO +# define dprintf printf +# define vdprintf vprintf +# else void dprintf(const char *, ...); void vdprintf(const char *, va_list); +# endif + +# if DEBUG >= 2 +/* Really verbose debugging... */ +# define dprintf2 dprintf +# define vdprintf2 vdprintf +# else +# define dprintf2(fmt, ...) ((void)(0)) +# define vdprintf2(fmt, ap) ((void)(0)) +# endif #else -#define dprintf(fmt, ...) ((void)(0)) -#define vdprintf(fmt, ap) ((void)(0)) +# define dprintf(fmt, ...) ((void)(0)) +# define vdprintf(fmt, ap) ((void)(0)) #endif /* DEBUG */ -- cgit v1.2.1 From b61f33c5b80f3a957095717775da4908a1e5ada6 Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Mon, 20 Jun 2011 21:33:38 -0700 Subject: dprintf: always define dprintf2/vdprintf2 Always define dprintf2/vdprintf2 even with no debugging at all enabled. Signed-off-by: H. Peter Anvin --- com32/include/dprintf.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'com32/include/dprintf.h') diff --git a/com32/include/dprintf.h b/com32/include/dprintf.h index 4bdf7a76..b8a3b84c 100644 --- a/com32/include/dprintf.h +++ b/com32/include/dprintf.h @@ -17,6 +17,13 @@ void dprintf(const char *, ...); void vdprintf(const char *, va_list); # endif +#else + +# define dprintf(fmt, ...) ((void)(0)) +# define vdprintf(fmt, ap) ((void)(0)) + +#endif /* DEBUG */ + # if DEBUG >= 2 /* Really verbose debugging... */ # define dprintf2 dprintf @@ -26,11 +33,4 @@ void vdprintf(const char *, va_list); # define vdprintf2(fmt, ap) ((void)(0)) # endif -#else - -# define dprintf(fmt, ...) ((void)(0)) -# define vdprintf(fmt, ap) ((void)(0)) - -#endif /* DEBUG */ - #endif /* _DPRINTF_H */ -- cgit v1.2.1