hw/a9mpcore: Fix compilation failure if physaddrs are 64 bit
PATCH 1/1 hw/a9mpcore: Fix compilation failure if physaddrs are 64 bit
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.)
--- hw/a9mpcore.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
hw/a9mpcore.c +1 -1
@@ -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 ; }
Signature · 1 line
1.7.1
Quoted 15 lines · Peter Maydell
Add a cast to a logging printf to avoid a compilation failure if
target_phys_addr_tis a 64 bit type. (This is better than usingTARGET_FMT_plxbecause we really don't need a full 16 digit hex string to print the offset into a device.)Signed-off-by Peter Maydell <[email protected]>--- hw/a9mpcore.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)hw/a9mpcore.c +0
-0
hw/a9mpcore.c static void a9_scu_write(void *opaque, target_phys_addr_t offset, · line 78
Quoted 5 lines
hw/a9mpcore.c +1
-1@@ -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.
Signature · 2 lines
Eric Blake [email protected] +1-919-301-3266 Libvirt virtualization library http://libvirt.org
Quoted 11 lines · Eric Blake
Quoted 6 lines · Peter Maydell
(quoted diff) +0
-0@@ -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 implementuint32_tas 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