]> xenbits.xensource.com Git - libvirt.git/commitdiff
nodedev: let compiler help us on switches
authorEric Blake <eblake@redhat.com>
Thu, 24 Jul 2014 02:20:22 +0000 (20:20 -0600)
committerEric Blake <eblake@redhat.com>
Mon, 28 Jul 2014 19:41:41 +0000 (13:41 -0600)
The compiler can alert us to places where we need to expand switch
statements because we add a new enum value, but only if we don't
have a default case.

* src/conf/node_device_conf.c (virNodeDeviceDefFormat)
(virNodeDevCapsDefParseXML, virNodeDevCapsDefFree): Drop default
case.

Signed-off-by: Eric Blake <eblake@redhat.com>
src/conf/node_device_conf.c

index 910a3719c7f52f035749382e8e4179fc4fd9d052..ac966d36e4c68fb979ac2d904ed6ecd37af2b600 100644 (file)
@@ -547,7 +547,6 @@ char *virNodeDeviceDefFormat(const virNodeDeviceDef *def)
         case VIR_NODE_DEV_CAP_FC_HOST:
         case VIR_NODE_DEV_CAP_VPORTS:
         case VIR_NODE_DEV_CAP_LAST:
-        default:
             break;
         }
 
@@ -1405,7 +1404,10 @@ virNodeDevCapsDefParseXML(xmlXPathContextPtr ctxt,
     case VIR_NODE_DEV_CAP_STORAGE:
         ret = virNodeDevCapStorageParseXML(ctxt, def, node, &caps->data);
         break;
-    default:
+    case VIR_NODE_DEV_CAP_FC_HOST:
+    case VIR_NODE_DEV_CAP_VPORTS:
+    case VIR_NODE_DEV_CAP_SCSI_GENERIC:
+    case VIR_NODE_DEV_CAP_LAST:
         virReportError(VIR_ERR_INTERNAL_ERROR,
                        _("unknown capability type '%d' for '%s'"),
                        caps->type, def->name);
@@ -1703,7 +1705,6 @@ void virNodeDevCapsDefFree(virNodeDevCapsDefPtr caps)
     case VIR_NODE_DEV_CAP_FC_HOST:
     case VIR_NODE_DEV_CAP_VPORTS:
     case VIR_NODE_DEV_CAP_LAST:
-    default:
         /* This case is here to shutup the compiler */
         break;
     }