Re: [RFC PATCH v3 08/78] hw/block: add fallthrough pseudo-keyword

2023-10-16 Thread Stefan Hajnoczi
On Fri, Oct 13, 2023 at 11:45:36AM +0300, Emmanouil Pitsidianakis wrote:
> In preparation of raising -Wimplicit-fallthrough to 5, replace all
> fall-through comments with the fallthrough attribute pseudo-keyword.
> 
> Signed-off-by: Emmanouil Pitsidianakis 
> ---
>  hw/block/dataplane/xen-block.c | 4 ++--
>  hw/block/m25p80.c  | 2 +-
>  hw/block/onenand.c | 2 +-
>  hw/block/pflash_cfi01.c| 1 +
>  hw/block/pflash_cfi02.c| 6 --
>  5 files changed, 9 insertions(+), 6 deletions(-)

Reviewed-by: Stefan Hajnoczi 


signature.asc
Description: PGP signature


[RFC PATCH v3 08/78] hw/block: add fallthrough pseudo-keyword

2023-10-13 Thread Emmanouil Pitsidianakis
In preparation of raising -Wimplicit-fallthrough to 5, replace all
fall-through comments with the fallthrough attribute pseudo-keyword.

Signed-off-by: Emmanouil Pitsidianakis 
---
 hw/block/dataplane/xen-block.c | 4 ++--
 hw/block/m25p80.c  | 2 +-
 hw/block/onenand.c | 2 +-
 hw/block/pflash_cfi01.c| 1 +
 hw/block/pflash_cfi02.c| 6 --
 5 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/hw/block/dataplane/xen-block.c b/hw/block/dataplane/xen-block.c
index 3b6f2b0aa2..1ae25a73b2 100644
--- a/hw/block/dataplane/xen-block.c
+++ b/hw/block/dataplane/xen-block.c
@@ -159,7 +159,7 @@ static int xen_block_parse_request(XenBlockRequest *request)
 if (!request->req.nr_segments) {
 return 0;
 }
-/* fall through */
+fallthrough;
 case BLKIF_OP_WRITE:
 break;
 case BLKIF_OP_DISCARD:
@@ -299,7 +299,7 @@ static void xen_block_complete_aio(void *opaque, int ret)
 if (!request->req.nr_segments) {
 break;
 }
-/* fall through */
+fallthrough;
 case BLKIF_OP_READ:
 if (request->status == BLKIF_RSP_OKAY) {
 block_acct_done(blk_get_stats(dataplane->blk), >acct);
diff --git a/hw/block/m25p80.c b/hw/block/m25p80.c
index afc3fdf4d6..523c34da71 100644
--- a/hw/block/m25p80.c
+++ b/hw/block/m25p80.c
@@ -1462,7 +1462,7 @@ static void decode_new_cmd(Flash *s, uint32_t value)
 s->state = STATE_COLLECTING_DATA;
 break;
 }
-/* Fallthrough */
+fallthrough;
 
 default:
 s->pos = 0;
diff --git a/hw/block/onenand.c b/hw/block/onenand.c
index 50d3d1c985..87583c48a0 100644
--- a/hw/block/onenand.c
+++ b/hw/block/onenand.c
@@ -564,7 +564,7 @@ static void onenand_command(OneNANDState *s)
 break;
 case 0x95:  /* Multi-block erase */
 qemu_irq_pulse(s->intr);
-/* Fall through.  */
+fallthrough;
 case 0x94:  /* Block erase */
 sec = ((s->addr[ONEN_BUF_BLOCK] & 0xfff) |
 (s->addr[ONEN_BUF_BLOCK] >> 15 ? s->density_mask : 0))
diff --git a/hw/block/pflash_cfi01.c b/hw/block/pflash_cfi01.c
index 62056b1d74..cb58f08f53 100644
--- a/hw/block/pflash_cfi01.c
+++ b/hw/block/pflash_cfi01.c
@@ -276,6 +276,7 @@ static uint32_t pflash_read(PFlashCFI01 *pfl, hwaddr offset,
  */
 pfl->cmd = 0x00;
 /* fall through to read code */
+fallthrough;
 case 0x00: /* This model reset value for READ_ARRAY (not CFI compliant) */
 /* Flash area read */
 ret = pflash_data_read(pfl, offset, width, be);
diff --git a/hw/block/pflash_cfi02.c b/hw/block/pflash_cfi02.c
index 2a99b286b0..711f978d7c 100644
--- a/hw/block/pflash_cfi02.c
+++ b/hw/block/pflash_cfi02.c
@@ -328,6 +328,7 @@ static uint64_t pflash_read(void *opaque, hwaddr offset, 
unsigned int width)
 trace_pflash_read_unknown_state(pfl->name, pfl->cmd);
 pflash_reset_state_machine(pfl);
 /* fall through to the read code */
+fallthrough;
 case 0x80: /* Erase (unlock) */
 /* We accept reads during second unlock sequence... */
 case 0x00:
@@ -359,6 +360,7 @@ static uint64_t pflash_read(void *opaque, hwaddr offset, 
unsigned int width)
 break;
 }
 /* Fall through to data read. */
+fallthrough;
 default:
 ret = pflash_data_read(pfl, offset, width);
 }
@@ -368,7 +370,7 @@ static uint64_t pflash_read(void *opaque, hwaddr offset, 
unsigned int width)
 case 0x30: /* Sector Erase */
 /* Toggle bit 2 during erase, but not program. */
 toggle_dq2(pfl);
-/* fall through */
+fallthrough;
 case 0xA0: /* Program */
 /* Toggle bit 6 */
 toggle_dq6(pfl);
@@ -582,7 +584,7 @@ static void pflash_write(void *opaque, hwaddr offset, 
uint64_t value,
 pfl->cmd = 0x98;
 return;
 }
-/* fall through */
+fallthrough;
 default:
 trace_pflash_write_invalid(pfl->name, pfl->cmd);
 goto reset_flash;
-- 
2.39.2