Skip to contentSkip to conversation

target-mips: fix get_physical_address() #if 0 build error

PATCH Applied Yongbok Kim 4 participants 4 messages Aug 27, 2013 – Aug 28, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 target-mips: fix get_physical_address() #if 0 build error

From: James Hogan <[email protected]>

In get_physical_address() is a qemu_log() call inside an #if 0 block. When enabled the following build error is hit:

target-mips/helper.c In function ‘get_physical_address’:
target-mips/helper.c:220:13: error: format ‘%x’ expects argument of type ‘unsigned int’, but argument 5 has type ‘hwaddr’ [-Werror=format]

Fix the *physical (hwaddr) formatting by using "%"HWADDR_PRIx instead of TARGET_FMT_lx.

---
 target-mips/helper.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
target-mips/helper.c +1 -1
index 6feef7b..33e0e88 100644
@@ -193,7 +193,7 @@ static int get_physical_address (CPUMIPSState *env, hwaddr *physical,
         }
     }
 #if 0
-    qemu_log(TARGET_FMT_lx " %d %d => " TARGET_FMT_lx " %d (%d)\n",
+    qemu_log(TARGET_FMT_lx " %d %d => %" HWADDR_PRIx " %d (%d)\n",
             address, rw, access_type, *physical, *prot, ret);
 #endif
 
Signature · 1 line
1.7.4
#1 lore raw

target-mips/helper.c static int get_physical_address (CPUMIPSState *env, hwaddr *physical, · line 198

Quoted 5 lines · Yongbok Kim

#if 0

target-mips/helper.c +1 -1
-    qemu_log(TARGET_FMT_lx " %d %d => " TARGET_FMT_lx " %d (%d)\n",
+    qemu_log(TARGET_FMT_lx " %d %d => %" HWADDR_PRIx " %d (%d)\n",
             address, rw, access_type, *physical, *prot, ret);
 #endif

While by itself correct, consider converting this to the trace infrastructure (with uint64_t instead of hwaddr).

If it's not worth a trace, it's probably not worth keeping at all.

r~

#2 lore raw
Quoted 11 lines · Richard Henderson

target-mips/helper.c static int get_physical_address (CPUMIPSState *env, hwaddr *physical, · line 198

Quoted 5 lines · Yongbok Kim

#if 0

target-mips/helper.c +1 -1
-    qemu_log(TARGET_FMT_lx " %d %d => " TARGET_FMT_lx " %d (%d)\n",
+    qemu_log(TARGET_FMT_lx " %d %d => %" HWADDR_PRIx " %d (%d)\n",
             address, rw, access_type, *physical, *prot, ret);
 #endif

While by itself correct, consider converting this to the trace infrastructure (with uint64_t instead of hwaddr).

If it's not worth a trace, it's probably not worth keeping at all.

True. I suspect it isn't worth a trace (I just happened to be modifying that function so tried it out to test my changes - and anybody doing that can easily add a temporary qemu_log/fprintf message themselves).

Cheers
James

#3 lore raw
In reply to Yongbok Kim
Quoted 23 lines · Yongbok Kim

From: James Hogan <[email protected]>

In get_physical_address() is a qemu_log() call inside an #if 0 block. When enabled the following build error is hit:

target-mips/helper.c In function ‘get_physical_address’:
target-mips/helper.c:220:13: error: format ‘%x’ expects argument of type ‘unsigned int’, but argument 5 has type ‘hwaddr’ [-Werror=format]

Fix the *physical (hwaddr) formatting by using "%"HWADDR_PRIx instead of TARGET_FMT_lx.

---
 target-mips/helper.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
target-mips/helper.c +0 -0
index 6feef7b..33e0e88 100644

target-mips/helper.c static int get_physical_address (CPUMIPSState *env, hwaddr *physical, · line 198

Quoted 7 lines
target-mips/helper.c +1 -1
@@ -193,7 +193,7 @@ static int get_physical_address (CPUMIPSState *env, hwaddr *physical,
         }
     }
 #if 0
-    qemu_log(TARGET_FMT_lx " %d %d => " TARGET_FMT_lx " %d (%d)\n",
+    qemu_log(TARGET_FMT_lx " %d %d => %" HWADDR_PRIx " %d (%d)\n",
             address, rw, access_type, *physical, *prot, ret);
 #endif

Thanks, applied.

Signature · 2 lines
Aurelien Jarno                          GPG: 1024D/F1BCDB73
[email protected]                 http://www.aurel32.net