Message ID | 1361420711-15698-7-git-send-email-afaerber@suse.de |
---|---|
State | New |
Headers | show |
Andreas Färber <afaerber@suse.de> writes: > Make LOG_DISAS() arguments compile-testable even if disabled. > > Signed-off-by: Andreas Färber <afaerber@suse.de> > --- > target-alpha/translate.c | 14 ++++++++++++-- > 1 Datei geändert, 12 Zeilen hinzugefügt(+), 2 Zeilen entfernt(-) > > diff --git a/target-alpha/translate.c b/target-alpha/translate.c > index f687b95..32fe056 100644 > --- a/target-alpha/translate.c > +++ b/target-alpha/translate.c > @@ -30,11 +30,21 @@ > #define CONFIG_SOFTFLOAT_INLINE > > #ifdef ALPHA_DEBUG_DISAS > -# define LOG_DISAS(...) qemu_log_mask(CPU_LOG_TB_IN_ASM, ## __VA_ARGS__) > +static const bool debug_disas = true; > #else > -# define LOG_DISAS(...) do { } while (0) > +static const bool debug_disas; > #endif > > +static void GCC_FMT_ATTR(1, 2) LOG_DISAS(const char *fmt, ...) > +{ > + if (debug_disas) { > + va_list ap; > + va_start(ap, fmt); > + qemu_log_mask_vprintf(CPU_LOG_TB_IN_ASM, fmt, ap); > + va_end(ap); > + } > +} > + > typedef struct DisasContext DisasContext; > struct DisasContext { > struct TranslationBlock *tb; All-caps function names aren't explicitly forbidden by CODING_STYLE, probably just because "nobody would do that". Keeping the name avoids touching call sites. For alpha, there's just one. Sure you want to keep the ugly name?
diff --git a/target-alpha/translate.c b/target-alpha/translate.c index f687b95..32fe056 100644 --- a/target-alpha/translate.c +++ b/target-alpha/translate.c @@ -30,11 +30,21 @@ #define CONFIG_SOFTFLOAT_INLINE #ifdef ALPHA_DEBUG_DISAS -# define LOG_DISAS(...) qemu_log_mask(CPU_LOG_TB_IN_ASM, ## __VA_ARGS__) +static const bool debug_disas = true; #else -# define LOG_DISAS(...) do { } while (0) +static const bool debug_disas; #endif +static void GCC_FMT_ATTR(1, 2) LOG_DISAS(const char *fmt, ...) +{ + if (debug_disas) { + va_list ap; + va_start(ap, fmt); + qemu_log_mask_vprintf(CPU_LOG_TB_IN_ASM, fmt, ap); + va_end(ap); + } +} + typedef struct DisasContext DisasContext; struct DisasContext { struct TranslationBlock *tb;
Make LOG_DISAS() arguments compile-testable even if disabled. Signed-off-by: Andreas Färber <afaerber@suse.de> --- target-alpha/translate.c | 14 ++++++++++++-- 1 Datei geändert, 12 Zeilen hinzugefügt(+), 2 Zeilen entfernt(-)