All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/8] silence the compiler warnings
@ 2020-10-30  0:40 Chen Qun
  2020-10-30  0:40 ` [PATCH v2 1/8] target/i386: silence the compiler warnings in gen_shiftd_rm_T1 Chen Qun
                   ` (7 more replies)
  0 siblings, 8 replies; 21+ messages in thread
From: Chen Qun @ 2020-10-30  0:40 UTC (permalink / raw)
  To: qemu-devel, qemu-trivial; +Cc: Chen Qun, zhang.zhanghailiang, ganqixin

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(-)

-- 
2.27.0



^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH v2 1/8] target/i386: silence the compiler warnings in gen_shiftd_rm_T1
  2020-10-30  0:40 [PATCH v2 0/8] silence the compiler warnings Chen Qun
@ 2020-10-30  0:40 ` Chen Qun
  2020-10-30  0:40 ` [PATCH v2 2/8] hw/intc/arm_gicv3_kvm: silence the compiler warnings Chen Qun
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 21+ messages in thread
From: Chen Qun @ 2020-10-30  0:40 UTC (permalink / raw)
  To: qemu-devel, qemu-trivial
  Cc: Thomas Huth, zhang.zhanghailiang, Richard Henderson,
	Paolo Bonzini, ganqixin, Euler Robot, Chen Qun, Eduardo Habkost

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:
     ^~~~

Reported-by: Euler Robot <euler.robot@huawei.com>
Signed-off-by: Chen Qun <kuhn.chenqun@huawei.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Thomas Huth <thuth@redhat.com>
---
v1->v2: Add comments to explain the two case of fall through,
depending on whether TARGET_X86_64 is defined.

Cc: Thomas Huth <thuth@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Richard Henderson <richard.henderson@linaro.org>
Cc: Eduardo Habkost <ehabkost@redhat.com>
---
 target/i386/translate.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/target/i386/translate.c b/target/i386/translate.c
index caea6f5fb1..77cb66208e 100644
--- a/target/i386/translate.c
+++ b/target/i386/translate.c
@@ -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) {
-- 
2.27.0



^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH v2 2/8] hw/intc/arm_gicv3_kvm: silence the compiler warnings
  2020-10-30  0:40 [PATCH v2 0/8] silence the compiler warnings Chen Qun
  2020-10-30  0:40 ` [PATCH v2 1/8] target/i386: silence the compiler warnings in gen_shiftd_rm_T1 Chen Qun
@ 2020-10-30  0:40 ` Chen Qun
  2020-10-30  0:40 ` [PATCH v2 3/8] accel/tcg/user-exec: " Chen Qun
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 21+ messages in thread
From: Chen Qun @ 2020-10-30  0:40 UTC (permalink / raw)
  To: qemu-devel, qemu-trivial
  Cc: Peter Maydell, zhang.zhanghailiang, qemu-arm, ganqixin,
	Euler Robot, 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:
         ^~~~~~~

Reported-by: Euler Robot <euler.robot@huawei.com>
Signed-off-by: Chen Qun <kuhn.chenqun@huawei.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
---
Cc: Peter Maydell <peter.maydell@linaro.org>
Cc: qemu-arm@nongnu.org
---
 hw/intc/arm_gicv3_kvm.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/hw/intc/arm_gicv3_kvm.c b/hw/intc/arm_gicv3_kvm.c
index 187eb054e0..d040a5d1e9 100644
--- a/hw/intc/arm_gicv3_kvm.c
+++ b/hw/intc/arm_gicv3_kvm.c
@@ -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;
-- 
2.27.0



^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH v2 3/8] accel/tcg/user-exec: silence the compiler warnings
  2020-10-30  0:40 [PATCH v2 0/8] silence the compiler warnings Chen Qun
  2020-10-30  0:40 ` [PATCH v2 1/8] target/i386: silence the compiler warnings in gen_shiftd_rm_T1 Chen Qun
  2020-10-30  0:40 ` [PATCH v2 2/8] hw/intc/arm_gicv3_kvm: silence the compiler warnings Chen Qun
@ 2020-10-30  0:40 ` Chen Qun
  2020-10-30  5:50   ` Richard Henderson
                     ` (2 more replies)
  2020-10-30  0:40 ` [PATCH v2 4/8] linux-user/mips/cpu_loop: " Chen Qun
                   ` (4 subsequent siblings)
  7 siblings, 3 replies; 21+ messages in thread
From: Chen Qun @ 2020-10-30  0:40 UTC (permalink / raw)
  To: qemu-devel, qemu-trivial
  Cc: Thomas Huth, zhang.zhanghailiang, Riku Voipio, Richard Henderson,
	Paolo Bonzini, ganqixin, Euler Robot, 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.

Reported-by: Euler Robot <euler.robot@huawei.com>
Signed-off-by: Chen Qun <kuhn.chenqun@huawei.com>
---
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 <thuth@redhat.com>
Cc: Riku Voipio <riku.voipio@iki.fi>
Cc: Richard Henderson <richard.henderson@linaro.org>
Cc: Paolo Bonzini <pbonzini@redhat.com>
---
 accel/tcg/user-exec.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/accel/tcg/user-exec.c b/accel/tcg/user-exec.c
index 4ebe25461a..293ee86ea4 100644
--- a/accel/tcg/user-exec.c
+++ b/accel/tcg/user-exec.c
@@ -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);
-- 
2.27.0



^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH v2 4/8] linux-user/mips/cpu_loop: silence the compiler warnings
  2020-10-30  0:40 [PATCH v2 0/8] silence the compiler warnings Chen Qun
                   ` (2 preceding siblings ...)
  2020-10-30  0:40 ` [PATCH v2 3/8] accel/tcg/user-exec: " Chen Qun
@ 2020-10-30  0:40 ` Chen Qun
  2020-10-30  9:55   ` Laurent Vivier
  2020-11-04 21:22   ` Laurent Vivier
  2020-10-30  0:40 ` [PATCH v2 5/8] target/sparc/translate: " Chen Qun
                   ` (3 subsequent siblings)
  7 siblings, 2 replies; 21+ messages in thread
From: Chen Qun @ 2020-10-30  0:40 UTC (permalink / raw)
  To: qemu-devel, qemu-trivial
  Cc: Thomas Huth, zhang.zhanghailiang, Laurent Vivier, ganqixin,
	Euler Robot, 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.

Reported-by: Euler Robot <euler.robot@huawei.com>
Signed-off-by: Chen Qun <kuhn.chenqun@huawei.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
---
Cc: Laurent Vivier <laurent@vivier.eu>
---
 linux-user/mips/cpu_loop.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/linux-user/mips/cpu_loop.c b/linux-user/mips/cpu_loop.c
index 553e8ca7f5..cfe7ba5c47 100644
--- a/linux-user/mips/cpu_loop.c
+++ b/linux-user/mips/cpu_loop.c
@@ -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;
                 }
-- 
2.27.0



^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH v2 5/8] target/sparc/translate: silence the compiler warnings
  2020-10-30  0:40 [PATCH v2 0/8] silence the compiler warnings Chen Qun
                   ` (3 preceding siblings ...)
  2020-10-30  0:40 ` [PATCH v2 4/8] linux-user/mips/cpu_loop: " Chen Qun
@ 2020-10-30  0:40 ` Chen Qun
  2020-10-30  0:40 ` [PATCH v2 6/8] target/sparc/win_helper: " Chen Qun
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 21+ messages in thread
From: Chen Qun @ 2020-10-30  0:40 UTC (permalink / raw)
  To: qemu-devel, qemu-trivial
  Cc: zhang.zhanghailiang, Mark Cave-Ayland,
	Philippe Mathieu-Daudé,
	ganqixin, Euler Robot, Chen Qun, Artyom Tarasenko

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.

Reported-by: Euler Robot <euler.robot@huawei.com>
Signed-off-by: Chen Qun <kuhn.chenqun@huawei.com>
Reviewed-by: Artyom Tarasenko <atar4qemu@gmail.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
Cc: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Cc: Artyom Tarasenko <atar4qemu@gmail.com>
---
 target/sparc/translate.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/sparc/translate.c b/target/sparc/translate.c
index 1a4efd4ed6..a3d9aaa46b 100644
--- a/target/sparc/translate.c
+++ b/target/sparc/translate.c
@@ -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);
-- 
2.27.0



^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH v2 6/8] target/sparc/win_helper: silence the compiler warnings
  2020-10-30  0:40 [PATCH v2 0/8] silence the compiler warnings Chen Qun
                   ` (4 preceding siblings ...)
  2020-10-30  0:40 ` [PATCH v2 5/8] target/sparc/translate: " Chen Qun
@ 2020-10-30  0:40 ` Chen Qun
  2020-10-30  5:52   ` Richard Henderson
  2020-10-30  6:32   ` Philippe Mathieu-Daudé
  2020-10-30  0:40 ` [PATCH v2 7/8] ppc: Add a missing break for PPC6xx_INPUT_TBEN Chen Qun
  2020-10-30  0:40 ` [PATCH v2 8/8] target/ppc: replaced the TODO with LOG_UNIMP and add break for silence warnings Chen Qun
  7 siblings, 2 replies; 21+ messages in thread
From: Chen Qun @ 2020-10-30  0:40 UTC (permalink / raw)
  To: qemu-devel, qemu-trivial
  Cc: zhang.zhanghailiang, Mark Cave-Ayland,
	Philippe Mathieu-Daudé,
	ganqixin, Euler Robot, Chen Qun, Artyom Tarasenko

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.

Reported-by: Euler Robot <euler.robot@huawei.com>
Signed-off-by: Chen Qun <kuhn.chenqun@huawei.com>
Reviewed-by: Artyom Tarasenko <atar4qemu@gmail.com>
---
v1->v2: Combine the /* fall through */ to the preceding comments
(Base on Philippe's comments).

Cc: Philippe Mathieu-Daudé <philippe.mathieu.daude@gmail.com>
Cc: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Cc: Artyom Tarasenko <atar4qemu@gmail.com>
---
 target/sparc/win_helper.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/sparc/win_helper.c b/target/sparc/win_helper.c
index 8290a21142..e78660b60a 100644
--- a/target/sparc/win_helper.c
+++ b/target/sparc/win_helper.c
@@ -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:
-- 
2.27.0



^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH v2 7/8] ppc: Add a missing break for PPC6xx_INPUT_TBEN
  2020-10-30  0:40 [PATCH v2 0/8] silence the compiler warnings Chen Qun
                   ` (5 preceding siblings ...)
  2020-10-30  0:40 ` [PATCH v2 6/8] target/sparc/win_helper: " Chen Qun
@ 2020-10-30  0:40 ` Chen Qun
  2020-10-30 15:41   ` Thomas Huth
  2020-10-31  5:01   ` David Gibson
  2020-10-30  0:40 ` [PATCH v2 8/8] target/ppc: replaced the TODO with LOG_UNIMP and add break for silence warnings Chen Qun
  7 siblings, 2 replies; 21+ messages in thread
From: Chen Qun @ 2020-10-30  0:40 UTC (permalink / raw)
  To: qemu-devel, qemu-trivial
  Cc: Thomas Huth, zhang.zhanghailiang, ganqixin, Euler Robot,
	Chen Qun, David Gibson

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.

Reported-by: Euler Robot <euler.robot@huawei.com>
Signed-off-by: Chen Qun <kuhn.chenqun@huawei.com>
---
v1->v2: Add a "break" statement here instead of /* fall through */ comments
(Base on Thomas's and David review).

Cc: Thomas Huth <thuth@redhat.com>
Cc: David Gibson <david@gibson.dropbear.id.au>
---
 hw/ppc/ppc.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/hw/ppc/ppc.c b/hw/ppc/ppc.c
index 4a11fb1640..1b98272076 100644
--- a/hw/ppc/ppc.c
+++ b/hw/ppc/ppc.c
@@ -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",
-- 
2.27.0



^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH v2 8/8] target/ppc: replaced the TODO with LOG_UNIMP and add break for silence warnings
  2020-10-30  0:40 [PATCH v2 0/8] silence the compiler warnings Chen Qun
                   ` (6 preceding siblings ...)
  2020-10-30  0:40 ` [PATCH v2 7/8] ppc: Add a missing break for PPC6xx_INPUT_TBEN Chen Qun
@ 2020-10-30  0:40 ` Chen Qun
  2020-10-30  6:33   ` Philippe Mathieu-Daudé
                     ` (2 more replies)
  7 siblings, 3 replies; 21+ messages in thread
From: Chen Qun @ 2020-10-30  0:40 UTC (permalink / raw)
  To: qemu-devel, qemu-trivial
  Cc: Thomas Huth, zhang.zhanghailiang, ganqixin, Euler Robot,
	Chen Qun, Philippe Mathieu-Daudé,
	David Gibson

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.

Reported-by: Euler Robot <euler.robot@huawei.com>
Signed-off-by: Chen Qun <kuhn.chenqun@huawei.com>
---
v1->v2: replace the TODO by a LOG_UNIMP call and add break statement(Base on Philippe's comments)

Cc: Thomas Huth <thuth@redhat.com>
Cc: David Gibson <david@gibson.dropbear.id.au>
Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 target/ppc/mmu_helper.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/target/ppc/mmu_helper.c b/target/ppc/mmu_helper.c
index 8972714775..12723362b7 100644
--- a/target/ppc/mmu_helper.c
+++ b/target/ppc/mmu_helper.c
@@ -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__);
-- 
2.27.0



^ permalink raw reply related	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 3/8] accel/tcg/user-exec: silence the compiler warnings
  2020-10-30  0:40 ` [PATCH v2 3/8] accel/tcg/user-exec: " Chen Qun
@ 2020-10-30  5:50   ` Richard Henderson
  2020-10-30  6:31   ` Philippe Mathieu-Daudé
  2020-10-30 15:40   ` Thomas Huth
  2 siblings, 0 replies; 21+ messages in thread
From: Richard Henderson @ 2020-10-30  5:50 UTC (permalink / raw)
  To: Chen Qun, qemu-devel, qemu-trivial
  Cc: Thomas Huth, zhang.zhanghailiang, Riku Voipio, ganqixin,
	Euler Robot, Paolo Bonzini

On 10/29/20 5:40 PM, Chen Qun wrote:
> 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.
> 
> Reported-by: Euler Robot <euler.robot@huawei.com>
> Signed-off-by: Chen Qun <kuhn.chenqun@huawei.com>
> ---
> 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: Richard Henderson <richard.henderson@linaro.org>


r~


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 6/8] target/sparc/win_helper: silence the compiler warnings
  2020-10-30  0:40 ` [PATCH v2 6/8] target/sparc/win_helper: " Chen Qun
@ 2020-10-30  5:52   ` Richard Henderson
  2020-10-30  6:32   ` Philippe Mathieu-Daudé
  1 sibling, 0 replies; 21+ messages in thread
From: Richard Henderson @ 2020-10-30  5:52 UTC (permalink / raw)
  To: Chen Qun, qemu-devel, qemu-trivial
  Cc: zhang.zhanghailiang, Mark Cave-Ayland,
	Philippe Mathieu-Daudé,
	ganqixin, Euler Robot, Artyom Tarasenko

On 10/29/20 5:40 PM, Chen Qun wrote:
> 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.
> 
> Reported-by: Euler Robot <euler.robot@huawei.com>
> Signed-off-by: Chen Qun <kuhn.chenqun@huawei.com>
> Reviewed-by: Artyom Tarasenko <atar4qemu@gmail.com>
> ---
> v1->v2: Combine the /* fall through */ to the preceding comments
> (Base on Philippe's comments).

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>


r~



^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 3/8] accel/tcg/user-exec: silence the compiler warnings
  2020-10-30  0:40 ` [PATCH v2 3/8] accel/tcg/user-exec: " Chen Qun
  2020-10-30  5:50   ` Richard Henderson
@ 2020-10-30  6:31   ` Philippe Mathieu-Daudé
  2020-10-30 15:40   ` Thomas Huth
  2 siblings, 0 replies; 21+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-10-30  6:31 UTC (permalink / raw)
  To: Chen Qun, qemu-devel, qemu-trivial
  Cc: Thomas Huth, zhang.zhanghailiang, Riku Voipio, Richard Henderson,
	ganqixin, Euler Robot, Paolo Bonzini

On 10/30/20 1:40 AM, Chen Qun wrote:
> 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.
> 
> Reported-by: Euler Robot <euler.robot@huawei.com>
> Signed-off-by: Chen Qun <kuhn.chenqun@huawei.com>
> ---
> 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: Philippe Mathieu-Daudé <f4bug@amsat.org>



^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 6/8] target/sparc/win_helper: silence the compiler warnings
  2020-10-30  0:40 ` [PATCH v2 6/8] target/sparc/win_helper: " Chen Qun
  2020-10-30  5:52   ` Richard Henderson
@ 2020-10-30  6:32   ` Philippe Mathieu-Daudé
  1 sibling, 0 replies; 21+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-10-30  6:32 UTC (permalink / raw)
  To: Chen Qun, qemu-devel, qemu-trivial
  Cc: zhang.zhanghailiang, Mark Cave-Ayland,
	Philippe Mathieu-Daudé,
	ganqixin, Euler Robot, Artyom Tarasenko

On 10/30/20 1:40 AM, Chen Qun wrote:
> 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.
> 
> Reported-by: Euler Robot <euler.robot@huawei.com>
> Signed-off-by: Chen Qun <kuhn.chenqun@huawei.com>
> Reviewed-by: Artyom Tarasenko <atar4qemu@gmail.com>
> ---
> v1->v2: Combine the /* fall through */ to the preceding comments
> (Base on Philippe's comments).

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 8/8] target/ppc: replaced the TODO with LOG_UNIMP and add break for silence warnings
  2020-10-30  0:40 ` [PATCH v2 8/8] target/ppc: replaced the TODO with LOG_UNIMP and add break for silence warnings Chen Qun
@ 2020-10-30  6:33   ` Philippe Mathieu-Daudé
  2020-10-30 15:43   ` Thomas Huth
  2020-10-31  5:01   ` David Gibson
  2 siblings, 0 replies; 21+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-10-30  6:33 UTC (permalink / raw)
  To: Chen Qun, qemu-devel, qemu-trivial
  Cc: Thomas Huth, David Gibson, zhang.zhanghailiang, ganqixin, Euler Robot

On 10/30/20 1:40 AM, Chen Qun wrote:
> 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.
> 
> Reported-by: Euler Robot <euler.robot@huawei.com>
> Signed-off-by: Chen Qun <kuhn.chenqun@huawei.com>
> ---
> v1->v2: replace the TODO by a LOG_UNIMP call and add break statement(Base on Philippe's comments)
> 
> Cc: Thomas Huth <thuth@redhat.com>
> Cc: David Gibson <david@gibson.dropbear.id.au>
> Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
>  target/ppc/mmu_helper.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/target/ppc/mmu_helper.c b/target/ppc/mmu_helper.c
> index 8972714775..12723362b7 100644
> --- a/target/ppc/mmu_helper.c
> +++ b/target/ppc/mmu_helper.c
> @@ -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__);
> 

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>



^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 4/8] linux-user/mips/cpu_loop: silence the compiler warnings
  2020-10-30  0:40 ` [PATCH v2 4/8] linux-user/mips/cpu_loop: " Chen Qun
@ 2020-10-30  9:55   ` Laurent Vivier
  2020-11-04 21:22   ` Laurent Vivier
  1 sibling, 0 replies; 21+ messages in thread
From: Laurent Vivier @ 2020-10-30  9:55 UTC (permalink / raw)
  To: Chen Qun, qemu-devel, qemu-trivial
  Cc: Thomas Huth, zhang.zhanghailiang, ganqixin, Euler Robot

Le 30/10/2020 à 01:40, Chen Qun a écrit :
> 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.
> 
> Reported-by: Euler Robot <euler.robot@huawei.com>
> Signed-off-by: Chen Qun <kuhn.chenqun@huawei.com>
> Reviewed-by: Thomas Huth <thuth@redhat.com>
> ---
> Cc: Laurent Vivier <laurent@vivier.eu>
> ---
>  linux-user/mips/cpu_loop.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/linux-user/mips/cpu_loop.c b/linux-user/mips/cpu_loop.c
> index 553e8ca7f5..cfe7ba5c47 100644
> --- a/linux-user/mips/cpu_loop.c
> +++ b/linux-user/mips/cpu_loop.c
> @@ -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;
>                  }
> 

Reviewed-by: Laurent Vivier <laurent@vivier.eu>


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 3/8] accel/tcg/user-exec: silence the compiler warnings
  2020-10-30  0:40 ` [PATCH v2 3/8] accel/tcg/user-exec: " Chen Qun
  2020-10-30  5:50   ` Richard Henderson
  2020-10-30  6:31   ` Philippe Mathieu-Daudé
@ 2020-10-30 15:40   ` Thomas Huth
  2 siblings, 0 replies; 21+ messages in thread
From: Thomas Huth @ 2020-10-30 15:40 UTC (permalink / raw)
  To: Chen Qun, qemu-devel, qemu-trivial
  Cc: zhang.zhanghailiang, Riku Voipio, Richard Henderson, ganqixin,
	Euler Robot, Paolo Bonzini

On 30/10/2020 01.40, Chen Qun wrote:
> 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.
> 
> Reported-by: Euler Robot <euler.robot@huawei.com>
> Signed-off-by: Chen Qun <kuhn.chenqun@huawei.com>
> ---
> 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 <thuth@redhat.com>
> Cc: Riku Voipio <riku.voipio@iki.fi>
> Cc: Richard Henderson <richard.henderson@linaro.org>
> Cc: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  accel/tcg/user-exec.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/accel/tcg/user-exec.c b/accel/tcg/user-exec.c
> index 4ebe25461a..293ee86ea4 100644
> --- a/accel/tcg/user-exec.c
> +++ b/accel/tcg/user-exec.c
> @@ -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);
> 

Reviewed-by: Thomas Huth <thuth@redhat.com>



^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 7/8] ppc: Add a missing break for PPC6xx_INPUT_TBEN
  2020-10-30  0:40 ` [PATCH v2 7/8] ppc: Add a missing break for PPC6xx_INPUT_TBEN Chen Qun
@ 2020-10-30 15:41   ` Thomas Huth
  2020-10-31  5:01   ` David Gibson
  1 sibling, 0 replies; 21+ messages in thread
From: Thomas Huth @ 2020-10-30 15:41 UTC (permalink / raw)
  To: Chen Qun, qemu-devel, qemu-trivial
  Cc: David Gibson, zhang.zhanghailiang, ganqixin, Euler Robot

On 30/10/2020 01.40, Chen Qun wrote:
> 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.
> 
> Reported-by: Euler Robot <euler.robot@huawei.com>
> Signed-off-by: Chen Qun <kuhn.chenqun@huawei.com>
> ---
> v1->v2: Add a "break" statement here instead of /* fall through */ comments
> (Base on Thomas's and David review).
> 
> Cc: Thomas Huth <thuth@redhat.com>
> Cc: David Gibson <david@gibson.dropbear.id.au>
> ---
>  hw/ppc/ppc.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/hw/ppc/ppc.c b/hw/ppc/ppc.c
> index 4a11fb1640..1b98272076 100644
> --- a/hw/ppc/ppc.c
> +++ b/hw/ppc/ppc.c
> @@ -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",
> 

Reviewed-by: Thomas Huth <thuth@redhat.com>



^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 8/8] target/ppc: replaced the TODO with LOG_UNIMP and add break for silence warnings
  2020-10-30  0:40 ` [PATCH v2 8/8] target/ppc: replaced the TODO with LOG_UNIMP and add break for silence warnings Chen Qun
  2020-10-30  6:33   ` Philippe Mathieu-Daudé
@ 2020-10-30 15:43   ` Thomas Huth
  2020-10-31  5:01   ` David Gibson
  2 siblings, 0 replies; 21+ messages in thread
From: Thomas Huth @ 2020-10-30 15:43 UTC (permalink / raw)
  To: Chen Qun, qemu-devel, qemu-trivial
  Cc: David Gibson, Philippe Mathieu-Daudé,
	zhang.zhanghailiang, ganqixin, Euler Robot

On 30/10/2020 01.40, Chen Qun wrote:
> 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.
> 
> Reported-by: Euler Robot <euler.robot@huawei.com>
> Signed-off-by: Chen Qun <kuhn.chenqun@huawei.com>
> ---
> v1->v2: replace the TODO by a LOG_UNIMP call and add break statement(Base on Philippe's comments)
> 
> Cc: Thomas Huth <thuth@redhat.com>
> Cc: David Gibson <david@gibson.dropbear.id.au>
> Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
>  target/ppc/mmu_helper.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/target/ppc/mmu_helper.c b/target/ppc/mmu_helper.c
> index 8972714775..12723362b7 100644
> --- a/target/ppc/mmu_helper.c
> +++ b/target/ppc/mmu_helper.c
> @@ -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"?

> +                          __func__);
>          } else {
>              dump_slb(env_archcpu(env));
> -            break;
>          }
> +        break;
>  #endif
>      default:
>          qemu_log_mask(LOG_UNIMP, "%s: unimplemented\n", __func__);
> 

Reviewed-by: Thomas Huth <thuth@redhat.com>



^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 7/8] ppc: Add a missing break for PPC6xx_INPUT_TBEN
  2020-10-30  0:40 ` [PATCH v2 7/8] ppc: Add a missing break for PPC6xx_INPUT_TBEN Chen Qun
  2020-10-30 15:41   ` Thomas Huth
@ 2020-10-31  5:01   ` David Gibson
  1 sibling, 0 replies; 21+ messages in thread
From: David Gibson @ 2020-10-31  5:01 UTC (permalink / raw)
  To: Chen Qun
  Cc: Thomas Huth, zhang.zhanghailiang, qemu-trivial, qemu-devel,
	ganqixin, Euler Robot

[-- Attachment #1: Type: text/plain, Size: 1647 bytes --]

On Fri, Oct 30, 2020 at 08:40:45AM +0800, Chen Qun wrote:
> 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.
> 
> Reported-by: Euler Robot <euler.robot@huawei.com>
> Signed-off-by: Chen Qun <kuhn.chenqun@huawei.com>
> ---
> v1->v2: Add a "break" statement here instead of /* fall through */ comments
> (Base on Thomas's and David review).
> 
> Cc: Thomas Huth <thuth@redhat.com>
> Cc: David Gibson <david@gibson.dropbear.id.au>

Acked-by: David Gibson <david@gibson.dropbear.id.au>

> ---
>  hw/ppc/ppc.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/hw/ppc/ppc.c b/hw/ppc/ppc.c
> index 4a11fb1640..1b98272076 100644
> --- a/hw/ppc/ppc.c
> +++ b/hw/ppc/ppc.c
> @@ -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",

-- 
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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 8/8] target/ppc: replaced the TODO with LOG_UNIMP and add break for silence warnings
  2020-10-30  0:40 ` [PATCH v2 8/8] target/ppc: replaced the TODO with LOG_UNIMP and add break for silence warnings Chen Qun
  2020-10-30  6:33   ` Philippe Mathieu-Daudé
  2020-10-30 15:43   ` Thomas Huth
@ 2020-10-31  5:01   ` David Gibson
  2 siblings, 0 replies; 21+ messages in thread
From: David Gibson @ 2020-10-31  5:01 UTC (permalink / raw)
  To: Chen Qun
  Cc: Thomas Huth, zhang.zhanghailiang, qemu-trivial, qemu-devel,
	ganqixin, Euler Robot, Philippe Mathieu-Daudé

[-- Attachment #1: Type: text/plain, Size: 2012 bytes --]

On Fri, Oct 30, 2020 at 08:40:46AM +0800, Chen Qun wrote:
> 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.
> 
> Reported-by: Euler Robot <euler.robot@huawei.com>
> Signed-off-by: Chen Qun <kuhn.chenqun@huawei.com>

Acked-by: David Gibson <david@gibson.dropbear.id.au>

> ---
> v1->v2: replace the TODO by a LOG_UNIMP call and add break statement(Base on Philippe's comments)
> 
> Cc: Thomas Huth <thuth@redhat.com>
> Cc: David Gibson <david@gibson.dropbear.id.au>
> Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
>  target/ppc/mmu_helper.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/target/ppc/mmu_helper.c b/target/ppc/mmu_helper.c
> index 8972714775..12723362b7 100644
> --- a/target/ppc/mmu_helper.c
> +++ b/target/ppc/mmu_helper.c
> @@ -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__);

-- 
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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 4/8] linux-user/mips/cpu_loop: silence the compiler warnings
  2020-10-30  0:40 ` [PATCH v2 4/8] linux-user/mips/cpu_loop: " Chen Qun
  2020-10-30  9:55   ` Laurent Vivier
@ 2020-11-04 21:22   ` Laurent Vivier
  1 sibling, 0 replies; 21+ messages in thread
From: Laurent Vivier @ 2020-11-04 21:22 UTC (permalink / raw)
  To: Chen Qun, qemu-devel, qemu-trivial
  Cc: Thomas Huth, zhang.zhanghailiang, ganqixin, Euler Robot

Le 30/10/2020 à 01:40, Chen Qun a écrit :
> 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.
> 
> Reported-by: Euler Robot <euler.robot@huawei.com>
> Signed-off-by: Chen Qun <kuhn.chenqun@huawei.com>
> Reviewed-by: Thomas Huth <thuth@redhat.com>
> ---
> Cc: Laurent Vivier <laurent@vivier.eu>
> ---
>  linux-user/mips/cpu_loop.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/linux-user/mips/cpu_loop.c b/linux-user/mips/cpu_loop.c
> index 553e8ca7f5..cfe7ba5c47 100644
> --- a/linux-user/mips/cpu_loop.c
> +++ b/linux-user/mips/cpu_loop.c
> @@ -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;
>                  }
> 

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

Thanks,
Laurent



^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2020-11-04 21:23 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-30  0:40 [PATCH v2 0/8] silence the compiler warnings Chen Qun
2020-10-30  0:40 ` [PATCH v2 1/8] target/i386: silence the compiler warnings in gen_shiftd_rm_T1 Chen Qun
2020-10-30  0:40 ` [PATCH v2 2/8] hw/intc/arm_gicv3_kvm: silence the compiler warnings Chen Qun
2020-10-30  0:40 ` [PATCH v2 3/8] accel/tcg/user-exec: " Chen Qun
2020-10-30  5:50   ` Richard Henderson
2020-10-30  6:31   ` Philippe Mathieu-Daudé
2020-10-30 15:40   ` Thomas Huth
2020-10-30  0:40 ` [PATCH v2 4/8] linux-user/mips/cpu_loop: " Chen Qun
2020-10-30  9:55   ` Laurent Vivier
2020-11-04 21:22   ` Laurent Vivier
2020-10-30  0:40 ` [PATCH v2 5/8] target/sparc/translate: " Chen Qun
2020-10-30  0:40 ` [PATCH v2 6/8] target/sparc/win_helper: " Chen Qun
2020-10-30  5:52   ` Richard Henderson
2020-10-30  6:32   ` Philippe Mathieu-Daudé
2020-10-30  0:40 ` [PATCH v2 7/8] ppc: Add a missing break for PPC6xx_INPUT_TBEN Chen Qun
2020-10-30 15:41   ` Thomas Huth
2020-10-31  5:01   ` David Gibson
2020-10-30  0:40 ` [PATCH v2 8/8] target/ppc: replaced the TODO with LOG_UNIMP and add break for silence warnings Chen Qun
2020-10-30  6:33   ` Philippe Mathieu-Daudé
2020-10-30 15:43   ` Thomas Huth
2020-10-31  5:01   ` David Gibson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.