Skip to contentSkip to conversation

silence the compiler warnings

PATCH Applied Chen Qun 5 participants 15 messages Nov 16, 2020 – Dec 11, 2020

lore
Share & tools
lore

Chen Qun

author
#0 lore raw

v3 cover silence the compiler warnings

Hi folks,
This series fix some "fall through" warnings reported by GCC_9.3. They've been
reviewed for a long time. Some of these patchs may be important for QEMU 5.2. Such as the Patch6 miss a break statement. Others only add "fall through" comments and may not have a negative impact for QEMU 5.2.

Thanks,
Chen Qun

Since v2:
- Patch3:Add Richard Henderson、Philippe Mathieu-Daudé and Thomas Huth reviewed tag.
- Patch4: Laurent pull it to master, remove it.
- Patch6->Patch5: Add Richard Henderson and Philippe Mathieu-Daudé reviewed tag.
- Patch7->Patch6: Add Thomas Huth reviewed tag and David Gibson acked tag.
- Patch8->Patch7: Tweak LOG_UNIMP message base on Thomas Huth comment; Add Philippe Mathieu-Daudé and Thomas Huth reviewed tag; Add David Gibson acked tag.

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 (7):
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 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 +
 target/i386/translate.c   | 7 +++++--
 target/ppc/mmu_helper.c   | 5 +++--
 target/sparc/translate.c  | 2 +-
 target/sparc/win_helper.c | 2 +-
 7 files changed, 21 insertions(+), 7 deletions(-)
Signature · 1 line
2.27.0
author
#1 lore raw

PATCH v3 1/7 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 on GCC9, 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 v3 2/7 hw/intc/arm_gicv3_kvm: silence the compiler warnings

In reply to Chen Qun

When using -Wimplicit-fallthrough in our CFLAGS on GCC9, 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 v3 3/7 accel/tcg/user-exec: silence the compiler warnings

In reply to Chen Qun

When using -Wimplicit-fallthrough in our CFLAGS on GCC9, 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 v3 3/7
#4 lore raw

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

Quoted 8 lines · Chen Qun

When using -Wimplicit-fallthrough in our CFLAGS on GCC9, 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.

Signature · 1 line
Alex Bennée
author
#5 lore raw

PATCH v3 4/7 target/sparc/translate: silence the compiler warnings

In reply to Chen Qun

When using -Wimplicit-fallthrough in our CFLAGS on GCC9, 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
#6 lore raw

PATCH v3 5/7 target/sparc/win_helper: silence the compiler warnings

In reply to Chen Qun

When using -Wimplicit-fallthrough in our CFLAGS on GCC9, 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
author
#7 lore raw

PATCH v3 6/7 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
#8 lore raw

Re: [PATCH-for-5.2 v3 6/7] ppc: Add a missing break for PPC6xx_INPUT_TBEN

David, can you queue this patch for 5.2 (bugfix)?

Quoted 38 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 +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",
#9 lore raw

Re: [PATCH-for-5.2 v3 6/7] ppc: Add a missing break for PPC6xx_INPUT_TBEN

Quoted 1 line · Philippe Mathieu-Daudé

David, can you queue this patch for 5.2 (bugfix)?

Sorry about this, I've been on vacation.

Although it is a bugfix, it's been there for a very long time and no-one's hit it in practice.

So, I'm disinclined to push it in this late in the 5.2 cycle.

Quoted 41 lines · Chen Qun
Quoted 38 lines

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 · 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
Applied
#10 lore raw

Re: [PATCH v3 6/7] ppc: Add a missing break for PPC6xx_INPUT_TBEN

In reply to Chen Qun
Quoted 9 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:
      |         ^~~~
Quoted 6 lines

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

Applied to ppc-for-6.0, thanks.

Quoted 22 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]>
---
 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
#11 lore raw

PATCH v3 7/7 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..3bb50546f8 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 is 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
Applied
#12 lore raw

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

Quoted 9 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:
      |     ^~~~~~~
Quoted 8 lines

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

Applied to ppc-for-6.0, thanks.

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..3bb50546f8 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 is 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
#13 lore raw
In reply to Chen Qun

Kindly ping!

Hi all,
Patch 1 to Patch 5 are not in the queue. Could someone pick them up?

Patch1~Patch5:
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 target/sparc/translate: silence the compiler warnings target/sparc/win_helper: silence the compiler warnings

Thanks,
Chen Qun

Quoted 73 lines

-----Original Message-----
From: Chenqun (kuhn)
Sent: Monday, November 16, 2020 10:48 AM
To: [email protected]; [email protected]
Cc: Zhanghailiang <[email protected]>; ganqixin <[email protected]>; Chenqun (kuhn) <[email protected]>
Subject: [PATCH v3 0/7] silence the compiler warnings

Hi folks,
This series fix some "fall through" warnings reported by GCC_9.3. They've
been reviewed for a long time. Some of these patchs may be important for QEMU 5.2.
Such as the Patch6 miss a break statement. Others only add "fall through" comments and may not have a negative impact for QEMU 5.2.

Thanks,
Chen Qun

Since v2:
- Patch3:Add Richard Henderson、Philippe Mathieu-Daudé and Thomas Huth reviewed tag.
- Patch4: Laurent pull it to master, remove it.
- Patch6->Patch5: Add Richard Henderson and Philippe Mathieu-Daudé reviewed tag.
- Patch7->Patch6: Add Thomas Huth reviewed tag and David Gibson acked tag.
- Patch8->Patch7: Tweak LOG_UNIMP message base on Thomas Huth comment;
Add Philippe Mathieu-Daudé and Thomas Huth reviewed tag; Add David
Gibson acked tag.

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@us ers)

Chen Qun (7):
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 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 +
 target/i386/translate.c   | 7 +++++--
 target/ppc/mmu_helper.c   | 5 +++--
 target/sparc/translate.c  | 2 +-
 target/sparc/win_helper.c | 2 +-
 7 files changed, 21 insertions(+), 7 deletions(-)

--
2.27.0

#14 lore raw
Quoted 4 lines · Chenqun (kuhn)

Kindly ping!

Hi all,
Patch 1 to Patch 5 are not in the queue. Could someone pick them up?

Hi,

yes, I'm currently preparing another patch series that includes your patches, which will finally turn on -Wimplicit-fallthrough for everybody. I'll send it out once David's ppc pull request has been merged, so that I don't have to include the ppc patches again.

Thomas