qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] block/qcow2-cluster: Add missing "fallthrough" annotation
@ 2020-09-08  7:00 Thomas Huth
  2020-09-08  8:43 ` Philippe Mathieu-Daudé
  2020-09-08 14:42 ` Kevin Wolf
  0 siblings, 2 replies; 4+ messages in thread
From: Thomas Huth @ 2020-09-08  7:00 UTC (permalink / raw)
  To: qemu-devel, Kevin Wolf, Max Reitz; +Cc: qemu-block

When compiling with -Werror=implicit-fallthrough, the compiler currently
complains:

../../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:
-- 
2.18.2



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

* Re: [PATCH] block/qcow2-cluster: Add missing "fallthrough" annotation
  2020-09-08  7:00 [PATCH] block/qcow2-cluster: Add missing "fallthrough" annotation Thomas Huth
@ 2020-09-08  8:43 ` Philippe Mathieu-Daudé
  2020-09-08  9:31   ` Thomas Huth
  2020-09-08 14:42 ` Kevin Wolf
  1 sibling, 1 reply; 4+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-09-08  8:43 UTC (permalink / raw)
  To: Thomas Huth, qemu-devel, Kevin Wolf, Max Reitz; +Cc: Paolo Bonzini, qemu-block

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



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

* Re: [PATCH] block/qcow2-cluster: Add missing "fallthrough" annotation
  2020-09-08  8:43 ` Philippe Mathieu-Daudé
@ 2020-09-08  9:31   ` Thomas Huth
  0 siblings, 0 replies; 4+ messages in thread
From: Thomas Huth @ 2020-09-08  9:31 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel, Kevin Wolf, Max Reitz
  Cc: Paolo Bonzini, qemu-block

On 08/09/2020 10.43, Philippe Mathieu-Daudé wrote:
> 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?

Quite a bit, I think. I'm fixing it step by step...

 Thomas



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

* Re: [PATCH] block/qcow2-cluster: Add missing "fallthrough" annotation
  2020-09-08  7:00 [PATCH] block/qcow2-cluster: Add missing "fallthrough" annotation Thomas Huth
  2020-09-08  8:43 ` Philippe Mathieu-Daudé
@ 2020-09-08 14:42 ` Kevin Wolf
  1 sibling, 0 replies; 4+ messages in thread
From: Kevin Wolf @ 2020-09-08 14:42 UTC (permalink / raw)
  To: Thomas Huth; +Cc: qemu-devel, qemu-block, Max Reitz

Am 08.09.2020 um 09:00 hat Thomas Huth geschrieben:
> When compiling with -Werror=implicit-fallthrough, the compiler currently
> complains:
> 
> ../../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>

Thanks, applied to the block branch.

Kevin



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

end of thread, other threads:[~2020-09-08 14:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-08  7:00 [PATCH] block/qcow2-cluster: Add missing "fallthrough" annotation Thomas Huth
2020-09-08  8:43 ` Philippe Mathieu-Daudé
2020-09-08  9:31   ` Thomas Huth
2020-09-08 14:42 ` Kevin Wolf

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