On Thu, Feb 15, 2018 at 04:43:07PM +0000, Daniel P. Berrangé wrote:
Ensure all enum cases are listed in switch statements.
Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
src/util/virconf.c | 13 ++++++++++++-
src/util/virfirewall.c | 7 +++++--
src/util/virlog.c | 10 +++++++++-
src/util/virnetdevvportprofile.c | 11 ++++++++++-
4 files changed, 36 insertions(+), 5 deletions(-)
diff --git a/src/util/virconf.c b/src/util/virconf.c
index a82a509ca3..af806dd735 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;
All these errors are presumably dead code that we only keep around in
case we broke something in other parts of the code.
Do we need specific user-friendly translated errors? Since we log the
function name as well, something like: "unhandled enum value %d" would
do.
Jan
}
return 0;