Skip to contentSkip to conversation

virt: vbox: Mark expected switch fall-through

PATCH In review Gustavo A. R. Silva 2 participants 3 messages Feb 26, 2019 – Feb 27, 2019 Virtual box guest device driver

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 virt: vbox: Mark expected switch fall-through

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

This patch fixes the following warning:

drivers/virt/vboxguest/vboxguest_core.c: In function ‘vbg_core_ioctl’:
drivers/virt/vboxguest/vboxguest_core.c:1486:10: warning: this statement may fall through [-Wimplicit-fallthrough=]
f32bit = true;
~~~~~~~^~~~~~
drivers/virt/vboxguest/vboxguest_core.c:1489:2: note: here
case VBG_IOCTL_HGCM_CALL(0):
^~~~

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

Notice that, in this particular case, the code comment is modified in accordance with what GCC is expecting to find.

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

---
 drivers/virt/vboxguest/vboxguest_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/virt/vboxguest/vboxguest_core.c +1 -1
index 1475ed5ffcde..df7d09409efe 100644
@@ -1484,8 +1484,8 @@ int vbg_core_ioctl(struct vbg_session *session, unsigned int req, void *data)
 #ifdef CONFIG_COMPAT
 	case VBG_IOCTL_HGCM_CALL_32(0):
 		f32bit = true;
-		/* Fall through */
 #endif
+		/* Fall through */
 	case VBG_IOCTL_HGCM_CALL(0):
 		return vbg_ioctl_hgcm_call(gdev, session, f32bit, data);
 	case VBG_IOCTL_LOG(0):
Signature · 1 line
2.21.0
Reviewed-by on v1 1/1
#1 lore raw

Hi,

Quoted 15 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 warning:

drivers/virt/vboxguest/vboxguest_core.c: In function ‘vbg_core_ioctl’:
drivers/virt/vboxguest/vboxguest_core.c:1486:10: warning: this statement may fall through [-Wimplicit-fallthrough=]

    f32bit = true;
    ~~~~~~~^~~~~~
drivers/virt/vboxguest/vboxguest_core.c:1489:2: note: here
   case VBG_IOCTL_HGCM_CALL(0):
   ^~~~

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

Quoted 7 lines

Notice that, in this particular case, the code comment is modified in accordance with what GCC is expecting to find.

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

Thank you the patch, patch looks good to me:

Regards,

Hans

Quoted 19 lines
---
  drivers/virt/vboxguest/vboxguest_core.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/virt/vboxguest/vboxguest_core.c +1 -1
index 1475ed5ffcde..df7d09409efe 100644
@@ -1484,8 +1484,8 @@ int vbg_core_ioctl(struct vbg_session *session, unsigned int req, void *data)
  #ifdef CONFIG_COMPAT
  	case VBG_IOCTL_HGCM_CALL_32(0):
  		f32bit = true;
-		/* Fall through */
  #endif
+		/* Fall through */
  	case VBG_IOCTL_HGCM_CALL(0):
  		return vbg_ioctl_hgcm_call(gdev, session, f32bit, data);
  	case VBG_IOCTL_LOG(0):
#2 lore raw
Quoted 21 lines · Hans de Goede

Hi,

Quoted 18 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 warning:

drivers/virt/vboxguest/vboxguest_core.c: In function ‘vbg_core_ioctl’:
drivers/virt/vboxguest/vboxguest_core.c:1486:10: warning: this statement may fall through [-Wimplicit-fallthrough=] f32bit = true;
    ~~~~~~~^~~~~~
drivers/virt/vboxguest/vboxguest_core.c:1489:2: note: here
   case VBG_IOCTL_HGCM_CALL(0):
   ^~~~

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

Notice that, in this particular case, the code comment is modified in accordance with what GCC is expecting to find.

Quoted 9 lines
Quoted 4 lines

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

Thank you the patch, patch looks good to me:

Thank you, Hans.

--
Gustavo

Quoted 25 lines

Regards,

Hans

Quoted 19 lines

---
  drivers/virt/vboxguest/vboxguest_core.c | 2 +-

  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/virt/vboxguest/vboxguest_core.c +0 -0
index 1475ed5ffcde..df7d09409efe 100644
@@ -1484,8 +1484,8 @@ int vbg_core_ioctl(struct vbg_session *session, unsigned int req, void *data)
   #ifdef CONFIG_COMPAT

      case VBG_IOCTL_HGCM_CALL_32(0):
          f32bit = true;
-        /* Fall through */
  #endif
+        /* Fall through */
      case VBG_IOCTL_HGCM_CALL(0):
          return vbg_ioctl_hgcm_call(gdev, session, f32bit, data); case VBG_IOCTL_LOG(0):