* [Qemu-devel] [PATCH] hw/a9mpcore: Fix compilation failure if physaddrs are 64 bit
@ 2012-05-22 17:04 Peter Maydell
2012-05-22 17:09 ` Eric Blake
0 siblings, 1 reply; 3+ messages in thread
From: Peter Maydell @ 2012-05-22 17:04 UTC (permalink / raw)
To: qemu-devel; +Cc: Paul Brook, patches
Add a cast to a logging printf to avoid a compilation failure
if target_phys_addr_t is a 64 bit type. (This is better than
using TARGET_FMT_plx because we really don't need a full
16 digit hex string to print the offset into a device.)
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
hw/a9mpcore.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/hw/a9mpcore.c b/hw/a9mpcore.c
index c2ff74d..98f52f0 100644
--- a/hw/a9mpcore.c
+++ b/hw/a9mpcore.c
@@ -75,7 +75,7 @@ static void a9_scu_write(void *opaque, target_phys_addr_t offset,
break;
default:
fprintf(stderr, "Invalid size %u in write to a9 scu register %x\n",
- size, offset);
+ size, (uint32_t)offset);
return;
}
--
1.7.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] hw/a9mpcore: Fix compilation failure if physaddrs are 64 bit
2012-05-22 17:04 [Qemu-devel] [PATCH] hw/a9mpcore: Fix compilation failure if physaddrs are 64 bit Peter Maydell
@ 2012-05-22 17:09 ` Eric Blake
2012-05-22 17:15 ` Peter Maydell
0 siblings, 1 reply; 3+ messages in thread
From: Eric Blake @ 2012-05-22 17:09 UTC (permalink / raw)
To: Peter Maydell; +Cc: patches, qemu-devel, Paul Brook
[-- Attachment #1: Type: text/plain, Size: 1133 bytes --]
On 05/22/2012 11:04 AM, Peter Maydell wrote:
> Add a cast to a logging printf to avoid a compilation failure
> if target_phys_addr_t is a 64 bit type. (This is better than
> using TARGET_FMT_plx because we really don't need a full
> 16 digit hex string to print the offset into a device.)
>
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
> hw/a9mpcore.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/hw/a9mpcore.c b/hw/a9mpcore.c
> index c2ff74d..98f52f0 100644
> --- a/hw/a9mpcore.c
> +++ b/hw/a9mpcore.c
> @@ -75,7 +75,7 @@ static void a9_scu_write(void *opaque, target_phys_addr_t offset,
> break;
> default:
> fprintf(stderr, "Invalid size %u in write to a9 scu register %x\n",
> - size, offset);
> + size, (uint32_t)offset);
NACK. %x and (uint32_t) are not necessarily compatible types (some
platforms implement uint32_t as long). If you use %x, then cast to
(unsigned int) instead.
--
Eric Blake eblake@redhat.com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 620 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] hw/a9mpcore: Fix compilation failure if physaddrs are 64 bit
2012-05-22 17:09 ` Eric Blake
@ 2012-05-22 17:15 ` Peter Maydell
0 siblings, 0 replies; 3+ messages in thread
From: Peter Maydell @ 2012-05-22 17:15 UTC (permalink / raw)
To: Eric Blake; +Cc: patches, qemu-devel, Paul Brook
On 22 May 2012 18:09, Eric Blake <eblake@redhat.com> wrote:
> On 05/22/2012 11:04 AM, Peter Maydell wrote:
>> @@ -75,7 +75,7 @@ static void a9_scu_write(void *opaque, target_phys_addr_t offset,
>> break;
>> default:
>> fprintf(stderr, "Invalid size %u in write to a9 scu register %x\n",
>> - size, offset);
>> + size, (uint32_t)offset);
>
> NACK. %x and (uint32_t) are not necessarily compatible types (some
> platforms implement uint32_t as long). If you use %x, then cast to
> (unsigned int) instead.
Good point, though I think from the fact we have uses of %x for uint32_t
types already in the codebase that we don't try to compile on any of
those platforms.
Patch v2 on the way.
-- PMM
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-05-22 17:15 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-22 17:04 [Qemu-devel] [PATCH] hw/a9mpcore: Fix compilation failure if physaddrs are 64 bit Peter Maydell
2012-05-22 17:09 ` Eric Blake
2012-05-22 17:15 ` Peter Maydell
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).