Clean up debugging code #ifdefs (Eduardo Habkost)
Use macros to avoid #ifdefs on debugging code.
This patch doesn't try to merge logging macros from different files,
but just unify the debugging code #ifdefs onto a macro on each file. A
further cleanup can unify the debugging macros on a common header, later
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6332 c046a42c-6fe2-441c-8c8c-71466251a162
diff --git a/target-cris/mmu.c b/target-cris/mmu.c
index 334b2b6..dd4fb3f 100644
--- a/target-cris/mmu.c
+++ b/target-cris/mmu.c
@@ -32,8 +32,10 @@
#ifdef DEBUG
#define D(x) x
+#define D_LOG(...) fprintf(logfile, ## __VA_ARGS__)
#else
#define D(x)
+#define D_LOG(...) do { } while (0)
#endif
void cris_mmu_init(CPUState *env)
@@ -180,9 +182,8 @@
tlb_pid = EXTRACT_FIELD(hi, 0, 7);
tlb_g = EXTRACT_FIELD(lo, 4, 4);
- D(fprintf(logfile,
- "TLB[%d][%d][%d] v=%x vpage=%x lo=%x hi=%x\n",
- mmu, set, idx, tlb_vpn, vpage, lo, hi));
+ D_LOG("TLB[%d][%d][%d] v=%x vpage=%x lo=%x hi=%x\n",
+ mmu, set, idx, tlb_vpn, vpage, lo, hi);
if ((tlb_g || (tlb_pid == pid))
&& tlb_vpn == vpage) {
match = 1;
@@ -314,9 +315,8 @@
if (tlb_v && !tlb_g && (tlb_pid == pid)) {
vaddr = tlb_vpn << TARGET_PAGE_BITS;
- D(fprintf(logfile,
- "flush pid=%x vaddr=%x\n",
- pid, vaddr));
+ D_LOG("flush pid=%x vaddr=%x\n",
+ pid, vaddr);
tlb_flush_page(env, vaddr);
}
}