diff mbox

[09/11] target/sparc: fix DEBUG_MMU DPRINTF() arguments

Message ID 20170508233918.9043-10-f4bug@amsat.org
State New
Headers show

Commit Message

Philippe Mathieu-Daudé May 8, 2017, 11:39 p.m. UTC
invalid since 96df2bc99f9

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 target/sparc/ldst_helper.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Eric Blake May 9, 2017, midnight UTC | #1
On 05/08/2017 06:39 PM, Philippe Mathieu-Daudé wrote:
> invalid since 96df2bc99f9
> 
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
>  target/sparc/ldst_helper.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/target/sparc/ldst_helper.c b/target/sparc/ldst_helper.c
> index 57968d9143..aa83a49a88 100644
> --- a/target/sparc/ldst_helper.c
> +++ b/target/sparc/ldst_helper.c
> @@ -1631,7 +1631,7 @@ void helper_st_asi(CPUSPARCState *env, target_ulong addr, target_ulong val,
>  
>              if (oldreg != env->immu.mmuregs[reg]) {
>                  DPRINTF_MMU("immu change reg[%d]: 0x%016" PRIx64 " -> 0x%016"
> -                            PRIx64 "\n", reg, oldreg, env->immuregs[reg]);
> +                            PRIx64 "\n", reg, oldreg, env->immu.mmuregs[reg]);

Please take this opportunity to fix the broken definitions of
DPRINTF_MMU() and friends so that they don't bit-rot when not defined.
There are plenty of other examples of re-writing broken #defines to
instead favor an if (0) { printf(...) } to benefit from -Wformat
checking even when the debugging is disabled.
Philippe Mathieu-Daudé May 9, 2017, 12:54 a.m. UTC | #2
On 05/08/2017 09:00 PM, Eric Blake wrote:
> On 05/08/2017 06:39 PM, Philippe Mathieu-Daudé wrote:
>> invalid since 96df2bc99f9
>>
>> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
>> ---
>>  target/sparc/ldst_helper.c | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/target/sparc/ldst_helper.c b/target/sparc/ldst_helper.c
>> index 57968d9143..aa83a49a88 100644
>> --- a/target/sparc/ldst_helper.c
>> +++ b/target/sparc/ldst_helper.c
>> @@ -1631,7 +1631,7 @@ void helper_st_asi(CPUSPARCState *env, target_ulong addr, target_ulong val,
>>
>>              if (oldreg != env->immu.mmuregs[reg]) {
>>                  DPRINTF_MMU("immu change reg[%d]: 0x%016" PRIx64 " -> 0x%016"
>> -                            PRIx64 "\n", reg, oldreg, env->immuregs[reg]);
>> +                            PRIx64 "\n", reg, oldreg, env->immu.mmuregs[reg]);
>
> Please take this opportunity to fix the broken definitions of
> DPRINTF_MMU() and friends so that they don't bit-rot when not defined.
> There are plenty of other examples of re-writing broken #defines to
> instead favor an if (0) { printf(...) } to benefit from -Wformat
> checking even when the debugging is disabled.

Sure, will do it.
diff mbox

Patch

diff --git a/target/sparc/ldst_helper.c b/target/sparc/ldst_helper.c
index 57968d9143..aa83a49a88 100644
--- a/target/sparc/ldst_helper.c
+++ b/target/sparc/ldst_helper.c
@@ -1631,7 +1631,7 @@  void helper_st_asi(CPUSPARCState *env, target_ulong addr, target_ulong val,
 
             if (oldreg != env->immu.mmuregs[reg]) {
                 DPRINTF_MMU("immu change reg[%d]: 0x%016" PRIx64 " -> 0x%016"
-                            PRIx64 "\n", reg, oldreg, env->immuregs[reg]);
+                            PRIx64 "\n", reg, oldreg, env->immu.mmuregs[reg]);
             }
 #ifdef DEBUG_MMU
             dump_mmu(stdout, fprintf, env);
@@ -1715,7 +1715,7 @@  void helper_st_asi(CPUSPARCState *env, target_ulong addr, target_ulong val,
 
             if (oldreg != env->dmmu.mmuregs[reg]) {
                 DPRINTF_MMU("dmmu change reg[%d]: 0x%016" PRIx64 " -> 0x%016"
-                            PRIx64 "\n", reg, oldreg, env->dmmuregs[reg]);
+                            PRIx64 "\n", reg, oldreg, env->dmmu.mmuregs[reg]);
             }
 #ifdef DEBUG_MMU
             dump_mmu(stdout, fprintf, env);