Ensure all enum cases are listed in switch statements.
Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
src/vmx/vmx.c | 26 ++++++++++++++++++++++++--
src/xenconfig/xen_common.c | 18 +++++++++++++++---
src/xenconfig/xen_xl.c | 7 ++++++-
3 files changed, 45 insertions(+), 6 deletions(-)
diff --git a/src/vmx/vmx.c b/src/vmx/vmx.c
index 1d13ab03db..3b0c16d5a6 100644
--- a/src/vmx/vmx.c
+++ b/src/vmx/vmx.c
@@ -3283,11 +3283,19 @@ virVMXFormatConfig(virVMXContext *ctx, virDomainXMLOptionPtr
xmlopt, virDomainDe
break;
- default:
+ case VIR_DOMAIN_GRAPHICS_TYPE_SDL:
+ case VIR_DOMAIN_GRAPHICS_TYPE_RDP:
+ case VIR_DOMAIN_GRAPHICS_TYPE_DESKTOP:
+ case VIR_DOMAIN_GRAPHICS_TYPE_SPICE:
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("Unsupported graphics type '%s'"),
virDomainGraphicsTypeToString(def->graphics[i]->type));
goto cleanup;
+
+ case VIR_DOMAIN_GRAPHICS_TYPE_LAST:
+ default:
+ virReportEnumRangeError(virDomainGraphicsType,
def->graphics[i]->type);
+ goto cleanup;
}
}
@@ -3782,10 +3790,24 @@ virVMXFormatEthernet(virDomainNetDefPtr def, int controller,
controller);
break;
- default:
+ 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_NETWORK:
+ case VIR_DOMAIN_NET_TYPE_INTERNAL:
+ case VIR_DOMAIN_NET_TYPE_DIRECT:
+ case VIR_DOMAIN_NET_TYPE_HOSTDEV:
+ case VIR_DOMAIN_NET_TYPE_UDP:
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("Unsupported net type
'%s'"),
virDomainNetTypeToString(def->type));
return -1;
+
+ case VIR_DOMAIN_NET_TYPE_LAST:
+ default:
+ virReportEnumRangeError(virDomainNetType, def->type);
+ return -1;
}
/* def:mac -> vmx:addressType, vmx:(generated)Address, vmx:checkMACAddress */
diff --git a/src/xenconfig/xen_common.c b/src/xenconfig/xen_common.c
index ca3b4dee6a..bc43185363 100644
--- a/src/xenconfig/xen_common.c
+++ b/src/xenconfig/xen_common.c
@@ -1258,10 +1258,22 @@ xenFormatNet(virConnectPtr conn,
}
break;
+ 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:
+ case VIR_DOMAIN_NET_TYPE_USER:
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("Unsupported net type
'%s'"),
+ virDomainNetTypeToString(net->type));
+ goto cleanup;
+
+ case VIR_DOMAIN_NET_TYPE_LAST:
default:
- virReportError(VIR_ERR_INTERNAL_ERROR,
- _("unsupported network type %d"),
- net->type);
+ virReportEnumRangeError(virDomainNetType, net->type);
goto cleanup;
}
diff --git a/src/xenconfig/xen_xl.c b/src/xenconfig/xen_xl.c
index 2ef80eb83a..e1ec8e765f 100644
--- a/src/xenconfig/xen_xl.c
+++ b/src/xenconfig/xen_xl.c
@@ -1641,8 +1641,13 @@ xenFormatXLSpice(virConfPtr conf, virDomainDefPtr def)
if (xenConfigSetInt(conf, "spicevdagent", 1) < 0)
return -1;
break;
- default:
+ case VIR_DOMAIN_GRAPHICS_SPICE_MOUSE_MODE_DEFAULT:
break;
+ case VIR_DOMAIN_GRAPHICS_SPICE_MOUSE_MODE_LAST:
+ default:
+ virReportEnumRangeError(virDomainGraphicsSpiceMouseMode,
+ graphics->data.spice.mousemode);
+ return -1;
}
}
--
2.14.3