[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH 6/6] maint: enforce previous if-else {} cleanups



On 09/03/14 23:25, Eric Blake wrote:
> Done as a separate commit in case earlier cleanups are backported
> independently.
> 
> * cfg.mk (sc_require_space_before_label): New rule.
> 
> Signed-off-by: Eric Blake <eblake redhat com>
> ---
>  cfg.mk | 7 +++++++
>  1 file changed, 7 insertions(+)

Doesn't apply cleanly if your "hanging brace" series patch 2/2 is applied.

> 
> diff --git a/cfg.mk b/cfg.mk
> index 307009e..122cf58 100644
> --- a/cfg.mk
> +++ b/cfg.mk
> @@ -910,6 +910,13 @@ sc_require_space_before_label:
>  	halt="Top-level labels should be indented by one space"        \
>  	  $(_sc_search_regexp)
> 
> +# Doesn't catch all cases of mismatched braces across if-else, but it helps
> +sc_require_if_else_matching_braces:
> +	@prohibit='(  else( if .*\))? {|} else( if .*\))?$$)'		\
> +	in_vc_files='\.[chx]$$'						\
> +	halt="if one side of if-else uses {}, both sides must use it"	\
> +	  $(_sc_search_regexp)

Seems to do the right thing, but my regex-fu isn't that strong so I
might have missed something.
> +
>  sc_curly_braces_style:
>  	@files=$$($(VC_LIST_EXCEPT) | grep '\.[ch]$$');                \
>  	$(GREP) -nHP                                                   \
> 

ACK

Peter

Attachment: signature.asc
Description: OpenPGP digital signature


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]