]> xenbits.xensource.com Git - libvirt.git/commitdiff
maint: enforce previous if-else {} cleanups
authorEric Blake <eblake@redhat.com>
Wed, 3 Sep 2014 17:17:01 +0000 (11:17 -0600)
committerEric Blake <eblake@redhat.com>
Thu, 4 Sep 2014 20:36:04 +0000 (14:36 -0600)
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

diff --git a/cfg.mk b/cfg.mk
index 307009e54b52dc5e3f3be2b78aa1dde8b8686d72..122cf58c00a542bc4e0875532d0f6e432e251cd2 100644 (file)
--- 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)
+
 sc_curly_braces_style:
        @files=$$($(VC_LIST_EXCEPT) | grep '\.[ch]$$');                \
        $(GREP) -nHP                                                   \