Skip to contentSkip to conversation

Fix more GCC9 -O3 warnings

PATCH In review Philippe Mathieu-Daudé 6 participants 20 messages Dec 18, 2019 – Jan 17, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

v2 cover Fix more GCC9 -O3 warnings

Fix some trivial warnings when building with -O3.

v2:
- addressed Thomas and Aleksandar comments
- dropped 'hw/scsi/megasas: Silent GCC9 duplicated-cond warning'
- dropped 'qemu-io-cmds: Silent GCC9 format-overflow warning'

Philippe Mathieu-Daudé (6):
audio/audio: Add missing fall through comment hw/display/tcx: Add missing fall through comments hw/timer/aspeed_timer: Add a fall through comment hw/net/imx_fec: Rewrite fall through comments hw/net/imx_fec: Remove unuseful FALLTHROUGH comments hw/pci-host/designware: Remove unuseful FALLTHROUGH comment

 audio/audio.c            | 1 +
 hw/display/tcx.c         | 2 ++
 hw/net/imx_fec.c         | 7 ++++---
 hw/pci-host/designware.c | 2 +-
 hw/timer/aspeed_timer.c  | 2 +-
 5 files changed, 9 insertions(+), 5 deletions(-)
Cc Aleksandar Markovic <[email protected]>
Cc Andrew Jeffery <[email protected]>
Cc Andrey Smirnov <[email protected]>
Cc "Cédric Le Goater" <[email protected]>
Cc Gerd Hoffmann <[email protected]>
Cc Jason Wang <[email protected]>
Cc Joel Stanley <[email protected]>
Cc "Kővágó, Zoltán" <[email protected]>
Cc Mark Cave-Ayland <[email protected]>
Cc Markus Armbruster <[email protected]>
Cc Olivier Danet <[email protected]>
Cc Peter Chubb <[email protected]>
Cc Peter Maydell <[email protected]>
Signature · 1 line
2.21.0
#10 lore raw

RFC PATCH v2 5/6 hw/net/imx_fec: Remove unuseful FALLTHROUGH comments

We don't need to explicit these obvious switch fall through comments. Stay consistent with the rest of the codebase.

---
Cc: Peter Chubb <[email protected]>
Cc: Markus Armbruster <[email protected]>
Cc: Peter Maydell <[email protected]>
Cc: Jason Wang <[email protected]>
Cc: [email protected]

---
 hw/net/imx_fec.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
hw/net/imx_fec.c +2 -2
index c01ce4f078..5a83678f64 100644
@@ -901,8 +901,8 @@ static void imx_eth_write(void *opaque, hwaddr offset, uint64_t value,
             s->regs[index] = 0;
         }
         break;
-    case ENET_TDAR1:    /* FALLTHROUGH */
-    case ENET_TDAR2:    /* FALLTHROUGH */
+    case ENET_TDAR1:
+    case ENET_TDAR2:
         if (unlikely(single_tx_ring)) {
             qemu_log_mask(LOG_GUEST_ERROR,
                           "[%s]%s: trying to access TDAR2 or TDAR1\n",
Signature · 1 line
2.21.0
#14 lore raw

RFC PATCH v2 6/6 hw/pci-host/designware: Remove unuseful FALLTHROUGH comment

In reply to Philippe Mathieu-Daudé

We don't need to explicit this obvious switch fall through. Stay consistent with the rest of the codebase.

---
Cc: Peter Chubb <[email protected]>
Cc: Markus Armbruster <[email protected]>
Cc: Peter Maydell <[email protected]>
Cc: Andrey Smirnov <[email protected]>
Cc: [email protected]

---
 hw/pci-host/designware.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/pci-host/designware.c +1 -1
index 71e9b0d9b5..dd245516dd 100644
@@ -182,7 +182,7 @@ designware_pcie_root_config_read(PCIDevice *d, uint32_t address, int len)
         break;
 
     case DESIGNWARE_PCIE_ATU_CR1:
-    case DESIGNWARE_PCIE_ATU_CR2:          /* FALLTHROUGH */
+    case DESIGNWARE_PCIE_ATU_CR2:
         val = viewport->cr[(address - DESIGNWARE_PCIE_ATU_CR1) /
                            sizeof(uint32_t)];
         break;
Signature · 1 line
2.21.0
#4 lore raw

PATCH v2 2/6 hw/display/tcx: Add missing fall through comments

In reply to Philippe Mathieu-Daudé

When building with GCC9 using CFLAG -Wimplicit-fallthrough=2 we get:

hw/display/tcx.c: In function ‘tcx_dac_writel’:
hw/display/tcx.c:453:26: error: this statement may fall through [-Werror=implicit-fallthrough=]

    453 |             s->dac_index = (s->dac_index + 1) & 0xff; /* Index autoincrement */
        |             ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
  hw/display/tcx.c:454:9: note: here
    454 |         default:
        |         ^~~~~~~
  hw/display/tcx.c: In function ‘tcx_dac_readl’:
  hw/display/tcx.c:412:22: error: this statement may fall through [-Werror=implicit-fallthrough=]
    412 |         s->dac_index = (s->dac_index + 1) & 0xff; /* Index autoincrement */
        |         ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
  hw/display/tcx.c:413:5: note: here
    413 |     default:
        |     ^~~~~~~

cc1: all warnings being treated as errors

Give a hint to GCC by adding the missing fall through comments.

---
v2: Reword the description (Aleksandar)

Cc Aleksandar Markovic <[email protected]>
Cc Olivier Danet <[email protected]>
Cc Mark Cave-Ayland <[email protected]>
---
 hw/display/tcx.c | 2 ++
 1 file changed, 2 insertions(+)
hw/display/tcx.c +2 -0
index 14e829d3fa..abbeb30284 100644
@@ -410,6 +410,7 @@ static uint64_t tcx_dac_readl(void *opaque, hwaddr addr,
     case 2:
         val = s->b[s->dac_index] << 24;
         s->dac_index = (s->dac_index + 1) & 0xff; /* Index autoincrement */
+        /* fall through */
     default:
         s->dac_state = 0;
         break;
@@ -451,6 +452,7 @@ static void tcx_dac_writel(void *opaque, hwaddr addr, uint64_t val,
             s->b[index] = val >> 24;
             update_palette_entries(s, index, index + 1);
             s->dac_index = (s->dac_index + 1) & 0xff; /* Index autoincrement */
+            /* fall through */
         default:
             s->dac_state = 0;
             break;
Signature · 1 line
2.21.0
#1 lore raw

PATCH v2 1/6 audio/audio: Add missing fall through comment

In reply to Philippe Mathieu-Daudé

When building with GCC9 using CFLAG -Wimplicit-fallthrough=2 we get:

audio/audio.c: In function ‘audio_pcm_init_info’:
audio/audio.c:306:14: error: this statement may fall through [-Werror=implicit-fallthrough=]

    306 |         sign = 1;
        |         ~~~~~^~~
  audio/audio.c:307:5: note: here
    307 |     case AUDIO_FORMAT_U8:
        |     ^~~~

cc1: all warnings being treated as errors

Similarly to e46349414, add the missing fall through comment to hint GCC.

---
v2: Reword the description (Aleksandar)

Cc Aleksandar Markovic <[email protected]>
Cc Gerd Hoffmann <[email protected]>
Cc "Kővágó, Zoltán" <[email protected]>
---
 audio/audio.c | 1 +
 1 file changed, 1 insertion(+)
audio/audio.c +1 -0
index 56fae55047..57daf3f620 100644
@@ -304,6 +304,7 @@ void audio_pcm_init_info (struct audio_pcm_info *info, struct audsettings *as)
     switch (as->fmt) {
     case AUDIO_FORMAT_S8:
         sign = 1;
+        /* fall through */
     case AUDIO_FORMAT_U8:
         mul = 1;
         break;
Signature · 1 line
2.21.0
#7 lore raw

PATCH v2 3/6 hw/timer/aspeed_timer: Add a fall through comment

In reply to Philippe Mathieu-Daudé

Reported by GCC9 when building with CFLAG -Wimplicit-fallthrough=2:

hw/timer/aspeed_timer.c: In function ‘aspeed_timer_set_value’:
hw/timer/aspeed_timer.c:283:24: error: this statement may fall through [-Werror=implicit-fallthrough=]

    283 |         if (old_reload || !t->reload) {
        |             ~~~~~~~~~~~^~~~~~~~~~~~~
  hw/timer/aspeed_timer.c:287:5: note: here
    287 |     case TIMER_REG_STATUS:
        |     ^~~~

cc1: all warnings being treated as errors

Add the missing fall through comment.

---
Cc: "Cédric Le Goater" <[email protected]>
Cc: Peter Maydell <[email protected]>
Cc: Andrew Jeffery <[email protected]>
Cc: Joel Stanley <[email protected]>
Cc: [email protected]

---
 hw/timer/aspeed_timer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/timer/aspeed_timer.c +1 -1
index a8c38cc118..c91f18415c 100644
@@ -283,7 +283,7 @@ static void aspeed_timer_set_value(AspeedTimerCtrlState *s, int timer, int reg,
         if (old_reload || !t->reload) {
             break;
         }
-
+        /* fall through to re-enable */
     case TIMER_REG_STATUS:
         if (timer_enabled(t)) {
             uint64_t now = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL);
Signature · 1 line
2.21.0
#8 lore raw

PATCH v2 4/6 hw/net/imx_fec: Rewrite fall through comments

In reply to Philippe Mathieu-Daudé

GCC9 is confused by this comment when building with CFLAG -Wimplicit-fallthrough=2:

hw/net/imx_fec.c: In function ‘imx_eth_write’:
hw/net/imx_fec.c:906:12: error: this statement may fall through [-Werror=implicit-fallthrough=]

    906 |         if (unlikely(single_tx_ring)) {
        |            ^
  hw/net/imx_fec.c:912:5: note: here
    912 |     case ENET_TDAR:     /* FALLTHROUGH */
        |     ^~~~

cc1: all warnings being treated as errors

Rewrite the comments in the correct place, using 'fall through' which is recognized by GCC and static analyzers.

---
Cc: Peter Chubb <[email protected]>
Cc: Peter Maydell <[email protected]>
Cc: Jason Wang <[email protected]>
Cc: [email protected]

---
 hw/net/imx_fec.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
hw/net/imx_fec.c +2 -1
index bd99236864..c01ce4f078 100644
@@ -909,7 +909,8 @@ static void imx_eth_write(void *opaque, hwaddr offset, uint64_t value,
                           TYPE_IMX_FEC, __func__);
             return;
         }
-    case ENET_TDAR:     /* FALLTHROUGH */
+        /* fall through */
+    case ENET_TDAR:
         if (s->regs[ENET_ECR] & ENET_ECR_ETHEREN) {
             s->regs[index] = ENET_TDAR_TDAR;
             imx_eth_do_tx(s, index);
Signature · 1 line
2.21.0
Reviewed-by on v2 5/6
#11 lore raw

Re: [RFC PATCH v2 5/6] hw/net/imx_fec: Remove unuseful FALLTHROUGH comments

In reply to Philippe Mathieu-Daudé
Quoted 5 lines · Philippe Mathieu-Daudé

We don't need to explicit these obvious switch fall through comments. Stay consistent with the rest of the codebase.

...

Quoted 5 lines
hw/net/imx_fec.c +0 -0
index c01ce4f078..5a83678f64 100644

hw/net/imx_fec.c static void imx_eth_write(void *opaque, hwaddr offset, uint64_t value, · line 908

Quoted 10 lines
hw/net/imx_fec.c +2 -2
@@ -901,8 +901,8 @@ static void imx_eth_write(void *opaque, hwaddr offset, uint64_t value,
             s->regs[index] = 0;
         }
         break;
-    case ENET_TDAR1:    /* FALLTHROUGH */
-    case ENET_TDAR2:    /* FALLTHROUGH */
+    case ENET_TDAR1:
+    case ENET_TDAR2:
         if (unlikely(single_tx_ring)) {
             qemu_log_mask(LOG_GUEST_ERROR,
                           "[%s]%s: trying to access TDAR2 or TDAR1\n",
Reviewed-by on v2 6/6
#15 lore raw

Re: [RFC PATCH v2 6/6] hw/pci-host/designware: Remove unuseful FALLTHROUGH comment

In reply to Philippe Mathieu-Daudé
Quoted 20 lines · Philippe Mathieu-Daudé

We don't need to explicit this obvious switch fall through. Stay consistent with the rest of the codebase.

---
Cc: Peter Chubb <[email protected]>
Cc: Markus Armbruster <[email protected]>
Cc: Peter Maydell <[email protected]>
Cc: Andrey Smirnov <[email protected]>
Cc: [email protected]

---
 hw/pci-host/designware.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/pci-host/designware.c +0 -0
index 71e9b0d9b5..dd245516dd 100644

hw/pci-host/designware.c designware_pcie_root_config_read(PCIDevice *d, uint32_t address, int len) · line 188

Quoted 8 lines
hw/pci-host/designware.c +1 -1
@@ -182,7 +182,7 @@ designware_pcie_root_config_read(PCIDevice *d, uint32_t address, int len)
         break;
 
     case DESIGNWARE_PCIE_ATU_CR1:
-    case DESIGNWARE_PCIE_ATU_CR2:          /* FALLTHROUGH */
+    case DESIGNWARE_PCIE_ATU_CR2:
         val = viewport->cr[(address - DESIGNWARE_PCIE_ATU_CR1) /
                            sizeof(uint32_t)];
         break;
Reviewed-by on v2 6/6
#16 lore raw

Re: [RFC PATCH v2 6/6] hw/pci-host/designware: Remove unuseful FALLTHROUGH comment

In reply to Philippe Mathieu-Daudé
Quoted 6 lines · Philippe Mathieu-Daudé

We don't need to explicit this obvious switch fall through. Stay consistent with the rest of the codebase.

---

Quoted 26 lines
Cc Peter Chubb <[email protected]>
Cc Markus Armbruster <[email protected]>
Cc Peter Maydell <[email protected]>
Cc Andrey Smirnov <[email protected]>
---
 hw/pci-host/designware.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/pci-host/designware.c +1 -2
index 71e9b0d9b5..dd245516dd 100644
@@ -182,7 +182,7 @@ designware_pcie_root_config_read(PCIDevice *d, uint32_t address, int len)
         break;
 
     case DESIGNWARE_PCIE_ATU_CR1:
-    case DESIGNWARE_PCIE_ATU_CR2:          /* FALLTHROUGH */
+    case DESIGNWARE_PCIE_ATU_CR2:
         val = viewport->cr[(address - DESIGNWARE_PCIE_ATU_CR1) /
                            sizeof(uint32_t)];
         break;
--

2.21.0

Reviewed-by on v2 5/6
#12 lore raw

Re: [RFC PATCH v2 5/6] hw/net/imx_fec: Remove unuseful FALLTHROUGH comments

In reply to Philippe Mathieu-Daudé
Quoted 7 lines · Philippe Mathieu-Daudé

We don't need to explicit these obvious switch fall through comments. Stay consistent with the rest of the codebase.

---

Quoted 28 lines
Cc Peter Chubb <[email protected]>
Cc Markus Armbruster <[email protected]>
Cc Peter Maydell <[email protected]>
Cc Jason Wang <[email protected]>
---
 hw/net/imx_fec.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
hw/net/imx_fec.c +2 -3
index c01ce4f078..5a83678f64 100644
@@ -901,8 +901,8 @@ static void imx_eth_write(void *opaque, hwaddr offset, uint64_t value,
             s->regs[index] = 0;
         }
         break;
-    case ENET_TDAR1:    /* FALLTHROUGH */
-    case ENET_TDAR2:    /* FALLTHROUGH */
+    case ENET_TDAR1:
+    case ENET_TDAR2:
         if (unlikely(single_tx_ring)) {
             qemu_log_mask(LOG_GUEST_ERROR,
                           "[%s]%s: trying to access TDAR2 or TDAR1\n",
--

2.21.0

Reviewed-by on v2 4/6
#9 lore raw

Re: [PATCH v2 4/6] hw/net/imx_fec: Rewrite fall through comments

In reply to Philippe Mathieu-Daudé
Quoted 33 lines · Philippe Mathieu-Daudé

GCC9 is confused by this comment when building with CFLAG -Wimplicit-fallthrough=2:

hw/net/imx_fec.c: In function ‘imx_eth_write’:
hw/net/imx_fec.c:906:12: error: this statement may fall through [-Werror=implicit-fallthrough=]

    906 |         if (unlikely(single_tx_ring)) {
        |            ^
  hw/net/imx_fec.c:912:5: note: here
    912 |     case ENET_TDAR:     /* FALLTHROUGH */
        |     ^~~~

cc1: all warnings being treated as errors

Rewrite the comments in the correct place, using 'fall through' which is recognized by GCC and static analyzers.

---
Cc: Peter Chubb <[email protected]>
Cc: Peter Maydell <[email protected]>
Cc: Jason Wang <[email protected]>
Cc: [email protected]

---
 hw/net/imx_fec.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
hw/net/imx_fec.c +0 -0
index bd99236864..c01ce4f078 100644

hw/net/imx_fec.c static void imx_eth_write(void *opaque, hwaddr offset, uint64_t value, · line 916

Quoted 9 lines
hw/net/imx_fec.c +2 -1
@@ -909,7 +909,8 @@ static void imx_eth_write(void *opaque, hwaddr offset, uint64_t value,
                           TYPE_IMX_FEC, __func__);
             return;
         }
-    case ENET_TDAR:     /* FALLTHROUGH */
+        /* fall through */
+    case ENET_TDAR:
         if (s->regs[ENET_ECR] & ENET_ECR_ETHEREN) {
             s->regs[index] = ENET_TDAR_TDAR;
             imx_eth_do_tx(s, index);
Reviewed-by on v2 2/6
#5 lore raw

Re: [PATCH v2 2/6] hw/display/tcx: Add missing fall through comments

In reply to Philippe Mathieu-Daudé
Quoted 19 lines · Philippe Mathieu-Daudé

When building with GCC9 using CFLAG -Wimplicit-fallthrough=2 we get:

hw/display/tcx.c: In function ‘tcx_dac_writel’:
hw/display/tcx.c:453:26: error: this statement may fall through [-Werror=implicit-fallthrough=]

    453 |             s->dac_index = (s->dac_index + 1) & 0xff; /* Index autoincrement */
        |             ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
  hw/display/tcx.c:454:9: note: here
    454 |         default:
        |         ^~~~~~~
  hw/display/tcx.c: In function ‘tcx_dac_readl’:
  hw/display/tcx.c:412:22: error: this statement may fall through [-Werror=implicit-fallthrough=]
    412 |         s->dac_index = (s->dac_index + 1) & 0xff; /* Index autoincrement */
        |         ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
  hw/display/tcx.c:413:5: note: here
    413 |     default:
        |     ^~~~~~~

cc1: all warnings being treated as errors

Quoted 8 lines

Give a hint to GCC by adding the missing fall through comments.

---
v2: Reword the description (Aleksandar)

Quoted 30 lines
Cc Aleksandar Markovic <[email protected]>
Cc Olivier Danet <[email protected]>
Cc Mark Cave-Ayland <[email protected]>
---
 hw/display/tcx.c | 2 ++
 1 file changed, 2 insertions(+)
hw/display/tcx.c +2 -1
index 14e829d3fa..abbeb30284 100644
@@ -410,6 +410,7 @@ static uint64_t tcx_dac_readl(void *opaque, hwaddr addr,
     case 2:
         val = s->b[s->dac_index] << 24;
         s->dac_index = (s->dac_index + 1) & 0xff; /* Index autoincrement */
+        /* fall through */
     default:
         s->dac_state = 0;
         break;
@@ -451,6 +452,7 @@ static void tcx_dac_writel(void *opaque, hwaddr addr, uint64_t val,
             s->b[index] = val >> 24;
             update_palette_entries(s, index, index + 1);
             s->dac_index = (s->dac_index + 1) & 0xff; /* Index autoincrement */
+            /* fall through */
         default:
             s->dac_state = 0;
             break;
--

2.21.0

Reviewed-by on v2 1/6
#2 lore raw

Re: [PATCH v2 1/6] audio/audio: Add missing fall through comment

In reply to Philippe Mathieu-Daudé
Quoted 12 lines · Philippe Mathieu-Daudé

When building with GCC9 using CFLAG -Wimplicit-fallthrough=2 we get:

audio/audio.c: In function ‘audio_pcm_init_info’:
audio/audio.c:306:14: error: this statement may fall through [-Werror=implicit-fallthrough=]

    306 |         sign = 1;
        |         ~~~~~^~~
  audio/audio.c:307:5: note: here
    307 |     case AUDIO_FORMAT_U8:
        |     ^~~~

cc1: all warnings being treated as errors

Quoted 9 lines

Similarly to e46349414, add the missing fall through comment to hint GCC.

---
v2: Reword the description (Aleksandar)

Quoted 22 lines
Cc Aleksandar Markovic <[email protected]>
Cc Gerd Hoffmann <[email protected]>
Cc "Kővágó, Zoltán" <[email protected]>
---
 audio/audio.c | 1 +
 1 file changed, 1 insertion(+)
audio/audio.c +1 -1
index 56fae55047..57daf3f620 100644
@@ -304,6 +304,7 @@ void audio_pcm_init_info (struct audio_pcm_info *info, struct audsettings *as)
     switch (as->fmt) {
     case AUDIO_FORMAT_S8:
         sign = 1;
+        /* fall through */
     case AUDIO_FORMAT_U8:
         mul = 1;
         break;
--

2.21.0

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

Re: [RFC PATCH v2 5/6] hw/net/imx_fec: Remove unuseful FALLTHROUGH comments

In reply to Philippe Mathieu-Daudé
Quoted 11 lines · Philippe Mathieu-Daudé

We don't need to explicit these obvious switch fall through comments. Stay consistent with the rest of the codebase.

---
Cc: Peter Chubb <[email protected]>
Cc: Markus Armbruster <[email protected]>
Cc: Peter Maydell <[email protected]>
Cc: Jason Wang <[email protected]>
Cc: [email protected]

Quoted 3 lines
---
 hw/net/imx_fec.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

r~

Reviewed-by on v2 6/6
#17 lore raw

Re: [RFC PATCH v2 6/6] hw/pci-host/designware: Remove unuseful FALLTHROUGH comment

In reply to Philippe Mathieu-Daudé
Quoted 10 lines · Philippe Mathieu-Daudé

We don't need to explicit this obvious switch fall through. Stay consistent with the rest of the codebase.

---
Cc: Peter Chubb <[email protected]>
Cc: Markus Armbruster <[email protected]>
Cc: Peter Maydell <[email protected]>
Cc: Andrey Smirnov <[email protected]>
Cc: [email protected]

Quoted 3 lines
---
 hw/pci-host/designware.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

r~

#18 lore raw

Re: [RFC PATCH v2 6/6] hw/pci-host/designware: Remove unuseful FALLTHROUGH comment

In reply to Philippe Mathieu-Daudé
Quoted 6 lines · Philippe Mathieu-Daudé

We don't need to explicit this obvious switch fall through. Stay consistent with the rest of the codebase.

---

I see you covered two cases of such comment (in patches 5 and 6).

But why didn't you than cover the following cases:

block/vhdx.c:            case PAYLOAD_BLOCK_NOT_PRESENT: /* fall through */
block/vhdx.c:            case PAYLOAD_BLOCK_NOT_PRESENT: /* fall through */
hw/net/rtl8139.c:    case 1: /* fall through */
hw/net/rtl8139.c:    case 2: /* fall through */

contrib/vhost-user-scsi/vhost-user-scsi.c: case 1: /* fall through */
(this one needs full switch block reformatting, but can this be changed, since it is in "contrib"?)

?

Thanks,
Aleksandar

Quoted 26 lines
Cc Peter Chubb <[email protected]>
Cc Markus Armbruster <[email protected]>
Cc Peter Maydell <[email protected]>
Cc Andrey Smirnov <[email protected]>
---
 hw/pci-host/designware.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/pci-host/designware.c +1 -2
index 71e9b0d9b5..dd245516dd 100644
@@ -182,7 +182,7 @@ designware_pcie_root_config_read(PCIDevice *d, uint32_t address, int len)
         break;
 
     case DESIGNWARE_PCIE_ATU_CR1:
-    case DESIGNWARE_PCIE_ATU_CR2:          /* FALLTHROUGH */
+    case DESIGNWARE_PCIE_ATU_CR2:
         val = viewport->cr[(address - DESIGNWARE_PCIE_ATU_CR1) /
                            sizeof(uint32_t)];
         break;
--

2.21.0

Reviewed-by on v2 2/6
#6 lore raw

Re: [PATCH v2 2/6] hw/display/tcx: Add missing fall through comments

In reply to Philippe Mathieu-Daudé
Quoted 46 lines · Philippe Mathieu-Daudé

When building with GCC9 using CFLAG -Wimplicit-fallthrough=2 we get:

hw/display/tcx.c: In function ‘tcx_dac_writel’:
hw/display/tcx.c:453:26: error: this statement may fall through [-Werror=implicit-fallthrough=]

    453 |             s->dac_index = (s->dac_index + 1) & 0xff; /* Index autoincrement */
        |             ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
  hw/display/tcx.c:454:9: note: here
    454 |         default:
        |         ^~~~~~~
  hw/display/tcx.c: In function ‘tcx_dac_readl’:
  hw/display/tcx.c:412:22: error: this statement may fall through [-Werror=implicit-fallthrough=]
    412 |         s->dac_index = (s->dac_index + 1) & 0xff; /* Index autoincrement */
        |         ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
  hw/display/tcx.c:413:5: note: here
    413 |     default:
        |     ^~~~~~~

cc1: all warnings being treated as errors

Give a hint to GCC by adding the missing fall through comments.

---
v2: Reword the description (Aleksandar)

Cc Aleksandar Markovic <[email protected]>
Cc Olivier Danet <[email protected]>
Cc Mark Cave-Ayland <[email protected]>
---
 hw/display/tcx.c | 2 ++
 1 file changed, 2 insertions(+)
hw/display/tcx.c +1 -0
index 14e829d3fa..abbeb30284 100644
@@ -410,6 +410,7 @@ static uint64_t tcx_dac_readl(void *opaque, hwaddr addr,
     case 2:
         val = s->b[s->dac_index] << 24;
         s->dac_index = (s->dac_index + 1) & 0xff; /* Index autoincrement */
+        /* fall through */
     default:
         s->dac_state = 0;
         break;

hw/display/tcx.c static void tcx_dac_writel(void *opaque, hwaddr addr, uint64_t val, · line 458

Quoted 7 lines
hw/display/tcx.c +1 -0
@@ -451,6 +452,7 @@ static void tcx_dac_writel(void *opaque, hwaddr addr, uint64_t val,
             s->b[index] = val >> 24;
             update_palette_entries(s, index, index + 1);
             s->dac_index = (s->dac_index + 1) & 0xff; /* Index autoincrement */
+            /* fall through */
         default:
             s->dac_state = 0;
             break;

ATB,

Mark.

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

Re: [PATCH v2 1/6] audio/audio: Add missing fall through comment

In reply to Philippe Mathieu-Daudé

audio/audio.c void audio_pcm_init_info (struct audio_pcm_info *info, struct audsettings *as) · line 308

Quoted 10 lines
audio/audio.c +1 -0
index 56fae55047..57daf3f620 100644
@@ -304,6 +304,7 @@ void audio_pcm_init_info (struct audio_pcm_info *info, struct audsettings *as)
     switch (as->fmt) {
     case AUDIO_FORMAT_S8:
         sign = 1;
+        /* fall through */
     case AUDIO_FORMAT_U8:
#19 lore raw
In reply to Philippe Mathieu-Daudé

Cc'ing qemu-trivial as this series is fully reviewed.

Quoted 37 lines · Philippe Mathieu-Daudé

Fix some trivial warnings when building with -O3.

v2:
- addressed Thomas and Aleksandar comments
- dropped 'hw/scsi/megasas: Silent GCC9 duplicated-cond warning'
- dropped 'qemu-io-cmds: Silent GCC9 format-overflow warning'

Philippe Mathieu-Daudé (6):
audio/audio: Add missing fall through comment hw/display/tcx: Add missing fall through comments hw/timer/aspeed_timer: Add a fall through comment hw/net/imx_fec: Rewrite fall through comments hw/net/imx_fec: Remove unuseful FALLTHROUGH comments hw/pci-host/designware: Remove unuseful FALLTHROUGH comment

  audio/audio.c            | 1 +
  hw/display/tcx.c         | 2 ++
  hw/net/imx_fec.c         | 7 ++++---
  hw/pci-host/designware.c | 2 +-
  hw/timer/aspeed_timer.c  | 2 +-
  5 files changed, 9 insertions(+), 5 deletions(-)
Cc Aleksandar Markovic <[email protected]>
Cc Andrew Jeffery <[email protected]>
Cc Andrey Smirnov <[email protected]>
Cc "Cédric Le Goater" <[email protected]>
Cc Gerd Hoffmann <[email protected]>
Cc Jason Wang <[email protected]>
Cc Joel Stanley <[email protected]>
Cc "Kővágó, Zoltán" <[email protected]>
Cc Mark Cave-Ayland <[email protected]>
Cc Markus Armbruster <[email protected]>
Cc Olivier Danet <[email protected]>
Cc Peter Chubb <[email protected]>
Cc Peter Maydell <[email protected]>