Skip to contentSkip to conversation

PCI: Mark expected switch fall-throughs

PATCH Applied Gustavo A. R. Silva 4 participants 15 messages Mar 20, 2019 – Mar 25, 2019

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 PCI: Mark expected switch fall-throughs

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.

---
 drivers/pci/proc.c         | 1 +
 drivers/pci/xen-pcifront.c | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)
drivers/pci/proc.c +1 -0
index 6fa1627ce08d..445b51db75b0 100644
@@ -222,6 +222,7 @@ static long proc_bus_pci_ioctl(struct file *file, unsigned int cmd,
 		}
 		/* If arch decided it can't, fall through... */
 #endif /* HAVE_PCI_MMAP */
+		/* fall through */
 	default:
 		ret = -EINVAL;
 		break;
drivers/pci/xen-pcifront.c +1 -1
index eba6e33147a2..14cf0f41ecf0 100644
@@ -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. */
 	case XenbusStateClosing:
 		dev_warn(&xdev->dev, "backend going away!\n");
 		pcifront_try_disconnect(pdev);
Signature · 1 line
2.21.0
#1 lore raw
Quoted 2 lines · Gustavo A. R. Silva

In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through.

Does this fix all the remaining cases in drivers/pci? I'd like to fix them all at once.

What's the best way to watch for new warnings being added? I fiddled with "make W=2" etc but it didn't seem useful. Does the 0-day robot warn when -Wimplicit-fallthrough warnings are added?

Bjorn

Quoted 61 lines

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.

---
 drivers/pci/proc.c         | 1 +
 drivers/pci/xen-pcifront.c | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)
drivers/pci/proc.c +1 -0
index 6fa1627ce08d..445b51db75b0 100644
@@ -222,6 +222,7 @@ static long proc_bus_pci_ioctl(struct file *file, unsigned int cmd,
 		}
 		/* If arch decided it can't, fall through... */
 #endif /* HAVE_PCI_MMAP */
+		/* fall through */
 	default:
 		ret = -EINVAL;
 		break;
drivers/pci/xen-pcifront.c +1 -1
index eba6e33147a2..14cf0f41ecf0 100644
@@ -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. */
 	case XenbusStateClosing:
 		dev_warn(&xdev->dev, "backend going away!\n");
 		pcifront_try_disconnect(pdev);
Signature · 1 line
2.21.0

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#2 lore raw
In reply to Gustavo A. R. Silva
Quoted 2 lines · Gustavo A. R. Silva

In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through.

Does this fix all the remaining cases in drivers/pci? I'd like to fix them all at once.

What's the best way to watch for new warnings being added? I fiddled with "make W=2" etc but it didn't seem useful. Does the 0-day robot warn when -Wimplicit-fallthrough warnings are added?

Bjorn

Quoted 61 lines

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.

---
 drivers/pci/proc.c         | 1 +
 drivers/pci/xen-pcifront.c | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)
drivers/pci/proc.c +1 -0
index 6fa1627ce08d..445b51db75b0 100644
@@ -222,6 +222,7 @@ static long proc_bus_pci_ioctl(struct file *file, unsigned int cmd,
 		}
 		/* If arch decided it can't, fall through... */
 #endif /* HAVE_PCI_MMAP */
+		/* fall through */
 	default:
 		ret = -EINVAL;
 		break;
drivers/pci/xen-pcifront.c +1 -1
index eba6e33147a2..14cf0f41ecf0 100644
@@ -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. */
 	case XenbusStateClosing:
 		dev_warn(&xdev->dev, "backend going away!\n");
 		pcifront_try_disconnect(pdev);
Signature · 1 line
2.21.0
#5 lore raw
In reply to Gustavo A. R. Silva

drivers/pci/proc.c static long proc_bus_pci_ioctl(struct file *file, unsigned int cmd, · line 225

Quoted 9 lines · Gustavo A. R. Silva
drivers/pci/proc.c +1 -0
index 6fa1627ce08d..445b51db75b0 100644
@@ -222,6 +222,7 @@ static long proc_bus_pci_ioctl(struct file *file, unsigned int cmd,
 		}
 		/* If arch decided it can't, fall through... */
 #endif /* HAVE_PCI_MMAP */
+		/* fall through */

Surely it would be better to transpose the #endif and its previous line, than to add a second fallthrough ?

~Andrew

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#6 lore raw
In reply to Gustavo A. R. Silva

drivers/pci/proc.c static long proc_bus_pci_ioctl(struct file *file, unsigned int cmd, · line 225

Quoted 9 lines · Gustavo A. R. Silva
drivers/pci/proc.c +1 -0
index 6fa1627ce08d..445b51db75b0 100644
@@ -222,6 +222,7 @@ static long proc_bus_pci_ioctl(struct file *file, unsigned int cmd,
 		}
 		/* If arch decided it can't, fall through... */
 #endif /* HAVE_PCI_MMAP */
+		/* fall through */

Surely it would be better to transpose the #endif and its previous line, than to add a second fallthrough ?

~Andrew

#3 lore raw
In reply to Bjorn Helgaas
Quoted 7 lines · Bjorn Helgaas
Quoted 2 lines · Gustavo A. R. Silva

In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through.

Does this fix all the remaining cases in drivers/pci? I'd like to fix them all at once.

These are actually the last ones.

Quoted 4 lines

What's the best way to watch for new warnings being added? I fiddled with "make W=2" etc but it didn't seem useful. Does the 0-day robot warn when -Wimplicit-fallthrough warnings are added?

0-day robot doesn't know about these warnings yet. But it certainly will once we finally enable -Wimplicit-fallthrough.

Add this to your Makefile to see the warnings:

KBUILD_CFLAGS += $(call cc-option,-Wimplicit-fallthrough=3,)

Thanks
--
Gustavo

Quoted 55 lines

Bjorn

Quoted 53 lines

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.

---
 drivers/pci/proc.c         | 1 +
 drivers/pci/xen-pcifront.c | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)
drivers/pci/proc.c +1 -0
index 6fa1627ce08d..445b51db75b0 100644
@@ -222,6 +222,7 @@ static long proc_bus_pci_ioctl(struct file *file, unsigned int cmd,
 		}
 		/* If arch decided it can't, fall through... */
 #endif /* HAVE_PCI_MMAP */
+		/* fall through */
 	default:
 		ret = -EINVAL;
 		break;
drivers/pci/xen-pcifront.c +0 -0
index eba6e33147a2..14cf0f41ecf0 100644
@@ -1104,7 +1104,7 @@ static void __ref pcifront_backend_changed(struct xenbus_device *xdev,
 	case XenbusStateClosed:
 		if (xdev->state == XenbusStateClosed)
 			break;
Quoted 8 lines
Quoted 8 lines
drivers/pci/xen-pcifront.c +1 -1
-		/* Missed the backend's CLOSING state -- fallthrough */
+		/* fall through - Missed the backend's CLOSING state. */
 	case XenbusStateClosing:
 		dev_warn(&xdev->dev, "backend going away!\n");
 		pcifront_try_disconnect(pdev);
Signature · 1 line
2.21.0

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#4 lore raw
In reply to Bjorn Helgaas
Quoted 7 lines · Bjorn Helgaas
Quoted 2 lines · Gustavo A. R. Silva

In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through.

Does this fix all the remaining cases in drivers/pci? I'd like to fix them all at once.

These are actually the last ones.

Quoted 4 lines

What's the best way to watch for new warnings being added? I fiddled with "make W=2" etc but it didn't seem useful. Does the 0-day robot warn when -Wimplicit-fallthrough warnings are added?

0-day robot doesn't know about these warnings yet. But it certainly will once we finally enable -Wimplicit-fallthrough.

Add this to your Makefile to see the warnings:

KBUILD_CFLAGS += $(call cc-option,-Wimplicit-fallthrough=3,)

Thanks
--
Gustavo

Quoted 63 lines

Bjorn

Quoted 61 lines

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.

---
 drivers/pci/proc.c         | 1 +
 drivers/pci/xen-pcifront.c | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)
drivers/pci/proc.c +1 -0
index 6fa1627ce08d..445b51db75b0 100644
@@ -222,6 +222,7 @@ static long proc_bus_pci_ioctl(struct file *file, unsigned int cmd,
 		}
 		/* If arch decided it can't, fall through... */
 #endif /* HAVE_PCI_MMAP */
+		/* fall through */
 	default:
 		ret = -EINVAL;
 		break;
drivers/pci/xen-pcifront.c +1 -1
index eba6e33147a2..14cf0f41ecf0 100644
@@ -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. */
 	case XenbusStateClosing:
 		dev_warn(&xdev->dev, "backend going away!\n");
 		pcifront_try_disconnect(pdev);
Signature · 1 line
2.21.0
#7 lore raw
In reply to Andrew Cooper
Quoted 14 lines · Andrew Cooper

drivers/pci/proc.c static long proc_bus_pci_ioctl(struct file *file, unsigned int cmd, · line 225

Quoted 9 lines · Gustavo A. R. Silva
drivers/pci/proc.c +1 -0
index 6fa1627ce08d..445b51db75b0 100644
@@ -222,6 +222,7 @@ static long proc_bus_pci_ioctl(struct file *file, unsigned int cmd,
 		}
 		/* If arch decided it can't, fall through... */
 #endif /* HAVE_PCI_MMAP */
+		/* fall through */

Surely it would be better to transpose the #endif and its previous line, than to add a second fallthrough ?

I agree. The thing is that, currently, GCC is expecting to find the fall-through "annotations" at the very bottom of the case statement, as I mentioned it in the changelog text.

That's the reason why I decided to left in place the original comment.

Thanks
--
Gustavo

#8 lore raw
In reply to Andrew Cooper
Quoted 14 lines · Andrew Cooper

drivers/pci/proc.c static long proc_bus_pci_ioctl(struct file *file, unsigned int cmd, · line 225

Quoted 9 lines · Gustavo A. R. Silva
drivers/pci/proc.c +1 -0
index 6fa1627ce08d..445b51db75b0 100644
@@ -222,6 +222,7 @@ static long proc_bus_pci_ioctl(struct file *file, unsigned int cmd,
 		}
 		/* If arch decided it can't, fall through... */
 #endif /* HAVE_PCI_MMAP */
+		/* fall through */

Surely it would be better to transpose the #endif and its previous line, than to add a second fallthrough ?

I agree. The thing is that, currently, GCC is expecting to find the fall-through "annotations" at the very bottom of the case statement, as I mentioned it in the changelog text.

That's the reason why I decided to left in place the original comment.

Thanks
--
Gustavo

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#9 lore raw
In reply to Gustavo A. R. Silva
Quoted 25 lines · Gustavo A. R. Silva

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.

Quoted 6 lines

Warning level 3 was used: -Wimplicit-fallthrough=3

This patch is part of the ongoing efforts to enable -Wimplicit-fallthrough.

Applied to pci/misc for v5.2, thanks!

Quoted 33 lines
---
 drivers/pci/proc.c         | 1 +
 drivers/pci/xen-pcifront.c | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)
drivers/pci/proc.c +1 -0
index 6fa1627ce08d..445b51db75b0 100644
@@ -222,6 +222,7 @@ static long proc_bus_pci_ioctl(struct file *file, unsigned int cmd,
 		}
 		/* If arch decided it can't, fall through... */
 #endif /* HAVE_PCI_MMAP */
+		/* fall through */
 	default:
 		ret = -EINVAL;
 		break;
drivers/pci/xen-pcifront.c +1 -1
index eba6e33147a2..14cf0f41ecf0 100644
@@ -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. */
 	case XenbusStateClosing:
 		dev_warn(&xdev->dev, "backend going away!\n");
 		pcifront_try_disconnect(pdev);
Signature · 1 line
2.21.0
#12 lore raw
In reply to Gustavo A. R. Silva
Quoted 25 lines · Gustavo A. R. Silva

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.

Quoted 6 lines

Warning level 3 was used: -Wimplicit-fallthrough=3

This patch is part of the ongoing efforts to enable -Wimplicit-fallthrough.

Applied to pci/misc for v5.2, thanks!

Quoted 33 lines
---
 drivers/pci/proc.c         | 1 +
 drivers/pci/xen-pcifront.c | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)
drivers/pci/proc.c +1 -0
index 6fa1627ce08d..445b51db75b0 100644
@@ -222,6 +222,7 @@ static long proc_bus_pci_ioctl(struct file *file, unsigned int cmd,
 		}
 		/* If arch decided it can't, fall through... */
 #endif /* HAVE_PCI_MMAP */
+		/* fall through */
 	default:
 		ret = -EINVAL;
 		break;
drivers/pci/xen-pcifront.c +1 -1
index eba6e33147a2..14cf0f41ecf0 100644
@@ -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. */
 	case XenbusStateClosing:
 		dev_warn(&xdev->dev, "backend going away!\n");
 		pcifront_try_disconnect(pdev);
Signature · 1 line
2.21.0

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#10 lore raw
In reply to Bjorn Helgaas
Quoted 1 line · Bjorn Helgaas

On Wed, Mar 20, 2019 at 01:27:15PM -0500, Gustavo A. R. Silva wrote:

[..]

Quoted 10 lines
Quoted 7 lines

Warning level 3 was used: -Wimplicit-fallthrough=3

This patch is part of the ongoing efforts to enable -Wimplicit-fallthrough.

Applied to pci/misc for v5.2, thanks!

Awesome!

Thanks
--
Gustavo

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#13 lore raw
In reply to Gustavo A. R. Silva
Quoted 24 lines
Quoted 1 line
Quoted 1 line · On 20.03.19 at 19:27, <[email protected]> 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:
^~~~

Quoted 8 lines

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

drivers/pci/xen-pcifront.c static void __ref pcifront_backend_changed(struct xenbus_device *xdev, · line 1107

Quoted 8 lines
drivers/pci/xen-pcifront.c +1 -1
@@ -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

#14 lore raw
In reply to Gustavo A. R. Silva
Quoted 24 lines
Quoted 1 line
Quoted 1 line · On 20.03.19 at 19:27, <[email protected]> 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:
^~~~

Quoted 8 lines

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

drivers/pci/xen-pcifront.c static void __ref pcifront_backend_changed(struct xenbus_device *xdev, · line 1107

Quoted 8 lines
drivers/pci/xen-pcifront.c +1 -1
@@ -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

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel