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

Peter Krempa pkrempa at redhat.com
Mon Mar 25 16:31:55 UTC 2013


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




More information about the libvir-list mailing list