Skip to contentSkip to conversation

silence the compiler warnings

PATCH Applied Chen Qun 6 participants 21 messages Oct 30, 2020 – Nov 4, 2020

v2 of 3 Applied Latest is v3 →

lore
Share & tools
lore

Chen Qun

author
#0 lore raw

v2 cover silence the compiler warnings

Since v1:
- Patch1: Add comments to explain the two case of fall through. Addressed Richard Henderson and Thomas Huth review comment.
- Patch2: Addressed Peter Maydell review comment.
- Patch3: Add QEMU_NORETURN to cpu_exit_tb_from_sighandler() function to avoid the compiler warnings.
- Patch4: Addressed Thomas Huth review comment.
- Patch5: Addressed Artyom Tarasenko and Philippe Mathieu-Daudé review comment.
- Patch6: Combine the /* fall through */ to the preceding comments. Addressed Artyom Tarasenko review comment.
- Patch7: Add a "break" statement here instead of /* fall through */ comments.
- Patch8: Replace the TODO by a LOG_UNIMP call and add break statement
- Patch9: Discard this patch since a patch already exists for fix this issue(https://lore.kernel.org/qemu-devel/20200711154242.41222-1-ysato@users)

Chen Qun (8):
target/i386: silence the compiler warnings in gen_shiftd_rm_T1 hw/intc/arm_gicv3_kvm: silence the compiler warnings accel/tcg/user-exec: silence the compiler warnings linux-user/mips/cpu_loop: silence the compiler warnings target/sparc/translate: silence the compiler warnings target/sparc/win_helper: silence the compiler warnings
ppc: Add a missing break for PPC6xx_INPUT_TBEN
target/ppc: replaced the TODO with LOG_UNIMP and add break for silence
warnings

 accel/tcg/user-exec.c      | 3 ++-
 hw/intc/arm_gicv3_kvm.c    | 8 ++++++++
 hw/ppc/ppc.c               | 1 +
 linux-user/mips/cpu_loop.c | 4 ++++
 target/i386/translate.c    | 7 +++++--
 target/ppc/mmu_helper.c    | 5 +++--
 target/sparc/translate.c   | 2 +-
 target/sparc/win_helper.c  | 2 +-
 8 files changed, 25 insertions(+), 7 deletions(-)
Signature · 1 line
2.27.0
author
#1 lore raw

PATCH v2 1/8 target/i386: silence the compiler warnings in gen_shiftd_rm_T1

The current "#ifdef TARGET_X86_64" statement affects the compiler's determination of fall through.

When using -Wimplicit-fallthrough in our CFLAGS, the compiler showed warning:
target/i386/translate.c: In function ‘gen_shiftd_rm_T1’:
target/i386/translate.c:1773:12: warning: this statement may fall through [-Wimplicit-fallthrough=]

         if (is_right) {
            ^
target/i386/translate.c:1782:5: note: here
     case MO_32:
     ^~~~

---
v1->v2: Add comments to explain the two case of fall through, depending on whether TARGET_X86_64 is defined.

Cc Thomas Huth <[email protected]>
Cc Paolo Bonzini <[email protected]>
Cc Richard Henderson <[email protected]>
Cc Eduardo Habkost <[email protected]>
---
 target/i386/translate.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
target/i386/translate.c +5 -2
index caea6f5fb1..77cb66208e 100644
@@ -1777,9 +1777,12 @@ static void gen_shiftd_rm_T1(DisasContext *s, MemOp ot, int op1,
         } else {
             tcg_gen_deposit_tl(s->T1, s->T0, s->T1, 16, 16);
         }
-        /* FALLTHRU */
-#ifdef TARGET_X86_64
+        /*
+         * If TARGET_X86_64 defined then fall through into MO_32 case,
+         * otherwise fall through default case.
+         */
     case MO_32:
+#ifdef TARGET_X86_64
         /* Concatenate the two 32-bit values and use a 64-bit shift.  */
         tcg_gen_subi_tl(s->tmp0, count, 1);
         if (is_right) {
Signature · 1 line
2.27.0
author
#2 lore raw

PATCH v2 2/8 hw/intc/arm_gicv3_kvm: silence the compiler warnings

In reply to Chen Qun

When using -Wimplicit-fallthrough in our CFLAGS, the compiler showed warning:
hw/intc/arm_gicv3_kvm.c: In function ‘kvm_arm_gicv3_put’:
hw/intc/arm_gicv3_kvm.c:484:13: warning: this statement may fall through [-Wimplicit-fallthrough=]

             kvm_gicc_access(s, ICC_AP0R_EL1(1), ncpu, &reg64, true);
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
hw/intc/arm_gicv3_kvm.c:485:9: note: here
         default:
         ^~~~~~~
hw/intc/arm_gicv3_kvm.c:495:13: warning: this statement may fall through [-Wimplicit-fallthrough=]
             kvm_gicc_access(s, ICC_AP1R_EL1(2), ncpu, &reg64, true);
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
hw/intc/arm_gicv3_kvm.c:496:9: note: here
         case 6:
         ^~~~
hw/intc/arm_gicv3_kvm.c:498:13: warning: this statement may fall through [-Wimplicit-fallthrough=]
             kvm_gicc_access(s, ICC_AP1R_EL1(1), ncpu, &reg64, true);
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
hw/intc/arm_gicv3_kvm.c:499:9: note: here
         default:
         ^~~~~~~

hw/intc/arm_gicv3_kvm.c: In function ‘kvm_arm_gicv3_get’:
hw/intc/arm_gicv3_kvm.c:634:37: warning: this statement may fall through [-Wimplicit-fallthrough=]

             c->icc_apr[GICV3_G0][2] = reg64;
             ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
hw/intc/arm_gicv3_kvm.c:635:9: note: here
         case 6:
         ^~~~
hw/intc/arm_gicv3_kvm.c:637:37: warning: this statement may fall through [-Wimplicit-fallthrough=]
             c->icc_apr[GICV3_G0][1] = reg64;
             ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
hw/intc/arm_gicv3_kvm.c:638:9: note: here
         default:
         ^~~~~~~
hw/intc/arm_gicv3_kvm.c:648:39: warning: this statement may fall through [-Wimplicit-fallthrough=]
             c->icc_apr[GICV3_G1NS][2] = reg64;
             ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
hw/intc/arm_gicv3_kvm.c:649:9: note: here
         case 6:
         ^~~~
hw/intc/arm_gicv3_kvm.c:651:39: warning: this statement may fall through [-Wimplicit-fallthrough=]
             c->icc_apr[GICV3_G1NS][1] = reg64;
             ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
hw/intc/arm_gicv3_kvm.c:652:9: note: here
         default:
         ^~~~~~~

---
Cc: Peter Maydell <[email protected]>
Cc: [email protected]

---
 hw/intc/arm_gicv3_kvm.c | 8 ++++++++
 1 file changed, 8 insertions(+)
hw/intc/arm_gicv3_kvm.c +8 -0
index 187eb054e0..d040a5d1e9 100644
@@ -478,9 +478,11 @@ static void kvm_arm_gicv3_put(GICv3State *s)
             kvm_gicc_access(s, ICC_AP0R_EL1(3), ncpu, &reg64, true);
             reg64 = c->icc_apr[GICV3_G0][2];
             kvm_gicc_access(s, ICC_AP0R_EL1(2), ncpu, &reg64, true);
+            /* fall through */
         case 6:
             reg64 = c->icc_apr[GICV3_G0][1];
             kvm_gicc_access(s, ICC_AP0R_EL1(1), ncpu, &reg64, true);
+            /* fall through */
         default:
             reg64 = c->icc_apr[GICV3_G0][0];
             kvm_gicc_access(s, ICC_AP0R_EL1(0), ncpu, &reg64, true);
@@ -492,9 +494,11 @@ static void kvm_arm_gicv3_put(GICv3State *s)
             kvm_gicc_access(s, ICC_AP1R_EL1(3), ncpu, &reg64, true);
             reg64 = c->icc_apr[GICV3_G1NS][2];
             kvm_gicc_access(s, ICC_AP1R_EL1(2), ncpu, &reg64, true);
+            /* fall through */
         case 6:
             reg64 = c->icc_apr[GICV3_G1NS][1];
             kvm_gicc_access(s, ICC_AP1R_EL1(1), ncpu, &reg64, true);
+            /* fall through */
         default:
             reg64 = c->icc_apr[GICV3_G1NS][0];
             kvm_gicc_access(s, ICC_AP1R_EL1(0), ncpu, &reg64, true);
@@ -631,9 +635,11 @@ static void kvm_arm_gicv3_get(GICv3State *s)
             c->icc_apr[GICV3_G0][3] = reg64;
             kvm_gicc_access(s, ICC_AP0R_EL1(2), ncpu, &reg64, false);
             c->icc_apr[GICV3_G0][2] = reg64;
+            /* fall through */
         case 6:
             kvm_gicc_access(s, ICC_AP0R_EL1(1), ncpu, &reg64, false);
             c->icc_apr[GICV3_G0][1] = reg64;
+            /* fall through */
         default:
             kvm_gicc_access(s, ICC_AP0R_EL1(0), ncpu, &reg64, false);
             c->icc_apr[GICV3_G0][0] = reg64;
@@ -645,9 +651,11 @@ static void kvm_arm_gicv3_get(GICv3State *s)
             c->icc_apr[GICV3_G1NS][3] = reg64;
             kvm_gicc_access(s, ICC_AP1R_EL1(2), ncpu, &reg64, false);
             c->icc_apr[GICV3_G1NS][2] = reg64;
+            /* fall through */
         case 6:
             kvm_gicc_access(s, ICC_AP1R_EL1(1), ncpu, &reg64, false);
             c->icc_apr[GICV3_G1NS][1] = reg64;
+            /* fall through */
         default:
             kvm_gicc_access(s, ICC_AP1R_EL1(0), ncpu, &reg64, false);
             c->icc_apr[GICV3_G1NS][0] = reg64;
Signature · 1 line
2.27.0
author
#3 lore raw

PATCH v2 3/8 accel/tcg/user-exec: silence the compiler warnings

In reply to Chen Qun

When using -Wimplicit-fallthrough in our CFLAGS, the compiler showed warning:
../accel/tcg/user-exec.c: In function ‘handle_cpu_signal’:
../accel/tcg/user-exec.c:169:13: warning: this statement may fall through [-Wimplicit-fallthrough=]

  169 |             cpu_exit_tb_from_sighandler(cpu, old_set);
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

../accel/tcg/user-exec.c:172:9: note: here
172 | default:

Mark the cpu_exit_tb_from_sighandler() function with QEMU_NORETURN to fix it.

---
v1->v2: Add QEMU_NORETURN to cpu_exit_tb_from_sighandler() function to avoid the compiler warnings(Base on Thomas's and Richard's comments).

Cc Thomas Huth <[email protected]>
Cc Riku Voipio <[email protected]>
Cc Richard Henderson <[email protected]>
Cc Paolo Bonzini <[email protected]>
---
 accel/tcg/user-exec.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
accel/tcg/user-exec.c +2 -1
index 4ebe25461a..293ee86ea4 100644
@@ -49,7 +49,8 @@ __thread uintptr_t helper_retaddr;
 /* exit the current TB from a signal handler. The host registers are
    restored in a state compatible with the CPU emulator
  */
-static void cpu_exit_tb_from_sighandler(CPUState *cpu, sigset_t *old_set)
+static void QEMU_NORETURN cpu_exit_tb_from_sighandler(CPUState *cpu,
+                                                      sigset_t *old_set)
 {
     /* XXX: use siglongjmp ? */
     sigprocmask(SIG_SETMASK, old_set, NULL);
Signature · 1 line
2.27.0
Reviewed-by on v2 3/8
#4 lore raw

Re: [PATCH v2 3/8] accel/tcg/user-exec: silence the compiler warnings

Quoted 8 lines · Chen Qun

When using -Wimplicit-fallthrough in our CFLAGS, the compiler showed warning:
../accel/tcg/user-exec.c: In function ‘handle_cpu_signal’:
../accel/tcg/user-exec.c:169:13: warning: this statement may fall through [-Wimplicit-fallthrough=]

  169 |             cpu_exit_tb_from_sighandler(cpu, old_set);
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

../accel/tcg/user-exec.c:172:9: note: here
172 | default:

Quoted 7 lines

Mark the cpu_exit_tb_from_sighandler() function with QEMU_NORETURN to fix it.

---
v1->v2: Add QEMU_NORETURN to cpu_exit_tb_from_sighandler() function to avoid the compiler warnings(Base on Thomas's and Richard's comments).

r~

Reviewed-by on v2 3/8
#5 lore raw

Re: [PATCH v2 3/8] accel/tcg/user-exec: silence the compiler warnings

In reply to Chen Qun
Quoted 8 lines · Chen Qun

When using -Wimplicit-fallthrough in our CFLAGS, the compiler showed warning:
../accel/tcg/user-exec.c: In function ‘handle_cpu_signal’:
../accel/tcg/user-exec.c:169:13: warning: this statement may fall through [-Wimplicit-fallthrough=]

  169 |             cpu_exit_tb_from_sighandler(cpu, old_set);
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

../accel/tcg/user-exec.c:172:9: note: here
172 | default:

Quoted 7 lines

Mark the cpu_exit_tb_from_sighandler() function with QEMU_NORETURN to fix it.

---
v1->v2: Add QEMU_NORETURN to cpu_exit_tb_from_sighandler() function to avoid the compiler warnings(Base on Thomas's and Richard's comments).

Reviewed-by on v2 3/8
#6 lore raw

Re: [PATCH v2 3/8] accel/tcg/user-exec: silence the compiler warnings

In reply to Chen Qun
Quoted 30 lines · Chen Qun

When using -Wimplicit-fallthrough in our CFLAGS, the compiler showed warning:
../accel/tcg/user-exec.c: In function ‘handle_cpu_signal’:
../accel/tcg/user-exec.c:169:13: warning: this statement may fall through [-Wimplicit-fallthrough=]

  169 |             cpu_exit_tb_from_sighandler(cpu, old_set);
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

../accel/tcg/user-exec.c:172:9: note: here
172 | default:

Mark the cpu_exit_tb_from_sighandler() function with QEMU_NORETURN to fix it.

---
v1->v2: Add QEMU_NORETURN to cpu_exit_tb_from_sighandler() function to avoid the compiler warnings(Base on Thomas's and Richard's comments).

Cc Thomas Huth <[email protected]>
Cc Riku Voipio <[email protected]>
Cc Richard Henderson <[email protected]>
Cc Paolo Bonzini <[email protected]>
---
 accel/tcg/user-exec.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
accel/tcg/user-exec.c +0 -0
index 4ebe25461a..293ee86ea4 100644

accel/tcg/user-exec.c __thread uintptr_t helper_retaddr; · line 56

Quoted 9 lines
accel/tcg/user-exec.c +2 -1
@@ -49,7 +49,8 @@ __thread uintptr_t helper_retaddr;
 /* exit the current TB from a signal handler. The host registers are
    restored in a state compatible with the CPU emulator
  */
-static void cpu_exit_tb_from_sighandler(CPUState *cpu, sigset_t *old_set)
+static void QEMU_NORETURN cpu_exit_tb_from_sighandler(CPUState *cpu,
+                                                      sigset_t *old_set)
 {
     /* XXX: use siglongjmp ? */
     sigprocmask(SIG_SETMASK, old_set, NULL);
author
#7 lore raw

PATCH v2 4/8 linux-user/mips/cpu_loop: silence the compiler warnings

In reply to Chen Qun

When using -Wimplicit-fallthrough in our CFLAGS, the compiler showed warning:
linux-user/mips/cpu_loop.c: In function ‘cpu_loop’:
linux-user/mips/cpu_loop.c:104:24: warning: this statement may fall through [-Wimplicit-fallthrough=]
104 | if ((ret = get_user_ual(arg8, sp_reg + 28)) != 0) {
| ^
linux-user/mips/cpu_loop.c:107:17: note: here

  107 |                 case 7:
      |                 ^~~~

linux-user/mips/cpu_loop.c:108:24: warning: this statement may fall through [-Wimplicit-fallthrough=]
108 | if ((ret = get_user_ual(arg7, sp_reg + 24)) != 0) {
| ^
linux-user/mips/cpu_loop.c:111:17: note: here

  111 |                 case 6:
      |                 ^~~~

linux-user/mips/cpu_loop.c:112:24: warning: this statement may fall through [-Wimplicit-fallthrough=]
112 | if ((ret = get_user_ual(arg6, sp_reg + 20)) != 0) {
| ^
linux-user/mips/cpu_loop.c:115:17: note: here

  115 |                 case 5:
      |                 ^~~~

Add the corresponding "fall through" comment to fix it.

---
Cc: Laurent Vivier <[email protected]>

---
 linux-user/mips/cpu_loop.c | 4 ++++
 1 file changed, 4 insertions(+)
linux-user/mips/cpu_loop.c +4 -0
index 553e8ca7f5..cfe7ba5c47 100644
@@ -104,18 +104,22 @@ void cpu_loop(CPUMIPSState *env)
                     if ((ret = get_user_ual(arg8, sp_reg + 28)) != 0) {
                         goto done_syscall;
                     }
+                    /* fall through */
                 case 7:
                     if ((ret = get_user_ual(arg7, sp_reg + 24)) != 0) {
                         goto done_syscall;
                     }
+                    /* fall through */
                 case 6:
                     if ((ret = get_user_ual(arg6, sp_reg + 20)) != 0) {
                         goto done_syscall;
                     }
+                    /* fall through */
                 case 5:
                     if ((ret = get_user_ual(arg5, sp_reg + 16)) != 0) {
                         goto done_syscall;
                     }
+                    /* fall through */
                 default:
                     break;
                 }
Signature · 1 line
2.27.0
Reviewed-by on v2 4/8
#8 lore raw

Re: [PATCH v2 4/8] linux-user/mips/cpu_loop: silence the compiler warnings

Le 30/10/2020 à 01:40, Chen Qun a écrit :

Quoted 50 lines

When using -Wimplicit-fallthrough in our CFLAGS, the compiler showed warning:
linux-user/mips/cpu_loop.c: In function ‘cpu_loop’:
linux-user/mips/cpu_loop.c:104:24: warning: this statement may fall through [-Wimplicit-fallthrough=]
104 | if ((ret = get_user_ual(arg8, sp_reg + 28)) != 0) {
| ^
linux-user/mips/cpu_loop.c:107:17: note: here

  107 |                 case 7:
      |                 ^~~~

linux-user/mips/cpu_loop.c:108:24: warning: this statement may fall through [-Wimplicit-fallthrough=]
108 | if ((ret = get_user_ual(arg7, sp_reg + 24)) != 0) {
| ^
linux-user/mips/cpu_loop.c:111:17: note: here

  111 |                 case 6:
      |                 ^~~~

linux-user/mips/cpu_loop.c:112:24: warning: this statement may fall through [-Wimplicit-fallthrough=]
112 | if ((ret = get_user_ual(arg6, sp_reg + 20)) != 0) {
| ^
linux-user/mips/cpu_loop.c:115:17: note: here

  115 |                 case 5:
      |                 ^~~~

Add the corresponding "fall through" comment to fix it.

---
Cc: Laurent Vivier <[email protected]>

---
 linux-user/mips/cpu_loop.c | 4 ++++
 1 file changed, 4 insertions(+)
linux-user/mips/cpu_loop.c +2 -0
index 553e8ca7f5..cfe7ba5c47 100644
@@ -104,18 +104,22 @@ void cpu_loop(CPUMIPSState *env)
                     if ((ret = get_user_ual(arg8, sp_reg + 28)) != 0) {
                         goto done_syscall;
                     }
+                    /* fall through */
                 case 7:
                     if ((ret = get_user_ual(arg7, sp_reg + 24)) != 0) {
                         goto done_syscall;
                     }
+                    /* fall through */
                 case 6:
                     if ((ret = get_user_ual(arg6, sp_reg + 20)) != 0) {
                         goto done_syscall;

linux-user/mips/cpu_loop.c void cpu_loop(CPUMIPSState *env) · line 125

Quoted 10 lines
linux-user/mips/cpu_loop.c +2 -0
                     }
+                    /* fall through */
                 case 5:
                     if ((ret = get_user_ual(arg5, sp_reg + 16)) != 0) {
                         goto done_syscall;
                     }
+                    /* fall through */
                 default:
                     break;
                 }
#9 lore raw

Re: [PATCH v2 4/8] linux-user/mips/cpu_loop: silence the compiler warnings

In reply to Chen Qun

Le 30/10/2020 à 01:40, Chen Qun a écrit :

Quoted 50 lines

When using -Wimplicit-fallthrough in our CFLAGS, the compiler showed warning:
linux-user/mips/cpu_loop.c: In function ‘cpu_loop’:
linux-user/mips/cpu_loop.c:104:24: warning: this statement may fall through [-Wimplicit-fallthrough=]
104 | if ((ret = get_user_ual(arg8, sp_reg + 28)) != 0) {
| ^
linux-user/mips/cpu_loop.c:107:17: note: here

  107 |                 case 7:
      |                 ^~~~

linux-user/mips/cpu_loop.c:108:24: warning: this statement may fall through [-Wimplicit-fallthrough=]
108 | if ((ret = get_user_ual(arg7, sp_reg + 24)) != 0) {
| ^
linux-user/mips/cpu_loop.c:111:17: note: here

  111 |                 case 6:
      |                 ^~~~

linux-user/mips/cpu_loop.c:112:24: warning: this statement may fall through [-Wimplicit-fallthrough=]
112 | if ((ret = get_user_ual(arg6, sp_reg + 20)) != 0) {
| ^
linux-user/mips/cpu_loop.c:115:17: note: here

  115 |                 case 5:
      |                 ^~~~

Add the corresponding "fall through" comment to fix it.

---
Cc: Laurent Vivier <[email protected]>

---
 linux-user/mips/cpu_loop.c | 4 ++++
 1 file changed, 4 insertions(+)
linux-user/mips/cpu_loop.c +2 -0
index 553e8ca7f5..cfe7ba5c47 100644
@@ -104,18 +104,22 @@ void cpu_loop(CPUMIPSState *env)
                     if ((ret = get_user_ual(arg8, sp_reg + 28)) != 0) {
                         goto done_syscall;
                     }
+                    /* fall through */
                 case 7:
                     if ((ret = get_user_ual(arg7, sp_reg + 24)) != 0) {
                         goto done_syscall;
                     }
+                    /* fall through */
                 case 6:
                     if ((ret = get_user_ual(arg6, sp_reg + 20)) != 0) {
                         goto done_syscall;

linux-user/mips/cpu_loop.c void cpu_loop(CPUMIPSState *env) · line 125

Quoted 10 lines
linux-user/mips/cpu_loop.c +2 -0
                     }
+                    /* fall through */
                 case 5:
                     if ((ret = get_user_ual(arg5, sp_reg + 16)) != 0) {
                         goto done_syscall;
                     }
+                    /* fall through */
                 default:
                     break;
                 }

Applied to my linux-user-for-5.2 branch.

Thanks,
Laurent

author
#10 lore raw

PATCH v2 5/8 target/sparc/translate: silence the compiler warnings

In reply to Chen Qun

When using -Wimplicit-fallthrough in our CFLAGS, the compiler showed warning:
target/sparc/translate.c: In function ‘gen_st_asi’:
target/sparc/translate.c:2320:12: warning: this statement may fall through [-Wimplicit-fallthrough=]
2320 | if (!(dc->def->features & CPU_FEATURE_HYPV)) {
| ^
target/sparc/translate.c:2329:5: note: here

 2329 |     case GET_ASI_DIRECT:
      |     ^~~~

The "fall through" statement place is not correctly identified by the compiler.

---
Cc: Mark Cave-Ayland <[email protected]>
Cc: Artyom Tarasenko <[email protected]>

---
 target/sparc/translate.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
target/sparc/translate.c +1 -1
index 1a4efd4ed6..a3d9aaa46b 100644
@@ -2324,8 +2324,8 @@ static void gen_st_asi(DisasContext *dc, TCGv src, TCGv addr,
         }
         /* in OpenSPARC T1+ CPUs TWINX ASIs in store instructions
          * are ST_BLKINIT_ ASIs */
-        /* fall through */
 #endif
+        /* fall through */
     case GET_ASI_DIRECT:
         gen_address_mask(dc, addr);
         tcg_gen_qemu_st_tl(src, addr, da.mem_idx, da.memop);
Signature · 1 line
2.27.0
author
#11 lore raw

PATCH v2 6/8 target/sparc/win_helper: silence the compiler warnings

In reply to Chen Qun

When using -Wimplicit-fallthrough in our CFLAGS, the compiler showed warning:
target/sparc/win_helper.c: In function ‘get_gregset’:
target/sparc/win_helper.c:304:9: warning: this statement may fall through [-Wimplicit-fallthrough=]

  304 |         trace_win_helper_gregset_error(pstate);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
target/sparc/win_helper.c:306:5: note: here
  306 |     case 0:
      |     ^~~~

Add the corresponding "fall through" comment to fix it.

---
v1->v2: Combine the /* fall through */ to the preceding comments (Base on Philippe's comments).

Cc Philippe Mathieu-Daudé <[email protected]>
Cc Mark Cave-Ayland <[email protected]>
Cc Artyom Tarasenko <[email protected]>
---
 target/sparc/win_helper.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
target/sparc/win_helper.c +1 -1
index 8290a21142..e78660b60a 100644
@@ -302,7 +302,7 @@ static inline uint64_t *get_gregset(CPUSPARCState *env, uint32_t pstate)
     switch (pstate) {
     default:
         trace_win_helper_gregset_error(pstate);
-        /* pass through to normal set of global registers */
+        /* fall through to normal set of global registers */
     case 0:
         return env->bgregs;
     case PS_AG:
Signature · 1 line
2.27.0
Reviewed-by on v2 6/8
#12 lore raw

Re: [PATCH v2 6/8] target/sparc/win_helper: silence the compiler warnings

Quoted 9 lines · Chen Qun

When using -Wimplicit-fallthrough in our CFLAGS, the compiler showed warning:
target/sparc/win_helper.c: In function ‘get_gregset’:
target/sparc/win_helper.c:304:9: warning: this statement may fall through [-Wimplicit-fallthrough=]

  304 |         trace_win_helper_gregset_error(pstate);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
target/sparc/win_helper.c:306:5: note: here
  306 |     case 0:
      |     ^~~~
Quoted 8 lines

Add the corresponding "fall through" comment to fix it.

---
v1->v2: Combine the /* fall through */ to the preceding comments (Base on Philippe's comments).

r~

Reviewed-by on v2 6/8
#13 lore raw

Re: [PATCH v2 6/8] target/sparc/win_helper: silence the compiler warnings

In reply to Chen Qun
Quoted 9 lines · Chen Qun

When using -Wimplicit-fallthrough in our CFLAGS, the compiler showed warning:
target/sparc/win_helper.c: In function ‘get_gregset’:
target/sparc/win_helper.c:304:9: warning: this statement may fall through [-Wimplicit-fallthrough=]

  304 |         trace_win_helper_gregset_error(pstate);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
target/sparc/win_helper.c:306:5: note: here
  306 |     case 0:
      |     ^~~~
Quoted 8 lines

Add the corresponding "fall through" comment to fix it.

---
v1->v2: Combine the /* fall through */ to the preceding comments (Base on Philippe's comments).

author
#14 lore raw

PATCH v2 7/8 ppc: Add a missing break for PPC6xx_INPUT_TBEN

In reply to Chen Qun

When using -Wimplicit-fallthrough in our CFLAGS, the compiler showed warning:
hw/ppc/ppc.c: In function ‘ppc6xx_set_irq’:
hw/ppc/ppc.c:118:16: warning: this statement may fall through [-Wimplicit-fallthrough=]
118 | if (level) {
| ^
hw/ppc/ppc.c:123:9: note: here

  123 |         case PPC6xx_INPUT_INT:
      |         ^~~~

According to the discussion, a break statement needs to be added here.

---
v1->v2: Add a "break" statement here instead of /* fall through */ comments (Base on Thomas's and David review).

Cc Thomas Huth <[email protected]>
Cc David Gibson <[email protected]>
---
 hw/ppc/ppc.c | 1 +
 1 file changed, 1 insertion(+)
hw/ppc/ppc.c +1 -0
index 4a11fb1640..1b98272076 100644
@@ -120,6 +120,7 @@ static void ppc6xx_set_irq(void *opaque, int pin, int level)
             } else {
                 cpu_ppc_tb_stop(env);
             }
+            break;
         case PPC6xx_INPUT_INT:
             /* Level sensitive - active high */
             LOG_IRQ("%s: set the external IRQ state to %d\n",
Signature · 1 line
2.27.0
Reviewed-by on v2 7/8
#15 lore raw

Re: [PATCH v2 7/8] ppc: Add a missing break for PPC6xx_INPUT_TBEN

Quoted 29 lines · Chen Qun

When using -Wimplicit-fallthrough in our CFLAGS, the compiler showed warning:
hw/ppc/ppc.c: In function ‘ppc6xx_set_irq’:
hw/ppc/ppc.c:118:16: warning: this statement may fall through [-Wimplicit-fallthrough=]
118 | if (level) {
| ^
hw/ppc/ppc.c:123:9: note: here

  123 |         case PPC6xx_INPUT_INT:
      |         ^~~~

According to the discussion, a break statement needs to be added here.

---
v1->v2: Add a "break" statement here instead of /* fall through */ comments (Base on Thomas's and David review).

Cc Thomas Huth <[email protected]>
Cc David Gibson <[email protected]>
---
 hw/ppc/ppc.c | 1 +
 1 file changed, 1 insertion(+)
hw/ppc/ppc.c +0 -0
index 4a11fb1640..1b98272076 100644

hw/ppc/ppc.c static void ppc6xx_set_irq(void *opaque, int pin, int level) · line 126

Quoted 7 lines
hw/ppc/ppc.c +1 -0
@@ -120,6 +120,7 @@ static void ppc6xx_set_irq(void *opaque, int pin, int level)
             } else {
                 cpu_ppc_tb_stop(env);
             }
+            break;
         case PPC6xx_INPUT_INT:
             /* Level sensitive - active high */
             LOG_IRQ("%s: set the external IRQ state to %d\n",
Acked-by on v2 7/8
#16 lore raw

Re: [PATCH v2 7/8] ppc: Add a missing break for PPC6xx_INPUT_TBEN

In reply to Chen Qun
Quoted 11 lines · Chen Qun

When using -Wimplicit-fallthrough in our CFLAGS, the compiler showed warning:
hw/ppc/ppc.c: In function ‘ppc6xx_set_irq’:
hw/ppc/ppc.c:118:16: warning: this statement may fall through [-Wimplicit-fallthrough=]
118 | if (level) {
| ^
hw/ppc/ppc.c:123:9: note: here

  123 |         case PPC6xx_INPUT_INT:
      |         ^~~~

According to the discussion, a break statement needs to be added here.

Quoted 8 lines

---
v1->v2: Add a "break" statement here instead of /* fall through */ comments (Base on Thomas's and David review).

Cc Thomas Huth <[email protected]>
Cc David Gibson <[email protected]>
Quoted 16 lines
---
 hw/ppc/ppc.c | 1 +
 1 file changed, 1 insertion(+)
hw/ppc/ppc.c +1 -0
index 4a11fb1640..1b98272076 100644
@@ -120,6 +120,7 @@ static void ppc6xx_set_irq(void *opaque, int pin, int level)
             } else {
                 cpu_ppc_tb_stop(env);
             }
+            break;
         case PPC6xx_INPUT_INT:
             /* Level sensitive - active high */
             LOG_IRQ("%s: set the external IRQ state to %d\n",
Signature · 4 lines
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson
author
#17 lore raw

PATCH v2 8/8 target/ppc: replaced the TODO with LOG_UNIMP and add break for silence warnings

In reply to Chen Qun

When using -Wimplicit-fallthrough in our CFLAGS, the compiler showed warning:
target/ppc/mmu_helper.c: In function ‘dump_mmu’:
target/ppc/mmu_helper.c:1351:12: warning: this statement may fall through [-Wimplicit-fallthrough=]
1351 | if (ppc64_v3_radix(env_archcpu(env))) {
| ^
target/ppc/mmu_helper.c:1358:5: note: here

 1358 |     default:
      |     ^~~~~~~

Use "qemu_log_mask(LOG_UNIMP**)" instead of the TODO comment. And add the break statement to fix it.

---
v1->v2: replace the TODO by a LOG_UNIMP call and add break statement(Base on Philippe's comments)

Cc Thomas Huth <[email protected]>
Cc David Gibson <[email protected]>
Cc Philippe Mathieu-Daudé <[email protected]>
---
 target/ppc/mmu_helper.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
target/ppc/mmu_helper.c +3 -2
index 8972714775..12723362b7 100644
@@ -1349,11 +1349,12 @@ void dump_mmu(CPUPPCState *env)
         break;
     case POWERPC_MMU_3_00:
         if (ppc64_v3_radix(env_archcpu(env))) {
-            /* TODO - Unsupported */
+            qemu_log_mask(LOG_UNIMP, "%s: the PPC64 MMU unsupported\n",
+                          __func__);
         } else {
             dump_slb(env_archcpu(env));
-            break;
         }
+        break;
 #endif
     default:
         qemu_log_mask(LOG_UNIMP, "%s: unimplemented\n", __func__);
Signature · 1 line
2.27.0
Reviewed-by on v2 8/8
#18 lore raw

Re: [PATCH v2 8/8] target/ppc: replaced the TODO with LOG_UNIMP and add break for silence warnings

Quoted 34 lines · Chen Qun

When using -Wimplicit-fallthrough in our CFLAGS, the compiler showed warning:
target/ppc/mmu_helper.c: In function ‘dump_mmu’:
target/ppc/mmu_helper.c:1351:12: warning: this statement may fall through [-Wimplicit-fallthrough=]
1351 | if (ppc64_v3_radix(env_archcpu(env))) {
| ^
target/ppc/mmu_helper.c:1358:5: note: here

 1358 |     default:
      |     ^~~~~~~

Use "qemu_log_mask(LOG_UNIMP**)" instead of the TODO comment. And add the break statement to fix it.

---
v1->v2: replace the TODO by a LOG_UNIMP call and add break statement(Base on Philippe's comments)

Cc Thomas Huth <[email protected]>
Cc David Gibson <[email protected]>
Cc Philippe Mathieu-Daudé <[email protected]>
---
 target/ppc/mmu_helper.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
target/ppc/mmu_helper.c +0 -1
index 8972714775..12723362b7 100644
@@ -1349,11 +1349,12 @@ void dump_mmu(CPUPPCState *env)
         break;
     case POWERPC_MMU_3_00:
         if (ppc64_v3_radix(env_archcpu(env))) {
-            /* TODO - Unsupported */

target/ppc/mmu_helper.c void dump_mmu(CPUPPCState *env) · line 1360

Quoted 10 lines
target/ppc/mmu_helper.c +3 -1
+            qemu_log_mask(LOG_UNIMP, "%s: the PPC64 MMU unsupported\n",
+                          __func__);
         } else {
             dump_slb(env_archcpu(env));
-            break;
         }
+        break;
 #endif
     default:
         qemu_log_mask(LOG_UNIMP, "%s: unimplemented\n", __func__);
Reviewed-by on v2 8/8
#19 lore raw

Re: [PATCH v2 8/8] target/ppc: replaced the TODO with LOG_UNIMP and add break for silence warnings

In reply to Chen Qun
Quoted 29 lines · Chen Qun

When using -Wimplicit-fallthrough in our CFLAGS, the compiler showed warning:
target/ppc/mmu_helper.c: In function ‘dump_mmu’:
target/ppc/mmu_helper.c:1351:12: warning: this statement may fall through [-Wimplicit-fallthrough=]
1351 | if (ppc64_v3_radix(env_archcpu(env))) {
| ^
target/ppc/mmu_helper.c:1358:5: note: here

 1358 |     default:
      |     ^~~~~~~

Use "qemu_log_mask(LOG_UNIMP**)" instead of the TODO comment. And add the break statement to fix it.

---
v1->v2: replace the TODO by a LOG_UNIMP call and add break statement(Base on Philippe's comments)

Cc Thomas Huth <[email protected]>
Cc David Gibson <[email protected]>
Cc Philippe Mathieu-Daudé <[email protected]>
---
 target/ppc/mmu_helper.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
target/ppc/mmu_helper.c +0 -0
index 8972714775..12723362b7 100644

target/ppc/mmu_helper.c void dump_mmu(CPUPPCState *env) · line 1352

Quoted 5 lines
target/ppc/mmu_helper.c +1 -1
@@ -1349,11 +1349,12 @@ void dump_mmu(CPUPPCState *env)
         break;
     case POWERPC_MMU_3_00:
         if (ppc64_v3_radix(env_archcpu(env))) {
-            /* TODO - Unsupported */
+            qemu_log_mask(LOG_UNIMP, "%s: the PPC64 MMU unsupported\n",

Maybe add a "is" between "MMU" and "unsupported"?

target/ppc/mmu_helper.c void dump_mmu(CPUPPCState *env) · line 1360

Quoted 10 lines
target/ppc/mmu_helper.c +2 -1
+                          __func__);
         } else {
             dump_slb(env_archcpu(env));
-            break;
         }
+        break;
 #endif
     default:
         qemu_log_mask(LOG_UNIMP, "%s: unimplemented\n", __func__);
Acked-by on v2 8/8
#20 lore raw

Re: [PATCH v2 8/8] target/ppc: replaced the TODO with LOG_UNIMP and add break for silence warnings

In reply to Chen Qun
Quoted 6 lines · Chen Qun

When using -Wimplicit-fallthrough in our CFLAGS, the compiler showed warning:
target/ppc/mmu_helper.c: In function ‘dump_mmu’:
target/ppc/mmu_helper.c:1351:12: warning: this statement may fall through [-Wimplicit-fallthrough=]
1351 | if (ppc64_v3_radix(env_archcpu(env))) {
| ^
target/ppc/mmu_helper.c:1358:5: note: here

Quoted 8 lines
 1358 |     default:
      |     ^~~~~~~

Use "qemu_log_mask(LOG_UNIMP**)" instead of the TODO comment. And add the break statement to fix it.

Quoted 29 lines

---
v1->v2: replace the TODO by a LOG_UNIMP call and add break statement(Base on Philippe's comments)

Cc Thomas Huth <[email protected]>
Cc David Gibson <[email protected]>
Cc Philippe Mathieu-Daudé <[email protected]>
---
 target/ppc/mmu_helper.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
target/ppc/mmu_helper.c +3 -2
index 8972714775..12723362b7 100644
@@ -1349,11 +1349,12 @@ void dump_mmu(CPUPPCState *env)
         break;
     case POWERPC_MMU_3_00:
         if (ppc64_v3_radix(env_archcpu(env))) {
-            /* TODO - Unsupported */
+            qemu_log_mask(LOG_UNIMP, "%s: the PPC64 MMU unsupported\n",
+                          __func__);
         } else {
             dump_slb(env_archcpu(env));
-            break;
         }
+        break;
 #endif
     default:
         qemu_log_mask(LOG_UNIMP, "%s: unimplemented\n", __func__);
Signature · 4 lines
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson