Ensure all enum cases are listed in switch statements.
Signed-off-by: Daniel P. Berrangé
---
src/vmx/vmx.c | 27 +--
src/xenconfig/xen_common.c | 17 +++--
src/xenconfig/xen_xl.c | 8 +++-
3 files changed, 47 insertions(+), 5 deletions(-)
diff --git a/src/vmx/vmx.c b/src/vmx/vmx.c
index 7a749f93ab..5855a11c88 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:
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Unexpected graphics type %d"),
def->graphics[i]->type);
}
}
@@ -3782,10 +3790,25 @@ 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:
+virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Unexpected network type %d"), 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..c3fe5d39dc 100644
--- a/src/xenconfig/xen_common.c
+++ b/src/xenconfig/xen_common.c
@@ -1258,10 +1258,23 @@ 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);
+ _("Unexpected network type %d"), net->type);
goto cleanup;
}
diff --git a/src/xenconfig/xen_xl.c b/src/xenconfig/xen_xl.c
index 2ef80eb83a..e61784aff2 100644
--- a/src/xenconfig/xen_xl.c
+++ b/src/xenconfig/xen_xl.c
@@ -1641,8 +1641,14 @@ 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:
+virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Unexpected mouse mode %d"),
+ graphics->data.spice.mousemode);
+return -1;
}
}
--
2.14.3
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list