[libvirt] [PATCH 2/2] maint: update syntax-check rule to also catch test's -o operator

Jim Meyering jim at meyering.net
Thu Mar 25 08:22:20 UTC 2010


Eric Blake wrote:
> * cfg.mk (sc_prohibit_test_minus_a): Rename...
> (sc_prohibit_test_minus_ao): ...and flag '-o', too.
> ---
>  cfg.mk |    7 +++++--
>  1 files changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/cfg.mk b/cfg.mk
> index 4302338..27cfca4 100644
> --- a/cfg.mk
> +++ b/cfg.mk
> @@ -269,11 +269,14 @@ sc_preprocessor_indentation:
>  	  echo '$(ME): skipping test $@: cppi not installed' 1>&2;	\
>  	fi
>
> -# Using test's -a operator is not portable.
> -sc_prohibit_test_minus_a:
> +# Using test's -a and -o operators is not portable.
> +sc_prohibit_test_minus_ao:
>  	@re='\<test .+ -[a] '						\
>  	msg='use "test C1 && test C2, not "test C1 -''a C2"'		\
>  	  $(_prohibit_regexp)
> +	@re='\<test .+ -[o] '						\
> +	msg='use "test C1 || test C2, not "test C1 -''o C2"'		\
> +	  $(_prohibit_regexp)

I actually wrote a separate target before I saw you'd done it.  Seeing
yours, I realize that both tests do belong in the same rule, but would
prefer the efficiency of combining the searches, so that we don't make
two passes through all sources, when one will do.  Then the only trick is
to produce a combined diagnostic.  Maybe like this (thought the resulting
line is too long -- for a diagnostic it's not a big deal).

_m1 = use "test C1 && test C2, not "test C1 -''a C2"
_m2 = use "test C1 || test C2, not "test C1 -''o C2"

sc_prohibit_test_minus_ao:
   	@re='\<test .+ -[ao] '						\
   	msg='$(_m1); $(_m2)'						\
   	  $(_prohibit_regexp)




More information about the libvir-list mailing list