[Libguestfs] [PATCH] lib: qemu: help GCC 8 by break'ing a case in a switch

Pino Toscano ptoscano at redhat.com
Thu Feb 15 17:14:59 UTC 2018


GCC 8 thinks that the case drive_protocol_gluster may fall through, most
probably because the only code is a switch case that handles the
elements of an enum, and thus letting other fall through. In reality
this ought to not happen at all, so help GCC by break'ing the case,
which will then lead to the abort() at the end of
guestfs_int_drive_source_qemu_param.
---
 lib/qemu.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lib/qemu.c b/lib/qemu.c
index cd859139d..a50eca988 100644
--- a/lib/qemu.c
+++ b/lib/qemu.c
@@ -746,6 +746,7 @@ guestfs_int_drive_source_qemu_param (guestfs_h *g,
       return make_uri (g, "gluster+unix", NULL, NULL,
                        &src->servers[0], NULL);
     }
+    break;
 
   case drive_protocol_http:
     return make_uri (g, "http", src->username, src->secret,
-- 
2.14.3




More information about the Libguestfs mailing list