]> xenbits.xensource.com Git - libvirt.git/commitdiff
check-spacing: rewrite whitespace check before (semi)colon
authorJán Tomko <jtomko@redhat.com>
Tue, 14 Jun 2016 16:13:42 +0000 (18:13 +0200)
committerJán Tomko <jtomko@redhat.com>
Wed, 15 Jun 2016 13:07:47 +0000 (15:07 +0200)
Instead of matching multiple characters, match any occurrence
preceded by a single whitespace and handle the exceptions
later.

build-aux/check-spacing.pl

index 83b58987b2275677f478ceabd4ad963f222c91eb..d693fbe572298eabb3f8d7b7d6ccd621e2e7e1a6 100755 (executable)
@@ -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 ";".