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

login
register
mail settings
Submitter Yongbok Kim
Date Aug. 27, 2013, 4:48 p.m.
Message ID <1377622116-37650-1-git-send-email-yongbok.kim@imgtec.com>
Download mbox | patch
Permalink /patch/270156/
State New
Headers show

Comments

Yongbok Kim - Aug. 27, 2013, 4:48 p.m.
From: James Hogan <james.hogan@imgtec.com>

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.

Signed-off-by: James Hogan <james.hogan@imgtec.com>
Cc: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Yongbok Kim <yongbok.kim@imgtec.com>
---
 target-mips/helper.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Richard Henderson - Aug. 27, 2013, 7:48 p.m.
On 08/27/2013 09:48 AM, Yongbok Kim wrote:
>  #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

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~
James Hogan - Aug. 28, 2013, 8:28 a.m.
On 27/08/13 20:48, Richard Henderson wrote:
> On 08/27/2013 09:48 AM, Yongbok Kim wrote:
>>  #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
> 
> 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
Aurelien Jarno - Aug. 28, 2013, 9:03 p.m.
On Tue, Aug 27, 2013 at 05:48:36PM +0100, Yongbok Kim wrote:
> From: James Hogan <james.hogan@imgtec.com>
> 
> 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.
> 
> Signed-off-by: James Hogan <james.hogan@imgtec.com>
> Cc: Aurelien Jarno <aurelien@aurel32.net>
> Signed-off-by: Yongbok Kim <yongbok.kim@imgtec.com>
> ---
>  target-mips/helper.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/target-mips/helper.c b/target-mips/helper.c
> index 6feef7b..33e0e88 100644
> --- a/target-mips/helper.c
> +++ b/target-mips/helper.c
> @@ -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.

Patch

diff --git a/target-mips/helper.c b/target-mips/helper.c
index 6feef7b..33e0e88 100644
--- a/target-mips/helper.c
+++ b/target-mips/helper.c
@@ -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