[libvirt] [PATCH] virsh: Let the compiler check usage of all fields in vshCmdOptType enum

Get rid of the "default" labels to do so. --- tools/virsh.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/tools/virsh.c b/tools/virsh.c index b574d7e..0a9ac6f 100644 --- a/tools/virsh.c +++ b/tools/virsh.c @@ -1172,8 +1172,6 @@ vshCmddefHelp(vshControl *ctl, const char *cmdname) case VSH_OT_ALIAS: /* aliases are intentionally undocumented */ continue; - default: - assert(0); } fputc(' ', stdout); fprintf(stdout, fmt, opt->name); @@ -1215,8 +1213,6 @@ vshCmddefHelp(vshControl *ctl, const char *cmdname) break; case VSH_OT_ALIAS: continue; - default: - assert(0); } fprintf(stdout, " %-15s %s\n", buf, _(opt->help)); -- 1.8.1.5

On 03/25/13 17:21, Peter Krempa wrote:
Get rid of the "default" labels to do so. --- tools/virsh.c | 4 ---- 1 file changed, 4 deletions(-)
diff --git a/tools/virsh.c b/tools/virsh.c index b574d7e..0a9ac6f 100644 --- a/tools/virsh.c +++ b/tools/virsh.c @@ -1172,8 +1172,6 @@ vshCmddefHelp(vshControl *ctl, const char *cmdname) case VSH_OT_ALIAS: /* aliases are intentionally undocumented */ continue; - default: - assert(0); } fputc(' ', stdout); fprintf(stdout, fmt, opt->name); @@ -1215,8 +1213,6 @@ vshCmddefHelp(vshControl *ctl, const char *cmdname) break; case VSH_OT_ALIAS: continue; - default: - assert(0); }
fprintf(stdout, " %-15s %s\n", buf, _(opt->help));
Hum, this patch removes the last two asserts from this file so syntax-check would fail with this patch. I squashed the removal of #include <assert.h> from virsh.c in my private branch. Peter

On 03/25/2013 10:31 AM, Peter Krempa wrote:
On 03/25/13 17:21, Peter Krempa wrote:
Get rid of the "default" labels to do so. --- tools/virsh.c | 4 ---- 1 file changed, 4 deletions(-)
case VSH_OT_ALIAS: continue; - default: - assert(0); }
fprintf(stdout, " %-15s %s\n", buf, _(opt->help));
Hum, this patch removes the last two asserts from this file so syntax-check would fail with this patch. I squashed the removal of
#include <assert.h>
from virsh.c in my private branch.
ACK with that squashed in. Safe to include in 1.0.4. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

On 03/25/13 19:11, Eric Blake wrote:
On 03/25/2013 10:31 AM, Peter Krempa wrote:
On 03/25/13 17:21, Peter Krempa wrote:
Get rid of the "default" labels to do so. --- tools/virsh.c | 4 ---- 1 file changed, 4 deletions(-)
case VSH_OT_ALIAS: continue; - default: - assert(0); }
fprintf(stdout, " %-15s %s\n", buf, _(opt->help));
Hum, this patch removes the last two asserts from this file so syntax-check would fail with this patch. I squashed the removal of
#include <assert.h>
from virsh.c in my private branch.
ACK with that squashed in. Safe to include in 1.0.4.
Pushed. Thanks. Peter
participants (2)
-
Eric Blake
-
Peter Krempa