]> Git Repo - qemu.git/blobdiff - scripts/checkpatch.pl
lsi53c895a: convert to trace-events
[qemu.git] / scripts / checkpatch.pl
index cb1b652388fdb98b25ac96df14e8d1986da6e0a5..3765b0e35e23c37aca097cc1441395f6dd8bd0c6 100755 (executable)
@@ -242,6 +242,7 @@ our $UTF8   = qr{
 # There are still some false positives, but this catches most
 # common cases.
 our $typeTypedefs = qr{(?x:
+        (?![KMGTPE]iB)                      # IEC binary prefix (do not match)
         [A-Z][A-Z\d_]*[a-z][A-Za-z\d_]*     # camelcase
         | [A-Z][A-Z\d_]*AIOCB               # all uppercase
         | [A-Z][A-Z\d_]*CPU                 # all uppercase
@@ -271,7 +272,7 @@ our @typeList = (
        qr{hwaddr},
         # external libraries
        qr{xml${Ident}},
-       qr{xendevicemodel_handle},
+       qr{xen\w+_handle},
        # Glib definitions
        qr{gchar},
        qr{gshort},
@@ -1131,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) {
@@ -1145,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);
@@ -1367,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 '' &&
@@ -1929,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.025485 seconds and 4 git commands to generate.