From 4017e592f0d63ca2db873b7da8b8fa8cbe7018a0 Mon Sep 17 00:00:00 2001 From: Christian Helmuth Date: Mon, 1 Oct 2012 12:40:31 +0200 Subject: [PATCH] Compile PDBG() in release mode too Formerly, GENODE_RELEASE just undef'd PDBG() which concealed bugs in places PDBG was used, e.g., do to API changes. Unfortunately, desparately disabling GENODE_RELEASE during bug hunt sometimes introduced new errors. Now, PDBG is just a branch not taken but seen by the compiler, which is able to produce warnings/errors when the API is changed. Fixes #378. --- base/include/base/printf.h | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/base/include/base/printf.h b/base/include/base/printf.h index 3bdb68f597..d3975b1feb 100644 --- a/base/include/base/printf.h +++ b/base/include/base/printf.h @@ -63,21 +63,23 @@ namespace Genode { * otherwise nothing (not even the comma) is appended. */ -/** - * Print debug message with function name - */ -#define PDBG(fmt, ...) \ - Genode::printf("%s: " ESC_DBG fmt ESC_END "\n", \ - __PRETTY_FUNCTION__, ##__VA_ARGS__ ) - /** * Suppress debug messages in release version */ #ifdef GENODE_RELEASE -#undef PDBG -#define PDBG(fmt, ...) +#define DO_PDBG false +#else +#define DO_PDBG true #endif /* GENODE_RELEASE */ +/** + * Print debug message with function name + */ +#define PDBG(fmt, ...) \ + if (DO_PDBG) \ + Genode::printf("%s: " ESC_DBG fmt ESC_END "\n", \ + __PRETTY_FUNCTION__, ##__VA_ARGS__ ) + /** * Print log message */