Re: [Xen-devel] [PATCH] PCI: Mark expected switch fall-throughs

From: Jan Beulich
Date: Mon Mar 25 2019 - 09:25:18 EST


>>> On 20.03.19 at 19:27, <gustavo@xxxxxxxxxxxxxx> wrote:
> In preparation to enabling -Wimplicit-fallthrough, mark switch
> cases where we are expecting to fall through.
>
> This patch fixes the following warnings:
>
> drivers/pci/proc.c: In function âproc_bus_pci_ioctlâ:
> drivers/pci/proc.c:216:6: warning: this statement may fall through
> [-Wimplicit-fallthrough=]
> if (arch_can_pci_mmap_wc()) {
> ^
> drivers/pci/proc.c:225:2: note: here
> default:
> ^~~~~~~
>
> drivers/pci/xen-pcifront.c: In function âpcifront_backend_changedâ:
> drivers/pci/xen-pcifront.c:1105:6: warning: this statement may fall through
> [-Wimplicit-fallthrough=]
> if (xdev->state == XenbusStateClosed)
> ^
> drivers/pci/xen-pcifront.c:1108:2: note: here
> case XenbusStateClosing:
> ^~~~
>
> Notice that, in this particular case, the /* fall through */
> comment is placed at the very bottom of the case statement,
> which is what GCC is expecting to find.
>
> Warning level 3 was used: -Wimplicit-fallthrough=3
>
> This patch is part of the ongoing efforts to enable
> -Wimplicit-fallthrough.

None of the above explains why ...

> --- a/drivers/pci/xen-pcifront.c
> +++ b/drivers/pci/xen-pcifront.c
> @@ -1104,7 +1104,7 @@ static void __ref pcifront_backend_changed(struct xenbus_device *xdev,
> case XenbusStateClosed:
> if (xdev->state == XenbusStateClosed)
> break;
> - /* Missed the backend's CLOSING state -- fallthrough */
> + /* fall through - Missed the backend's CLOSING state. */

... the original comment here wasn't good enough.

Jan