]> Git Repo - qemu.git/blobdiff - scripts/checkpatch.pl
lsi53c895a: convert to trace-events
[qemu.git] / scripts / checkpatch.pl
index 223681bfd0155ce148bc353bd766e07dd8c58fa4..3765b0e35e23c37aca097cc1441395f6dd8bd0c6 100755 (executable)
@@ -1132,11 +1132,10 @@ sub possible {
                        case|
                        else|
                        asm|__asm__|
-                       do|
-                       \#|
-                       \#\#
+                       do
                )(?:\s|$)|
-               ^(?:typedef|struct|enum)\b
+               ^(?:typedef|struct|enum)\b|
+               ^\#
            )}x;
        warn "CHECK<$possible> ($line)\n" if ($dbg_possible > 2);
        if ($possible !~ $notPermitted) {
@@ -1146,7 +1145,7 @@ sub possible {
                if ($possible =~ /^\s*$/) {
 
                } elsif ($possible =~ /\s/) {
-                       $possible =~ s/\s*$Type\s*//g;
+                       $possible =~ s/\s*(?:$Type|\#\#)\s*//g;
                        for my $modifier (split(' ', $possible)) {
                                if ($modifier !~ $notPermitted) {
                                        warn "MODIFIER: $modifier ($possible) ($line)\n" if ($dbg_possible);
@@ -1368,10 +1367,10 @@ sub process {
                # extract the filename as it passes
                if ($line =~ /^diff --git.*?(\S+)$/) {
                        $realfile = $1;
-                       $realfile =~ s@^([^/]*)/@@;
+                       $realfile =~ s@^([^/]*)/@@ if (!$file);
                } elsif ($line =~ /^\+\+\+\s+(\S+)/) {
                        $realfile = $1;
-                       $realfile =~ s@^([^/]*)/@@;
+                       $realfile =~ s@^([^/]*)/@@ if (!$file);
 
                        $p1_prefix = $1;
                        if (!$file && $tree && $p1_prefix ne '' &&
@@ -1930,9 +1929,8 @@ sub process {
                        my ($where, $prefix) = ($-[1], $1);
                        if ($prefix !~ /$Type\s+$/ &&
                            ($where != 0 || $prefix !~ /^.\s+$/) &&
-                           $prefix !~ /{\s+$/ &&
                            $prefix !~ /\#\s*define[^(]*\([^)]*\)\s+$/ &&
-                           $prefix !~ /,\s+$/) {
+                           $prefix !~ /[,{:]\s+$/) {
                                ERROR("space prohibited before open square bracket '['\n" . $herecurr);
                        }
                }
This page took 0.032613 seconds and 4 git commands to generate.