[libvirt] [PATCH 2/2] maint: syntax check for double semicolons

Nehal J Wani nehaljw.kkd1 at gmail.com
Thu Sep 4 15:55:06 UTC 2014


On Thu, Sep 4, 2014 at 8:32 PM, Eric Blake <eblake at redhat.com> wrote:
> Commit 28de556 fixed some doubled semicolons, but failed to
> add a syntax check, and thereby missed another instance. This
> finishes the job (and also found an instance in gnulib, prior
> to the previous patch's submodule update).
>
> * cfg.mk (sc_prohibit_double_semicolon): New rule.
> * src/xenconfig/xen_common.c (xenFormatConfigCommon): Fix offender.
>
> Signed-off-by: Eric Blake <eblake at redhat.com>
> ---
>  cfg.mk                     | 8 ++++++++
>  src/xenconfig/xen_common.c | 2 +-
>  2 files changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/cfg.mk b/cfg.mk
> index 77f1868..0a4395b 100644
> --- a/cfg.mk
> +++ b/cfg.mk
> @@ -803,6 +803,14 @@ sc_prohibit_semicolon_at_eol_in_python:
>         halt="Don't use semicolon at eol in python files"               \
>           $(_sc_search_regexp)
>
> +# Except for shell files and for loops, double semicolon is probably a mistake
> +sc_prohibit_double_semicolon:
> +       @prohibit=';;'                                                  \
> +       in_files='\.[chx]$$'                                            \
> +       exclude='for \(.*\)'                                            \
> +       halt="Double semicolon detected"                                \
> +         $(_sc_search_regexp)
> +
>  # mymain() in test files should use return, not exit, for nicer output
>  sc_prohibit_exit_in_tests:
>         @prohibit='\<exit *\('                                          \
> diff --git a/src/xenconfig/xen_common.c b/src/xenconfig/xen_common.c
> index accd25f..bab67de 100644
> --- a/src/xenconfig/xen_common.c
> +++ b/src/xenconfig/xen_common.c
> @@ -2034,7 +2034,7 @@ xenFormatConfigCommon(virConfPtr conf,
>          return -1;
>
>      if (xenFormatCPUFeatures(conf, def, xendConfigVersion) < 0)
> -        return -1;;
> +        return -1;
>
>      if (xenFormatCDROM(conf, def, xendConfigVersion) < 0)
>          return -1;
> --
> 1.9.3
>
> --
> libvir-list mailing list
> libvir-list at redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list

ACK


-- 
Nehal J Wani




More information about the libvir-list mailing list