Ensure all enum cases are listed in switch statements. Reviewed-by: John Ferlan <jferlan@xxxxxxxxxx> Signed-off-by: Daniel P. Berrangé <berrange@xxxxxxxxxx> --- src/util/virconf.c | 11 ++++++++++- src/util/virfirewall.c | 6 ++++-- src/util/virlog.c | 9 ++++++++- src/util/virnetdevvportprofile.c | 10 +++++++++- 4 files changed, 31 insertions(+), 5 deletions(-) diff --git a/src/util/virconf.c b/src/util/virconf.c index a82a509ca3..e0a3fd12c0 100644 --- a/src/util/virconf.c +++ b/src/util/virconf.c @@ -296,7 +296,9 @@ virConfSaveValue(virBufferPtr buf, virConfValuePtr val) virBufferAddLit(buf, " ]"); break; } + case VIR_CONF_LAST: default: + virReportEnumRangeError(virConfType, val->type); return -1; } return 0; @@ -986,13 +988,20 @@ 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: + virReportEnumRangeError(virConfType, cval->type); + return -1; } return 1; diff --git a/src/util/virfirewall.c b/src/util/virfirewall.c index ff1bb83073..10c370a2ae 100644 --- a/src/util/virfirewall.c +++ b/src/util/virfirewall.c @@ -827,9 +827,11 @@ 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")); + virReportEnumRangeError(virFirewallBackend, currentBackend); return -1; } diff --git a/src/util/virlog.c b/src/util/virlog.c index 4f66cc5e5c..6c6d7e8ded 100644 --- a/src/util/virlog.c +++ b/src/util/virlog.c @@ -1206,10 +1206,17 @@ 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: + virReportEnumRangeError(virLogDestination, dest); + virLogUnlock(); + return NULL; } } virLogUnlock(); diff --git a/src/util/virnetdevvportprofile.c b/src/util/virnetdevvportprofile.c index db495a7549..dc774407df 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,15 @@ 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: + virReportEnumRangeError(virNetDevVPortProfile, virtPortOp); + rc = -1; + break; } cleanup: -- 2.14.3 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list