]> xenbits.xensource.com Git - libvirt.git/commitdiff
syntax-check: ignore all quoted strings in bracket-spacing
authorJán Tomko <jtomko@redhat.com>
Fri, 24 May 2013 08:50:42 +0000 (10:50 +0200)
committerJán Tomko <jtomko@redhat.com>
Fri, 24 May 2013 13:57:45 +0000 (15:57 +0200)
Ignore strings with an escaped double quote too.

This removes the need for special handling of quotes in the
semicolon check.

build-aux/bracket-spacing.pl

index fbe66669eacd06cfc1531def9ace643f9742e366..2eeeeb463af8d5342dad8b566463df21fdd7ade8 100755 (executable)
@@ -31,8 +31,8 @@ foreach my $file (@ARGV) {
     while (defined (my $line = <FILE>)) {
         my $data = $line;
 
-        # Kill any quoted strongs
-        $data =~ s,".*?","XXX",g;
+        # Kill any quoted strings
+        $data =~ s,"([^\\\"]|\\.)*","XXX",g;
 
         # Kill any C++ style comments
         $data =~ s,//.*$,//,;
@@ -120,14 +120,9 @@ foreach my $file (@ARGV) {
         #          errno == EINTR)
         #       ;
         #
-        # 3) ";" is inside double-quote, I.e, as part of const string. E.g.
-        #   printf("%s", "a ; b\n");
         while ($data =~ /[^;\s]\s+;/) {
-            # Inside the double-quote
-            if ($data !~ /"[^"]*\s;/) {
-                print "$file:$.: $line";
-                $ret = 1;
-            }
+            print "$file:$.: $line";
+            $ret = 1;
             last;
         }
     }