[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-ppc] [PATCH-for-4.1 3/7] hw/block/pflash_cfi02: Rewrite a fall
From: |
Peter Maydell |
Subject: |
Re: [Qemu-ppc] [PATCH-for-4.1 3/7] hw/block/pflash_cfi02: Rewrite a fall through comment |
Date: |
Fri, 19 Jul 2019 14:27:49 +0100 |
On Fri, 19 Jul 2019 at 14:14, Philippe Mathieu-Daudé <address@hidden> wrote:
>
> GCC9 is confused by this comment when building with CFLAG
> -Wimplicit-fallthrough=2:
>
> hw/block/pflash_cfi02.c: In function ‘pflash_write’:
> hw/block/pflash_cfi02.c:574:16: error: this statement may fall through
> [-Werror=implicit-fallthrough=]
> 574 | if (boff == 0x55 && cmd == 0x98) {
> | ^
> hw/block/pflash_cfi02.c:581:9: note: here
> 581 | default:
> | ^~~~~~~
> cc1: all warnings being treated as errors
>
> Rewrite the comment using 'fall through' which is recognized by
> GCC and static analyzers.
>
> Reported-by: Stefan Weil <address@hidden>
> Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
> ---
> hw/block/pflash_cfi02.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/hw/block/pflash_cfi02.c b/hw/block/pflash_cfi02.c
> index f68837a449..42886f6af5 100644
> --- a/hw/block/pflash_cfi02.c
> +++ b/hw/block/pflash_cfi02.c
> @@ -577,7 +577,7 @@ static void pflash_write(void *opaque, hwaddr offset,
> uint64_t value,
> pfl->cmd = 0x98;
> return;
> }
> - /* No break here */
> + /* fall through */
> default:
> DPRINTF("%s: invalid write for command %02x\n",
> __func__, pfl->cmd);
> --
Reviewed-by: Peter Maydell <address@hidden>
thanks
-- PMM
- [Qemu-ppc] [PATCH-for-4.1? 0/7] Trivial switch 'fall through' comment fixes for GCC9, Philippe Mathieu-Daudé, 2019/07/19
- [Qemu-ppc] [PATCH-for-4.1? 4/7] hw/ipmi: Rewrite a fall through comment, Philippe Mathieu-Daudé, 2019/07/19
- [Qemu-ppc] [PATCH-for-4.1? 5/7] target/ppc: Rewrite a fall through comment, Philippe Mathieu-Daudé, 2019/07/19
- [Qemu-ppc] [PATCH-for-4.1? 6/7] vl: Rewrite a fall through comment, Philippe Mathieu-Daudé, 2019/07/19
- [Qemu-ppc] [PATCH-for-4.1? 7/7] spapr_events: Rewrite a fall through comment, Philippe Mathieu-Daudé, 2019/07/19