mirror of https://github.com/xemu-project/xemu.git
hw/timer/mt48t59: Fix bit-rotten NVRAM_PRINTF format strings
When compiling with NVRAM_PRINTF enabled, gcc currently bails out with: CC hw/timer/m48t59.o CC hw/timer/m48t59-isa.o hw/timer/m48t59.c: In function ‘NVRAM_writeb’: hw/timer/m48t59.c:460:5: error: format ‘%x’ expects argument of type ‘unsigned int’, but argument 3 has type ‘hwaddr’ [-Werror=format=] NVRAM_PRINTF("%s: 0x%08x => 0x%08x\n", __func__, addr, val); ^ hw/timer/m48t59.c:460:5: error: format ‘%x’ expects argument of type ‘unsigned int’, but argument 4 has type ‘uint64_t’ [-Werror=format=] hw/timer/m48t59.c: In function ‘NVRAM_readb’: hw/timer/m48t59.c:492:5: error: format ‘%x’ expects argument of type ‘unsigned int’, but argument 3 has type ‘hwaddr’ [-Werror=format=] NVRAM_PRINTF("%s: 0x%08x <= 0x%08x\n", __func__, addr, retval); Fix it by using the correct format strings and while we're at it, also change the definition of NVRAM_PRINTF so that this can not bit-rot so easily again. Signed-off-by: Thomas Huth <thuth@redhat.com> Reviewed-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
This commit is contained in:
parent
4a4ff4c58f
commit
54be4c42b2
|
@ -25,13 +25,10 @@
|
||||||
#ifndef HW_M48T59_INTERNAL_H
|
#ifndef HW_M48T59_INTERNAL_H
|
||||||
#define HW_M48T59_INTERNAL_H 1
|
#define HW_M48T59_INTERNAL_H 1
|
||||||
|
|
||||||
//#define DEBUG_NVRAM
|
#define M48T59_DEBUG 0
|
||||||
|
|
||||||
#if defined(DEBUG_NVRAM)
|
#define NVRAM_PRINTF(fmt, ...) do { \
|
||||||
#define NVRAM_PRINTF(fmt, ...) do { printf(fmt , ## __VA_ARGS__); } while (0)
|
if (M48T59_DEBUG) { printf(fmt , ## __VA_ARGS__); } } while (0)
|
||||||
#else
|
|
||||||
#define NVRAM_PRINTF(fmt, ...) do { } while (0)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The M48T02, M48T08 and M48T59 chips are very similar. The newer '59 has
|
* The M48T02, M48T08 and M48T59 chips are very similar. The newer '59 has
|
||||||
|
|
|
@ -456,7 +456,7 @@ static void NVRAM_writeb(void *opaque, hwaddr addr, uint64_t val,
|
||||||
{
|
{
|
||||||
M48t59State *NVRAM = opaque;
|
M48t59State *NVRAM = opaque;
|
||||||
|
|
||||||
NVRAM_PRINTF("%s: 0x%08x => 0x%08x\n", __func__, addr, val);
|
NVRAM_PRINTF("%s: 0x%"HWADDR_PRIx" => 0x%"PRIx64"\n", __func__, addr, val);
|
||||||
switch (addr) {
|
switch (addr) {
|
||||||
case 0:
|
case 0:
|
||||||
NVRAM->addr &= ~0x00FF;
|
NVRAM->addr &= ~0x00FF;
|
||||||
|
@ -488,7 +488,7 @@ static uint64_t NVRAM_readb(void *opaque, hwaddr addr, unsigned size)
|
||||||
retval = -1;
|
retval = -1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
NVRAM_PRINTF("%s: 0x%08x <= 0x%08x\n", __func__, addr, retval);
|
NVRAM_PRINTF("%s: 0x%"HWADDR_PRIx" <= 0x%08x\n", __func__, addr, retval);
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue