Skip to contentSkip to conversation

target-alpha: fix subl and s8subl indentation

PATCH In review Paolo Bonzini 4 participants 5 messages Mar 15, 2014 – Mar 18, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 target-alpha: fix subl and s8subl indentation

Two missing braces, one close and one open, fabulously let the code compile.

---
 target-alpha/translate.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
target-alpha/translate.c +2 -1
index a9ef1a7..e7e319b 100644
@@ -1927,6 +1927,7 @@ static ExitStatus translate_one(DisasContext *ctx, uint32_t insn)
                     else {
                         tcg_gen_neg_i64(cpu_ir[rc], cpu_ir[rb]);
                         tcg_gen_ext32s_i64(cpu_ir[rc], cpu_ir[rc]);
+                    }
                 }
             }
             break;
@@ -1991,7 +1992,7 @@ static ExitStatus translate_one(DisasContext *ctx, uint32_t insn)
                 } else {
                     if (islit)
                         tcg_gen_movi_i64(cpu_ir[rc], -lit);
-                    else
+                    else {
                         tcg_gen_neg_i64(cpu_ir[rc], cpu_ir[rb]);
                         tcg_gen_ext32s_i64(cpu_ir[rc], cpu_ir[rc]);
                     }
Signature · 1 line
1.8.5.3
#2 lore raw
Quoted 9 lines · Richard Henderson
Quoted 4 lines · Paolo Bonzini

Two missing braces, one close and one open, fabulously let the code compile.

Wow. That's ... amazing.

The *really* amazing thing about this (at least as far as I can see) is the missing braces didn't alter the semantics of the code, except that with the patch we no longer generate an extra TCG op with no effect...

Signature · 2 lines
Cheers,
Stuart
#3 lore raw
In reply to Paolo Bonzini
Quoted 21 lines · Paolo Bonzini

Two missing braces, one close and one open, fabulously let the code compile.

---
 target-alpha/translate.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
target-alpha/translate.c +1 -0
index a9ef1a7..e7e319b 100644
@@ -1927,6 +1927,7 @@ static ExitStatus translate_one(DisasContext *ctx, uint32_t insn)
                     else {
                         tcg_gen_neg_i64(cpu_ir[rc], cpu_ir[rb]);
                         tcg_gen_ext32s_i64(cpu_ir[rc], cpu_ir[rc]);
+                    }
                 }
             }
             break;

target-alpha/translate.c static ExitStatus translate_one(DisasContext *ctx, uint32_t insn) · line 1998

Quoted 8 lines
target-alpha/translate.c +1 -1
@@ -1991,7 +1992,7 @@ static ExitStatus translate_one(DisasContext *ctx, uint32_t insn)
                 } else {
                     if (islit)
                         tcg_gen_movi_i64(cpu_ir[rc], -lit);
-                    else
+                    else {
                         tcg_gen_neg_i64(cpu_ir[rc], cpu_ir[rb]);
                         tcg_gen_ext32s_i64(cpu_ir[rc], cpu_ir[rc]);
                     }

I'm surprised checkpatch didn't insist you added braces to the "if" half of this if-else as well.

thanks
-- PMM

#4 lore raw

Il 16/03/2014 00:47, Peter Maydell ha scritto:

Quoted 25 lines · Paolo Bonzini
Quoted 24 lines

Two missing braces, one close and one open, fabulously let the code compile.

---
 target-alpha/translate.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
target-alpha/translate.c +1 -0
index a9ef1a7..e7e319b 100644
@@ -1927,6 +1927,7 @@ static ExitStatus translate_one(DisasContext *ctx, uint32_t insn)
                     else {
                         tcg_gen_neg_i64(cpu_ir[rc], cpu_ir[rb]);
                         tcg_gen_ext32s_i64(cpu_ir[rc], cpu_ir[rc]);
+                    }
                 }
             }
             break;
@@ -1991,7 +1992,7 @@ static ExitStatus translate_one(DisasContext *ctx, uint32_t insn)
                 } else {
                     if (islit)
                         tcg_gen_movi_i64(cpu_ir[rc], -lit);
Quoted 8 lines

target-alpha/translate.c static ExitStatus translate_one(DisasContext *ctx, uint32_t insn) · line 1998

Quoted 5 lines
target-alpha/translate.c +1 -1
-                    else
+                    else {
                         tcg_gen_neg_i64(cpu_ir[rc], cpu_ir[rb]);
                         tcg_gen_ext32s_i64(cpu_ir[rc], cpu_ir[rc]);
                     }

I'm surprised checkpatch didn't insist you added braces to the "if" half of this if-else as well.

I must admit I ignored it. It makes the patch harder to review, since the bug is explicitly about missing (unmatched) braces. I can add the braces throughout the file, but I don't think it's a reason to obfuscate this particular patch.

Paolo