From: Ján Tomko Date: Tue, 14 Jun 2016 16:13:42 +0000 (+0200) Subject: check-spacing: rewrite whitespace check before (semi)colon X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=b953e163ad12602c0046cb3600fcd1eb6fec4862;p=libvirt.git check-spacing: rewrite whitespace check before (semi)colon Instead of matching multiple characters, match any occurrence preceded by a single whitespace and handle the exceptions later. --- diff --git a/build-aux/check-spacing.pl b/build-aux/check-spacing.pl index 83b58987b2..d693fbe572 100755 --- a/build-aux/check-spacing.pl +++ b/build-aux/check-spacing.pl @@ -135,10 +135,13 @@ foreach my $file (@ARGV) { # errno == EINTR) # ; # - if ($data =~ /[^;\s]\s+[;,]/) { - print "Whitespace before (semi)colon:\n"; - print "$file:$.: $line"; - $ret = 1; + if ($data =~ /\s[;,]/) { + unless ($data =~ /\S; ; / || + $data =~ /^\s+;/) { + print "Whitespace before (semi)colon:\n"; + print "$file:$.: $line"; + $ret = 1; + } } # Require EOL, macro line continuation, or whitespace after ";".