]> git.proxmox.com Git - mirror_qemu.git/blobdiff - scripts/checkpatch.pl
Merge remote-tracking branch 'remotes/berrange-gitlab/tags/misc-next-pull-request...
[mirror_qemu.git] / scripts / checkpatch.pl
index 2d2e922d89cd4c9a272915ec127367c064b667a0..88c858f67cbb13de1c87adafb08a4f02d2d2f92f 100755 (executable)
@@ -49,7 +49,7 @@ Version: $V
 
 Options:
   -q, --quiet                quiet
-  --no-tree                  run without a kernel tree
+  --no-tree                  run without a qemu tree
   --no-signoff               do not check for 'Signed-off-by' line
   --patch                    treat FILE as patchfile
   --branch                   treat args as GIT revision list
@@ -57,7 +57,7 @@ Options:
   --terse                    one line per report
   -f, --file                 treat FILE as regular source file
   --strict                   fail if only warnings are found
-  --root=PATH                PATH to the kernel tree root
+  --root=PATH                PATH to the qemu tree root
   --no-summary               suppress the per-file summary
   --mailback                 only produce a report in case of warnings/errors
   --summary-file             include the filename in summary
@@ -203,7 +203,7 @@ if ($tree) {
        }
 
        if (!defined $root) {
-               print "Must be run from the top-level dir. of a kernel tree\n";
+               print "Must be run from the top-level dir. of a qemu tree\n";
                exit(2);
        }
 }
@@ -392,7 +392,7 @@ if ($chk_branch) {
 
        close $HASH;
 
-       die "$P: no revisions returned for revlist '$chk_branch'\n"
+       die "$P: no revisions returned for revlist '$ARGV[0]'\n"
            unless @patches;
 
        my $i = 1;
@@ -1659,7 +1659,7 @@ sub process {
 # tabs are only allowed in assembly source code, and in
 # some scripts we imported from other projects.
                next if ($realfile =~ /\.(s|S)$/);
-               next if ($realfile =~ /(checkpatch|get_maintainer|texi2pod)\.pl$/);
+               next if ($realfile =~ /(checkpatch|get_maintainer)\.pl$/);
 
                if ($rawline =~ /^\+.*\t/) {
                        my $herevet = "$here\n" . cat_vet($rawline) . "\n";
@@ -1870,7 +1870,7 @@ sub process {
                        substr($s, 0, length($c), '');
 
                        # Make sure we remove the line prefixes as we have
-                       # none on the first line, and are going to readd them
+                       # none on the first line, and are going to re-add them
                        # where necessary.
                        $s =~ s/\n./\n/gs;
 
@@ -2880,14 +2880,20 @@ sub process {
                                $herecurr);
                }
 
-# check for %L{u,d,i} in strings
+# format strings checks
                my $string;
                while ($line =~ /(?:^|")([X\t]*)(?:"|$)/g) {
                        $string = substr($rawline, $-[1], $+[1] - $-[1]);
                        $string =~ s/%%/__/g;
+                       # check for %L{u,d,i} in strings
                        if ($string =~ /(?<!%)%L[udi]/) {
                                ERROR("\%Ld/%Lu are not-standard C, use %lld/%llu\n" . $herecurr);
-                               last;
+                       }
+                       # check for %# or %0# in printf-style format strings
+                       if ($string =~ /(?<!%)%0?#/) {
+                               ERROR("Don't use '#' flag of printf format " .
+                                     "('%#') in format strings, use '0x' " .
+                                     "prefix instead\n" . $herecurr);
                        }
                }
 
@@ -3005,7 +3011,7 @@ sub process {
                return 1;
        }
 
-       if (!$is_patch) {
+       if (!$is_patch && $filename !~ /cover-letter\.patch$/) {
                ERROR("Does not appear to be a unified-diff format patch\n");
        }