Ensure all enum cases are listed in switch statements.

Signed-off-by: Daniel P. Berrangé <berra...@redhat.com>
---
 src/conf/domain_audit.c  |  1 +
 src/conf/domain_conf.c   | 47 +++++++++++++++++++++++++++++++++++++++++------
 src/conf/nwfilter_conf.c | 32 +++++++++++++++++++++++++++++++-
 3 files changed, 73 insertions(+), 7 deletions(-)

diff --git a/src/conf/domain_audit.c b/src/conf/domain_audit.c
index 723c737363..82868bca76 100644
--- a/src/conf/domain_audit.c
+++ b/src/conf/domain_audit.c
@@ -586,6 +586,7 @@ virDomainAuditTPM(virDomainObjPtr vm, virDomainTPMDefPtr 
tpm,
                   "virt=%s resrc=dev reason=%s %s uuid=%s %s",
                   virt, reason, vmname, uuidstr, device);
         break;
+    case VIR_DOMAIN_TPM_TYPE_LAST:
     default:
         break;
     }
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index abc3332377..538dfc84bd 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -11565,8 +11565,21 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt,
             def->filterparams = filterparams;
             filterparams = NULL;
             break;
-        default:
+        case VIR_DOMAIN_NET_TYPE_USER:
+        case VIR_DOMAIN_NET_TYPE_VHOSTUSER:
+        case VIR_DOMAIN_NET_TYPE_SERVER:
+        case VIR_DOMAIN_NET_TYPE_CLIENT:
+        case VIR_DOMAIN_NET_TYPE_MCAST:
+        case VIR_DOMAIN_NET_TYPE_INTERNAL:
+        case VIR_DOMAIN_NET_TYPE_DIRECT:
+        case VIR_DOMAIN_NET_TYPE_HOSTDEV:
+        case VIR_DOMAIN_NET_TYPE_UDP:
             break;
+        case VIR_DOMAIN_NET_TYPE_LAST:
+        default:
+            virReportError(VIR_ERR_INTERNAL_ERROR,
+                           _("Unexpected network type %d"), def->type);
+            goto error;
         }
     }
 
@@ -14646,6 +14659,12 @@ virDomainVideoDefaultRAM(const virDomainDef *def,
         /* QEMU use 64M as the minimal video memory for qxl device */
         return 64 * 1024;
 
+    case VIR_DOMAIN_VIDEO_TYPE_DEFAULT:
+    case VIR_DOMAIN_VIDEO_TYPE_VBOX:
+    case VIR_DOMAIN_VIDEO_TYPE_PARALLELS:
+    case VIR_DOMAIN_VIDEO_TYPE_VIRTIO:
+    case VIR_DOMAIN_VIDEO_TYPE_GOP:
+    case VIR_DOMAIN_VIDEO_TYPE_LAST:
     default:
         return 0;
     }
@@ -14680,6 +14699,16 @@ virDomainVideoDefaultType(const virDomainDef *def)
             return VIR_DOMAIN_VIDEO_TYPE_PARALLELS;
     case VIR_DOMAIN_VIRT_BHYVE:
         return VIR_DOMAIN_VIDEO_TYPE_GOP;
+    case VIR_DOMAIN_VIRT_QEMU:
+    case VIR_DOMAIN_VIRT_KQEMU:
+    case VIR_DOMAIN_VIRT_KVM:
+    case VIR_DOMAIN_VIRT_LXC:
+    case VIR_DOMAIN_VIRT_UML:
+    case VIR_DOMAIN_VIRT_OPENVZ:
+    case VIR_DOMAIN_VIRT_HYPERV:
+    case VIR_DOMAIN_VIRT_PHYP:
+    case VIR_DOMAIN_VIRT_NONE:
+    case VIR_DOMAIN_VIRT_LAST:
     default:
         return VIR_DOMAIN_VIDEO_TYPE_DEFAULT;
     }
@@ -27780,7 +27809,7 @@ virDomainObjGetState(virDomainObjPtr dom, int *reason)
 void
 virDomainObjSetState(virDomainObjPtr dom, virDomainState state, int reason)
 {
-    int last = -1;
+    int last;
 
     switch (state) {
     case VIR_DOMAIN_NOSTATE:
@@ -27807,11 +27836,8 @@ virDomainObjSetState(virDomainObjPtr dom, 
virDomainState state, int reason)
     case VIR_DOMAIN_PMSUSPENDED:
         last = VIR_DOMAIN_PMSUSPENDED_LAST;
         break;
+    case VIR_DOMAIN_LAST:
     default:
-        last = -1;
-    }
-
-    if (last < 0) {
         VIR_ERROR(_("invalid domain state: %d"), state);
         return;
     }
@@ -27975,6 +28001,15 @@ 
virDomainNetGetActualVirtPortProfile(virDomainNetDefPtr iface)
         default:
             return NULL;
         }
+    case VIR_DOMAIN_NET_TYPE_USER:
+    case VIR_DOMAIN_NET_TYPE_ETHERNET:
+    case VIR_DOMAIN_NET_TYPE_VHOSTUSER:
+    case VIR_DOMAIN_NET_TYPE_SERVER:
+    case VIR_DOMAIN_NET_TYPE_CLIENT:
+    case VIR_DOMAIN_NET_TYPE_MCAST:
+    case VIR_DOMAIN_NET_TYPE_INTERNAL:
+    case VIR_DOMAIN_NET_TYPE_UDP:
+    case VIR_DOMAIN_NET_TYPE_LAST:
     default:
         return NULL;
     }
diff --git a/src/conf/nwfilter_conf.c b/src/conf/nwfilter_conf.c
index 5d6423e060..9e8c725f9f 100644
--- a/src/conf/nwfilter_conf.c
+++ b/src/conf/nwfilter_conf.c
@@ -2153,8 +2153,35 @@ virNWFilterRuleValidate(virNWFilterRuleDefPtr rule)
             }
         }
         break;
-    default:
+    case VIR_NWFILTER_RULE_PROTOCOL_NONE:
+    case VIR_NWFILTER_RULE_PROTOCOL_MAC:
+    case VIR_NWFILTER_RULE_PROTOCOL_VLAN:
+    case VIR_NWFILTER_RULE_PROTOCOL_STP:
+    case VIR_NWFILTER_RULE_PROTOCOL_ARP:
+    case VIR_NWFILTER_RULE_PROTOCOL_RARP:
+    case VIR_NWFILTER_RULE_PROTOCOL_TCP:
+    case VIR_NWFILTER_RULE_PROTOCOL_ICMP:
+    case VIR_NWFILTER_RULE_PROTOCOL_IGMP:
+    case VIR_NWFILTER_RULE_PROTOCOL_UDP:
+    case VIR_NWFILTER_RULE_PROTOCOL_UDPLITE:
+    case VIR_NWFILTER_RULE_PROTOCOL_ESP:
+    case VIR_NWFILTER_RULE_PROTOCOL_AH:
+    case VIR_NWFILTER_RULE_PROTOCOL_SCTP:
+    case VIR_NWFILTER_RULE_PROTOCOL_ALL:
+    case VIR_NWFILTER_RULE_PROTOCOL_TCPoIPV6:
+    case VIR_NWFILTER_RULE_PROTOCOL_ICMPV6:
+    case VIR_NWFILTER_RULE_PROTOCOL_UDPoIPV6:
+    case VIR_NWFILTER_RULE_PROTOCOL_UDPLITEoIPV6:
+    case VIR_NWFILTER_RULE_PROTOCOL_ESPoIPV6:
+    case VIR_NWFILTER_RULE_PROTOCOL_AHoIPV6:
+    case VIR_NWFILTER_RULE_PROTOCOL_SCTPoIPV6:
+    case VIR_NWFILTER_RULE_PROTOCOL_ALLoIPV6:
         break;
+    case VIR_NWFILTER_RULE_PROTOCOL_LAST:
+    default:
+        virReportError(VIR_ERR_INTERNAL_ERROR,
+                       _("Unexpected nwfilter protocol %d"), rule->prtclType);
+        return -1;
     }
 
     return ret;
@@ -3064,7 +3091,10 @@ virNWFilterRuleDefDetailsFormat(virBufferPtr buf,
                        virBufferAddLit(buf, "false");
                break;
 
+               case DATATYPE_IPSETNAME:
+               case DATATYPE_IPSETFLAGS:
                case DATATYPE_STRING:
+               case DATATYPE_LAST:
                default:
                    virBufferAsprintf(buf,
                                      "UNSUPPORTED DATATYPE 0x%02x\n",
-- 
2.14.3

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to