qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: Thomas Huth <thuth@redhat.com>,
	qemu-devel@nongnu.org, Kevin Wolf <kwolf@redhat.com>,
	Max Reitz <mreitz@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>, qemu-block@nongnu.org
Subject: Re: [PATCH] block/qcow2-cluster: Add missing "fallthrough" annotation
Date: Tue, 8 Sep 2020 10:43:31 +0200	[thread overview]
Message-ID: <1ebff105-2031-7af3-5705-322c73b97f5e@redhat.com> (raw)
In-Reply-To: <20200908070028.193298-1-thuth@redhat.com>

Hi Thomas,

On 9/8/20 9:00 AM, Thomas Huth wrote:
> When compiling with -Werror=implicit-fallthrough, the compiler currently
> complains:

Do you know what is missing to add this in configure::warn_flags?

> 
> ../../devel/qemu/block/qcow2-cluster.c: In function ‘cluster_needs_new_alloc’:
> ../../devel/qemu/block/qcow2-cluster.c:1320:12: error: this statement may fall
>  through [-Werror=implicit-fallthrough=]
>          if (l2_entry & QCOW_OFLAG_COPIED) {
>             ^
> ../../devel/qemu/block/qcow2-cluster.c:1323:5: note: here
>      case QCOW2_CLUSTER_UNALLOCATED:
>      ^~~~
> 
> It's quite obvious that the fallthrough is intended here, so let's add
> a comment to silence the compiler warning.
> 
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
>  block/qcow2-cluster.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/block/qcow2-cluster.c b/block/qcow2-cluster.c
> index 996b3314f4..fcdf7af8e6 100644
> --- a/block/qcow2-cluster.c
> +++ b/block/qcow2-cluster.c
> @@ -1320,6 +1320,7 @@ static bool cluster_needs_new_alloc(BlockDriverState *bs, uint64_t l2_entry)
>          if (l2_entry & QCOW_OFLAG_COPIED) {
>              return false;
>          }
> +        /* fallthrough */
>      case QCOW2_CLUSTER_UNALLOCATED:
>      case QCOW2_CLUSTER_COMPRESSED:
>      case QCOW2_CLUSTER_ZERO_PLAIN:
> 



  reply	other threads:[~2020-09-08  8:44 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-08  7:00 [PATCH] block/qcow2-cluster: Add missing "fallthrough" annotation Thomas Huth
2020-09-08  8:43 ` Philippe Mathieu-Daudé [this message]
2020-09-08  9:31   ` Thomas Huth
2020-09-08 14:42 ` Kevin Wolf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1ebff105-2031-7af3-5705-322c73b97f5e@redhat.com \
    --to=philmd@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=thuth@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).