As a general rule any time we switch() on something that is an enum, we
want to have a case for every enum constant. The -Wswitch warning will
report any switch where we've violated this rule, except if that switch
has a default case.
Unfortunately it is reasonable to want to list all enum constants *and*
also have a default case. To get a warning in that scenario requires
that we turn on -Wswitch-enum. When we do this, we then have to then
fixup various switches that used an enum but relied on a default: to
silence warnings. Mostly this involved adding missing enum cases, but
in some places it was more practical to silence the warning by casting
the enum to an int, since we don't care about covering all enums.
Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
m4/virt-compile-warnings.m4 | 7 +++--
src/conf/domain_audit.c | 1 +
src/conf/domain_conf.c | 47 +++++++++++++++++++++++++++----
src/conf/nwfilter_conf.c | 32 ++++++++++++++++++++-
src/esx/esx_driver.c | 1 +
src/esx/esx_vi.c | 11 +++++---
src/esx/esx_vi_types.c | 9 +++---
src/hyperv/hyperv_driver.c | 18 ++++++++++--
src/libxl/libxl_driver.c | 2 +-
src/lxc/lxc_container.c | 7 +++--
src/lxc/lxc_controller.c | 10 ++++++-
src/lxc/lxc_driver.c | 40 +++++++++++++++++++++++---
src/nwfilter/nwfilter_ebiptables_driver.c | 16 +++++++----
src/nwfilter/nwfilter_learnipaddr.c | 6 +++-
src/qemu/qemu_command.c | 28 ++++++++++++------
src/qemu/qemu_domain.c | 21 ++++++++++++++
src/qemu/qemu_driver.c | 27 ++++++++++++------
src/qemu/qemu_hotplug.c | 36 +++++++++++++++++++----
src/qemu/qemu_migration.c | 11 +++++++-
src/qemu/qemu_process.c | 2 ++
src/rpc/virnetclient.c | 2 ++
src/rpc/virnetclientprogram.c | 1 +
src/rpc/virnetserverprogram.c | 4 +++
src/security/security_driver.c | 1 +
src/util/virconf.c | 13 ++++++++-
src/util/virfirewall.c | 7 +++--
src/util/virlog.c | 10 ++++++-
src/util/virnetdevvportprofile.c | 11 +++++++-
src/vmx/vmx.c | 27 ++++++++++++++++--
src/xenconfig/xen_common.c | 17 +++++++++--
src/xenconfig/xen_xl.c | 8 +++++-
tools/virt-host-validate-qemu.c | 3 +-
32 files changed, 369 insertions(+), 67 deletions(-)
diff --git a/m4/virt-compile-warnings.m4 b/m4/virt-compile-warnings.m4
index b9c974842..918764d36 100644
--- a/m4/virt-compile-warnings.m4
+++ b/m4/virt-compile-warnings.m4
@@ -47,8 +47,6 @@ AC_DEFUN([LIBVIRT_COMPILE_WARNINGS],[
dontwarn="$dontwarn -Wlong-long"
# We allow manual list of all enum cases without default:
dontwarn="$dontwarn -Wswitch-default"
- # We allow optional default: instead of listing all enum values
- dontwarn="$dontwarn -Wswitch-enum"
# Not a problem since we don't use -fstrict-overflow
dontwarn="$dontwarn -Wstrict-overflow"
# Not a problem since we don't use -funsafe-loop-optimizations
@@ -182,6 +180,11 @@ AC_DEFUN([LIBVIRT_COMPILE_WARNINGS],[
# that one off, so we need to manually enable this again
wantwarn="$wantwarn -Wjump-misses-init"
+ # GNULIB explicitly filters it out, preferring -Wswitch
+ # but that doesn't report missing enums if a default:
+ # is present.
+ wantwarn="$wantwarn -Wswitch-enum"
+
# GNULIB turns on -Wformat=2 which implies -Wformat-nonliteral,
# so we need to manually re-exclude it. Also, older gcc 4.2
# added an implied ATTRIBUTE_NONNULL on any parameter marked
diff --git a/src/conf/domain_audit.c b/src/conf/domain_audit.c
index 723c73736..82868bca7 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 fb732a0c2..89be27490 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -11564,8 +11564,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;
}
}
@@ -14645,6 +14658,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;
}
@@ -14679,6 +14698,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;
}
@@ -27779,7 +27808,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:
@@ -27806,11 +27835,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;
}
@@ -27974,6 +28000,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 5d6423e06..9e8c725f9 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",
diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c
index f57536205..c5f04efa8 100644
--- a/src/esx/esx_driver.c
+++ b/src/esx/esx_driver.c
@@ -3603,6 +3603,7 @@ esxDomainGetSchedulerParametersFlags(virDomainPtr domain,
params[i].value.i = -3;
break;
+ case esxVI_SharesLevel_Undefined:
default:
virReportError(VIR_ERR_INTERNAL_ERROR,
_("Shares level has unknown value %d"),
diff --git a/src/esx/esx_vi.c b/src/esx/esx_vi.c
index edf52ff82..103f72606 100644
--- a/src/esx/esx_vi.c
+++ b/src/esx/esx_vi.c
@@ -483,7 +483,7 @@ esxVI_SharedCURL_Lock(CURL *handle ATTRIBUTE_UNUSED, curl_lock_data
data,
size_t i;
esxVI_SharedCURL *shared = userptr;
- switch (data) {
+ switch ((int)data) {
case CURL_LOCK_DATA_SHARE:
i = 0;
break;
@@ -511,7 +511,7 @@ esxVI_SharedCURL_Unlock(CURL *handle ATTRIBUTE_UNUSED, curl_lock_data
data,
size_t i;
esxVI_SharedCURL *shared = userptr;
- switch (data) {
+ switch ((int)data) {
case CURL_LOCK_DATA_SHARE:
i = 0;
break;
@@ -1563,6 +1563,7 @@ esxVI_Context_Execute(esxVI_Context *ctx, const char *methodName,
break;
+ case esxVI_Occurrence_Undefined:
default:
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Invalid argument (occurrence)"));
@@ -2280,9 +2281,11 @@ esxVI_LookupObjectContentByType(esxVI_Context *ctx,
type, root->type);
break;
+ case esxVI_Occurrence_None:
+ case esxVI_Occurrence_Undefined:
default:
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Invalid occurrence value"));
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Invalid occurrence value %d"), occurrence);
break;
}
diff --git a/src/esx/esx_vi_types.c b/src/esx/esx_vi_types.c
index be35af861..74183f830 100644
--- a/src/esx/esx_vi_types.c
+++ b/src/esx/esx_vi_types.c
@@ -544,7 +544,7 @@ VIR_LOG_INIT("esx.esx_vi_types");
#define ESX_VI__TEMPLATE__DISPATCH(_actual_type, _actual_type_name, __type, \
_dispatch, _error_return) \
- switch (_actual_type) { \
+ switch ((int)_actual_type) { \
_dispatch \
\
case esxVI_Type_##__type: \
@@ -690,7 +690,7 @@ VIR_LOG_INIT("esx.esx_vi_types");
return -1; \
} \
\
- switch (type) { \
+ switch ((int)type) { \
_dispatch \
\
case esxVI_Type_##__type: \
@@ -967,7 +967,7 @@ esxVI_AnyType_DeepCopy(esxVI_AnyType **dest, esxVI_AnyType *src)
goto failure;
}
- switch (src->type) {
+ switch ((int)src->type) {
case esxVI_Type_Boolean:
(*dest)->boolean = src->boolean;
break;
@@ -1071,7 +1071,7 @@ esxVI_AnyType_Deserialize(xmlNodePtr node, esxVI_AnyType **anyType)
(*anyType)->_name = number; \
} while (0)
- switch ((*anyType)->type) {
+ switch ((int)(*anyType)->type) {
case esxVI_Type_Boolean:
if (STREQ((*anyType)->value, "true")) {
(*anyType)->boolean = esxVI_Boolean_True;
@@ -1876,6 +1876,7 @@ esxVI_VirtualMachinePowerState_ConvertToLibvirt
case esxVI_VirtualMachinePowerState_Suspended:
return VIR_DOMAIN_PAUSED;
+ case esxVI_VirtualMachinePowerState_Undefined:
default:
return VIR_DOMAIN_NOSTATE;
}
diff --git a/src/hyperv/hyperv_driver.c b/src/hyperv/hyperv_driver.c
index ee94fd351..e512b626e 100644
--- a/src/hyperv/hyperv_driver.c
+++ b/src/hyperv/hyperv_driver.c
@@ -1656,13 +1656,27 @@ hypervDebugHandler(const char *message, debug_level_e level,
switch (level) {
case DEBUG_LEVEL_ERROR:
case DEBUG_LEVEL_CRITICAL:
- VIR_ERROR(_("openwsman error: %s"), message);
+ case DEBUG_LEVEL_ALWAYS:
+ VIR_ERROR(_("openwsman: %s"), message);
break;
case DEBUG_LEVEL_WARNING:
- VIR_WARN("openwsman warning: %s", message);
+ VIR_WARN("openwsman: %s", message);
break;
+ case DEBUG_LEVEL_MESSAGE:
+ VIR_INFO("openwsman: %s", message);
+ break;
+
+ case DEBUG_LEVEL_INFO:
+ VIR_INFO("openwsman: %s", message);
+ break;
+
+ case DEBUG_LEVEL_DEBUG:
+ VIR_DEBUG("openwsman: %s", message);
+ break;
+
+ case DEBUG_LEVEL_NONE:
default:
/* Ignore the rest */
break;
diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index be11134fb..4b52de36f 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -4497,7 +4497,7 @@ libxlDomainGetSchedulerType(virDomainPtr dom, int *nparams)
if (nparams)
*nparams = 0;
- switch (sched_id) {
+ switch ((int)sched_id) {
case LIBXL_SCHEDULER_SEDF:
name = "sedf";
break;
diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c
index 96fceaf1b..ec641c3ca 100644
--- a/src/lxc/lxc_container.c
+++ b/src/lxc/lxc_container.c
@@ -2035,7 +2035,7 @@ static int lxcContainerDropCapabilities(virDomainDefPtr def,
break;
case VIR_DOMAIN_CAPABILITIES_POLICY_DEFAULT:
- switch ((virDomainCapsFeature) i) {
+ switch (i) {
case VIR_DOMAIN_CAPS_FEATURE_SYS_BOOT: /* No use of reboot */
toDrop = !keepReboot && (state != VIR_TRISTATE_SWITCH_ON);
break;
@@ -2066,10 +2066,11 @@ static int lxcContainerDropCapabilities(virDomainDefPtr def,
}
break;
+ case VIR_DOMAIN_CAPABILITIES_POLICY_LAST:
default:
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("Unsupported capabilities policy: %s"),
- virDomainCapabilitiesPolicyTypeToString(policy));
+ _("Unsupported capabilities policy: %d"),
+ policy);
}
}
diff --git a/src/lxc/lxc_controller.c b/src/lxc/lxc_controller.c
index c5e67df93..f9f26570c 100644
--- a/src/lxc/lxc_controller.c
+++ b/src/lxc/lxc_controller.c
@@ -395,8 +395,16 @@ static int virLXCControllerGetNICIndexes(virLXCControllerPtr ctrl)
case VIR_DOMAIN_NET_TYPE_INTERNAL:
case VIR_DOMAIN_NET_TYPE_DIRECT:
case VIR_DOMAIN_NET_TYPE_HOSTDEV:
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("Unsupported net type %s"),
+ virDomainNetTypeToString(ctrl->def->nets[i]->type));
+ goto cleanup;
+ case VIR_DOMAIN_NET_TYPE_LAST:
default:
- break;
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("Unexpected net type %d"),
+ ctrl->def->nets[i]->type);
+ goto cleanup;
}
}
diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
index 961baa344..7d6568cdf 100644
--- a/src/lxc/lxc_driver.c
+++ b/src/lxc/lxc_driver.c
@@ -3968,10 +3968,22 @@ lxcDomainAttachDeviceNetLive(virConnectPtr conn,
if (!(veth = virLXCProcessSetupInterfaceDirect(conn, vm->def, net)))
goto cleanup;
} 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_HOSTDEV:
+ case VIR_DOMAIN_NET_TYPE_UDP:
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("Network device type is not supported"));
goto cleanup;
+ case VIR_DOMAIN_NET_TYPE_LAST:
+ default:
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Unexpected net type %d"), actualType);
+ goto cleanup;
}
/* Set bandwidth or warn if requested and not supported. */
actualBandwidth = virDomainNetGetActualBandwidth(net);
@@ -4011,6 +4023,15 @@ lxcDomainAttachDeviceNetLive(virConnectPtr conn,
ignore_value(virNetDevMacVLanDelete(veth));
break;
+ 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_HOSTDEV:
+ case VIR_DOMAIN_NET_TYPE_UDP:
+ case VIR_DOMAIN_NET_TYPE_LAST:
default:
/* no-op */
break;
@@ -4446,13 +4467,24 @@ lxcDomainDetachDeviceNetLive(virDomainObjPtr vm,
* the host side. Further the container can change
* the mac address of NIC name, so we can't easily
* find out which guest NIC it maps to
+ */
case VIR_DOMAIN_NET_TYPE_DIRECT:
- */
-
- 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_HOSTDEV:
+ case VIR_DOMAIN_NET_TYPE_UDP:
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("Only bridged veth devices can be detached"));
goto cleanup;
+ case VIR_DOMAIN_NET_TYPE_LAST:
+ default:
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Unexpected net type %d"), actualType);
+ goto cleanup;
}
virDomainAuditNet(vm, detach, NULL, "detach", true);
diff --git a/src/nwfilter/nwfilter_ebiptables_driver.c
b/src/nwfilter/nwfilter_ebiptables_driver.c
index b8682a113..c624337f4 100644
--- a/src/nwfilter/nwfilter_ebiptables_driver.c
+++ b/src/nwfilter/nwfilter_ebiptables_driver.c
@@ -320,11 +320,17 @@ _printDataType(virNWFilterVarCombIterPtr vars,
VIR_FREE(flags);
break;
+ case DATATYPE_STRING:
+ case DATATYPE_STRINGCOPY:
+ case DATATYPE_BOOLEAN:
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Cannot print data type %x"), item->datatype);
+ return -1;
+ case DATATYPE_LAST:
default:
virReportError(VIR_ERR_INTERNAL_ERROR,
- _("Unhandled datatype %x"), item->datatype);
+ _("Unexpected datatype %x"), item->datatype);
return -1;
- break;
}
return 0;
@@ -1183,7 +1189,7 @@ _iptablesCreateRuleInstance(virFirewallPtr fw,
PRINT_IPT_ROOT_CHAIN(chain, chainPrefix, ifname);
- switch (rule->prtclType) {
+ switch ((int)rule->prtclType) {
case VIR_NWFILTER_RULE_PROTOCOL_TCP:
case VIR_NWFILTER_RULE_PROTOCOL_TCPoIPV6:
fwrule = virFirewallAddRule(fw, layer,
@@ -1873,7 +1879,7 @@ ebtablesCreateRuleInstance(virFirewallPtr fw,
#define INST_ITEM_MASK(S, I, MASK, C) \
INST_ITEM_2PARMS(S, I, MASK, C, "/")
- switch (rule->prtclType) {
+ switch ((int)rule->prtclType) {
case VIR_NWFILTER_RULE_PROTOCOL_MAC:
fwrule = virFirewallAddRule(fw, VIR_FIREWALL_LAYER_ETHERNET,
"-t", "nat",
@@ -2677,7 +2683,7 @@ ebtablesCreateTmpSubChainFW(virFirewallPtr fw,
fwrule = virFirewallAddRule(fw, VIR_FIREWALL_LAYER_ETHERNET,
"-t", "nat", "-A",
rootchain, NULL);
- switch (protoidx) {
+ switch ((int)protoidx) {
case L2_PROTO_MAC_IDX:
break;
case L2_PROTO_STP_IDX:
diff --git a/src/nwfilter/nwfilter_learnipaddr.c b/src/nwfilter/nwfilter_learnipaddr.c
index 5b95f0e61..9ca063957 100644
--- a/src/nwfilter/nwfilter_learnipaddr.c
+++ b/src/nwfilter/nwfilter_learnipaddr.c
@@ -430,7 +430,7 @@ learnIPAddressThread(void *arg)
}
virBufferAddLit(&buf, "src port 67 and dst port 68");
break;
- default:
+ case DETECT_STATIC:
if (techdriver->applyBasicRules(req->ifname,
&req->macaddr) < 0) {
req->status = EINVAL;
@@ -438,6 +438,10 @@ learnIPAddressThread(void *arg)
}
virBufferAsprintf(&buf, "ether host %s or ether dst
ff:ff:ff:ff:ff:ff",
macaddr);
+ break;
+ default:
+ req->status = EINVAL;
+ goto done;
}
if (virBufferError(&buf)) {
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 6c73cd7bf..03390e651 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -2634,7 +2634,7 @@ qemuBuildControllerDevStr(const virDomainDef *domainDef,
case VIR_DOMAIN_CONTROLLER_TYPE_SCSI:
switch ((virDomainControllerModelSCSI) def->model) {
case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_SCSI:
- switch ((virDomainDeviceAddressType) address_type) {
+ switch (address_type) {
case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW:
virBufferAddLit(&buf, "virtio-scsi-ccw");
break;
@@ -2680,7 +2680,7 @@ qemuBuildControllerDevStr(const virDomainDef *domainDef,
break;
case VIR_DOMAIN_CONTROLLER_TYPE_VIRTIO_SERIAL:
- switch ((virDomainDeviceAddressType) address_type) {
+ switch (address_type) {
case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI:
virBufferAddLit(&buf, "virtio-serial-pci");
break;
@@ -3389,12 +3389,18 @@ qemuBuildNicDevStr(virDomainDefPtr def,
case VIR_DOMAIN_NET_VIRTIO_TX_MODE_TIMER:
virBufferAddLit(&buf, "timer");
break;
+
+ case VIR_DOMAIN_NET_VIRTIO_TX_MODE_DEFAULT:
+ break;
+
+ case VIR_DOMAIN_NET_VIRTIO_TX_MODE_LAST:
default:
/* this should never happen, if it does, we need
* to add another case to this switch.
*/
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("unrecognized virtio-net-pci 'tx'
option"));
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Unexpected NIC tx mode %d"),
+ net->driver.virtio.txmode);
goto error;
}
} else {
@@ -6529,7 +6535,7 @@ qemuBuildGlobalControllerCommandLine(virCommandPtr cmd,
bool cap = false;
bool machine = false;
- switch ((virDomainControllerModelPCI) cont->model) {
+ switch (cont->model) {
case VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT:
hoststr = "i440FX-pcihost";
cap = virQEMUCapsGet(qemuCaps, QEMU_CAPS_I440FX_PCI_HOLE64_SIZE);
@@ -6872,7 +6878,7 @@ qemuBuildCpuCommandLine(virCommandPtr cmd,
if (cpu_flags && !cpu) {
const char *default_model;
- switch (def->os.arch) {
+ switch ((int)def->os.arch) {
case VIR_ARCH_I686:
default_model = "qemu32";
break;
@@ -6918,7 +6924,7 @@ qemuBuildObsoleteAccelArg(virCommandPtr cmd,
bool disableKVM = false;
bool enableKVM = false;
- switch (def->virtType) {
+ switch ((int)def->virtType) {
case VIR_DOMAIN_VIRT_QEMU:
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_KVM))
disableKVM = true;
@@ -7892,8 +7898,14 @@ qemuBuildGraphicsSPICECommandLine(virQEMUDriverConfigPtr cfg,
case VIR_DOMAIN_GRAPHICS_SPICE_MOUSE_MODE_CLIENT:
virBufferAddLit(&opt, "agent-mouse=on,");
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);
+ goto error;
}
}
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 178ec24ae..f6e28447d 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -2806,6 +2806,27 @@ qemuDomainDefAddDefaultDevices(virDomainDefPtr def,
addPCIRoot = true;
break;
+ case VIR_ARCH_ARMV6L:
+ case VIR_ARCH_ARMV7B:
+ case VIR_ARCH_CRIS:
+ case VIR_ARCH_ITANIUM:
+ case VIR_ARCH_LM32:
+ case VIR_ARCH_M68K:
+ case VIR_ARCH_MICROBLAZE:
+ case VIR_ARCH_MICROBLAZEEL:
+ case VIR_ARCH_MIPS:
+ case VIR_ARCH_MIPSEL:
+ case VIR_ARCH_MIPS64:
+ case VIR_ARCH_MIPS64EL:
+ case VIR_ARCH_OR32:
+ case VIR_ARCH_PARISC:
+ case VIR_ARCH_PARISC64:
+ case VIR_ARCH_PPCLE:
+ case VIR_ARCH_UNICORE32:
+ case VIR_ARCH_XTENSA:
+ case VIR_ARCH_XTENSAEB:
+ case VIR_ARCH_NONE:
+ case VIR_ARCH_LAST:
default:
break;
}
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index bbce5bd81..0b8976010 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -3041,13 +3041,8 @@ qemuCompressGetCommand(virQEMUSaveFormat compression)
ret = virCommandNew(prog);
virCommandAddArg(ret, "-dc");
- switch (compression) {
- case QEMU_SAVE_FORMAT_LZOP:
+ if (compression == QEMU_SAVE_FORMAT_LZOP)
virCommandAddArg(ret, "--ignore-warn");
- break;
- default:
- break;
- }
return ret;
}
@@ -17820,11 +17815,19 @@ qemuDomainOpenGraphics(virDomainPtr dom,
case VIR_DOMAIN_GRAPHICS_TYPE_SPICE:
protocol = "spice";
break;
- default:
+ case VIR_DOMAIN_GRAPHICS_TYPE_SDL:
+ case VIR_DOMAIN_GRAPHICS_TYPE_RDP:
+ case VIR_DOMAIN_GRAPHICS_TYPE_DESKTOP:
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("Can only open VNC or SPICE graphics backends, not
%s"),
virDomainGraphicsTypeToString(vm->def->graphics[idx]->type));
goto endjob;
+ case VIR_DOMAIN_GRAPHICS_TYPE_LAST:
+ default:
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Unexpected graphics type %d"),
+ vm->def->graphics[idx]->type);
+ goto endjob;
}
if (qemuSecuritySetImageFDLabel(driver->securityManager, vm->def, fd) < 0)
@@ -17884,11 +17887,19 @@ qemuDomainOpenGraphicsFD(virDomainPtr dom,
case VIR_DOMAIN_GRAPHICS_TYPE_SPICE:
protocol = "spice";
break;
- default:
+ case VIR_DOMAIN_GRAPHICS_TYPE_SDL:
+ case VIR_DOMAIN_GRAPHICS_TYPE_RDP:
+ case VIR_DOMAIN_GRAPHICS_TYPE_DESKTOP:
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("Can only open VNC or SPICE graphics backends, not
%s"),
virDomainGraphicsTypeToString(vm->def->graphics[idx]->type));
goto cleanup;
+ case VIR_DOMAIN_GRAPHICS_TYPE_LAST:
+ default:
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Unexpected graphics type %d"),
+ vm->def->graphics[idx]->type);
+ goto cleanup;
}
if (qemuSecuritySetSocketLabel(driver->securityManager, vm->def) < 0)
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index c9868de77..0d7d02c25 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -2992,11 +2992,25 @@ qemuDomainChangeNetFilter(virDomainObjPtr vm,
case VIR_DOMAIN_NET_TYPE_BRIDGE:
case VIR_DOMAIN_NET_TYPE_NETWORK:
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:
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("filters not supported on interfaces of type %s"),
virDomainNetTypeToString(virDomainNetGetActualType(newdev)));
return -1;
+ case VIR_DOMAIN_NET_TYPE_LAST:
+ default:
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Unexpected net type %d"),
+ virDomainNetGetActualType(newdev));
+ return -1;
}
virDomainConfNWFilterTeardown(olddev);
@@ -3291,12 +3305,17 @@ qemuDomainChangeNet(virQEMUDriverPtr driver,
/* all handled in common code directly below this switch */
break;
- default:
+ case VIR_DOMAIN_NET_TYPE_VHOSTUSER:
+ case VIR_DOMAIN_NET_TYPE_HOSTDEV:
virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
_("unable to change config on '%s' network
type"),
virDomainNetTypeToString(newdev->type));
- break;
-
+ goto cleanup;
+ case VIR_DOMAIN_NET_TYPE_LAST:
+ default:
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Unexpected net type %d"), newdev->type);
+ goto cleanup;
}
} else {
/* interface type has changed. There are a few special cases
@@ -3675,10 +3694,17 @@ qemuDomainChangeGraphics(virQEMUDriverPtr driver,
}
break;
- default:
+ case VIR_DOMAIN_GRAPHICS_TYPE_SDL:
+ case VIR_DOMAIN_GRAPHICS_TYPE_RDP:
+ case VIR_DOMAIN_GRAPHICS_TYPE_DESKTOP:
virReportError(VIR_ERR_INTERNAL_ERROR,
_("unable to change config on '%s' graphics
type"), type);
break;
+ case VIR_DOMAIN_GRAPHICS_TYPE_LAST:
+ default:
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Unexpected graphics type %d"), dev->type);
+ break;
}
cleanup:
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 3641b801f..fe3342b38 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -1437,11 +1437,20 @@ qemuMigrationJobName(virDomainObjPtr vm)
switch (priv->job.asyncJob) {
case QEMU_ASYNC_JOB_MIGRATION_OUT:
- return _("migration job");
+ return _("migration out job");
case QEMU_ASYNC_JOB_SAVE:
return _("domain save job");
case QEMU_ASYNC_JOB_DUMP:
return _("domain core dump job");
+ case QEMU_ASYNC_JOB_NONE:
+ return _("no job");
+ case QEMU_ASYNC_JOB_MIGRATION_IN:
+ return _("migration in job");
+ case QEMU_ASYNC_JOB_SNAPSHOT:
+ return _("snapshot job");
+ case QEMU_ASYNC_JOB_START:
+ return _("start job");
+ case QEMU_ASYNC_JOB_LAST:
default:
return _("job");
}
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 10211de87..b86ecda93 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -690,6 +690,8 @@ qemuProcessHandleShutdown(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
detail = VIR_DOMAIN_EVENT_SHUTDOWN_HOST;
break;
+ case VIR_TRISTATE_BOOL_ABSENT:
+ case VIR_TRISTATE_BOOL_LAST:
default:
detail = VIR_DOMAIN_EVENT_SHUTDOWN_FINISHED;
break;
diff --git a/src/rpc/virnetclient.c b/src/rpc/virnetclient.c
index 8aeacf877..0c8d58c32 100644
--- a/src/rpc/virnetclient.c
+++ b/src/rpc/virnetclient.c
@@ -1287,6 +1287,8 @@ virNetClientCallDispatch(virNetClientPtr client)
case VIR_NET_STREAM_HOLE: /* Sparse stream protocol*/
return virNetClientCallDispatchStream(client);
+ case VIR_NET_CALL:
+ case VIR_NET_CALL_WITH_FDS:
default:
virReportError(VIR_ERR_RPC,
_("got unexpected RPC call prog %d vers %d proc %d type
%d"),
diff --git a/src/rpc/virnetclientprogram.c b/src/rpc/virnetclientprogram.c
index d81a05542..505b40fc4 100644
--- a/src/rpc/virnetclientprogram.c
+++ b/src/rpc/virnetclientprogram.c
@@ -384,6 +384,7 @@ int virNetClientProgramCall(virNetClientProgramPtr prog,
virNetClientProgramDispatchError(prog, msg);
goto error;
+ case VIR_NET_CONTINUE:
default:
virReportError(VIR_ERR_RPC,
_("Unexpected message status %d"),
msg->header.status);
diff --git a/src/rpc/virnetserverprogram.c b/src/rpc/virnetserverprogram.c
index 557651ffb..75b0052cd 100644
--- a/src/rpc/virnetserverprogram.c
+++ b/src/rpc/virnetserverprogram.c
@@ -324,6 +324,10 @@ int virNetServerProgramDispatch(virNetServerProgramPtr prog,
ret = 0;
break;
+ case VIR_NET_REPLY:
+ case VIR_NET_REPLY_WITH_FDS:
+ case VIR_NET_MESSAGE:
+ case VIR_NET_STREAM_HOLE:
default:
virReportError(VIR_ERR_RPC,
_("Unexpected message type %u"),
diff --git a/src/security/security_driver.c b/src/security/security_driver.c
index 4800d5255..a845dc799 100644
--- a/src/security/security_driver.c
+++ b/src/security/security_driver.c
@@ -82,6 +82,7 @@ virSecurityDriverPtr virSecurityDriverLookup(const char *name,
}
break;
+ case SECURITY_DRIVER_ERROR:
default:
return NULL;
}
diff --git a/src/util/virconf.c b/src/util/virconf.c
index a82a509ca..af806dd73 100644
--- a/src/util/virconf.c
+++ b/src/util/virconf.c
@@ -296,7 +296,10 @@ virConfSaveValue(virBufferPtr buf, virConfValuePtr val)
virBufferAddLit(buf, " ]");
break;
}
+ case VIR_CONF_LAST:
default:
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Unexpected conf value type %d"), val->type);
return -1;
}
return 0;
@@ -986,13 +989,21 @@ int virConfGetValueStringList(virConfPtr conf,
}
ATTRIBUTE_FALLTHROUGH;
- default:
+ case VIR_CONF_LLONG:
+ case VIR_CONF_ULLONG:
+ case VIR_CONF_NONE:
virReportError(VIR_ERR_INTERNAL_ERROR,
compatString ?
_("%s: expected a string or string list for '%s'
parameter") :
_("%s: expected a string list for '%s'
parameter"),
conf->filename, setting);
return -1;
+
+ case VIR_CONF_LAST:
+ default:
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Unexpected value type %d"), cval->type);
+ return -1;
}
return 1;
diff --git a/src/util/virfirewall.c b/src/util/virfirewall.c
index ff1bb8307..e7da48264 100644
--- a/src/util/virfirewall.c
+++ b/src/util/virfirewall.c
@@ -827,9 +827,12 @@ virFirewallApplyRule(virFirewallPtr firewall,
if (virFirewallApplyRuleFirewallD(rule, ignoreErrors, &output) < 0)
return -1;
break;
+
+ case VIR_FIREWALL_BACKEND_AUTOMATIC:
+ case VIR_FIREWALL_BACKEND_LAST:
default:
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Unexpected firewall engine backend"));
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Unexpected firewall engine backend %d"),
currentBackend);
return -1;
}
diff --git a/src/util/virlog.c b/src/util/virlog.c
index 4f66cc5e5..ecbee71cf 100644
--- a/src/util/virlog.c
+++ b/src/util/virlog.c
@@ -1206,10 +1206,18 @@ virLogGetOutputs(void)
virLogDestinationTypeToString(dest),
virLogOutputs[i]->name);
break;
- default:
+ case VIR_LOG_TO_STDERR:
+ case VIR_LOG_TO_JOURNALD:
virBufferAsprintf(&outputbuf, "%d:%s",
virLogOutputs[i]->priority,
virLogDestinationTypeToString(dest));
+ break;
+ case VIR_LOG_TO_OUTPUT_LAST:
+ default:
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Unexpected log output type %d"), dest);
+ virLogUnlock();
+ return NULL;
}
}
virLogUnlock();
diff --git a/src/util/virnetdevvportprofile.c b/src/util/virnetdevvportprofile.c
index db495a754..4c0a64e43 100644
--- a/src/util/virnetdevvportprofile.c
+++ b/src/util/virnetdevvportprofile.c
@@ -1071,6 +1071,9 @@ virNetDevVPortProfileOp8021Qbg(const char *ifname,
case VIR_NETDEV_VPORT_PROFILE_LINK_OP_PREASSOCIATE:
op = PORT_REQUEST_PREASSOCIATE;
break;
+ case VIR_NETDEV_VPORT_PROFILE_LINK_OP_PREASSOCIATE_RR:
+ op = PORT_REQUEST_PREASSOCIATE_RR;
+ break;
case VIR_NETDEV_VPORT_PROFILE_LINK_OP_ASSOCIATE:
op = PORT_REQUEST_ASSOCIATE;
break;
@@ -1191,10 +1194,16 @@ virNetDevVPortProfileOp8021Qbh(const char *ifname,
false);
break;
- default:
+ case VIR_NETDEV_VPORT_PROFILE_LINK_OP_PREASSOCIATE:
virReportError(VIR_ERR_INTERNAL_ERROR,
_("operation type %d not supported"), virtPortOp);
rc = -1;
+ break;
+ default:
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Unexpected operation type %d"), virtPortOp);
+ rc = -1;
+ break;
}
cleanup:
diff --git a/src/vmx/vmx.c b/src/vmx/vmx.c
index 7a749f93a..5855a11c8 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 ca3b4dee6..c3fe5d39d 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 2ef80eb83..e61784aff 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;
}
}
diff --git a/tools/virt-host-validate-qemu.c b/tools/virt-host-validate-qemu.c
index 2aa396e3a..d7573ea8b 100644
--- a/tools/virt-host-validate-qemu.c
+++ b/tools/virt-host-validate-qemu.c
@@ -33,13 +33,14 @@ int virHostValidateQEMU(void)
int ret = 0;
bool hasHwVirt = false;
bool hasVirtFlag = false;
+ virArch arch = virArchFromHost();
const char *kvmhint = _("Check that CPU and firmware supports virtualization
"
"and kvm module is loaded");
if (!(flags = virHostValidateGetCPUFlags()))
return -1;
- switch (virArchFromHost()) {
+ switch ((int)arch) {
case VIR_ARCH_I686:
case VIR_ARCH_X86_64:
hasVirtFlag = true;
--
2.16.1