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
--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
}
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);
}
}
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;
my @tree_check = (
"COPYING", "MAINTAINERS", "Makefile",
"README.rst", "docs", "VERSION",
- "vl.c"
+ "linux-user", "softmmu"
);
foreach my $check (@tree_check) {
}
}
+# According to tests/qtest/bios-tables-test.c: do not
+# change expected file in the same commit with adding test
+sub checkfilename {
+ my ($name, $acpi_testexpected, $acpi_nontestexpected) = @_;
+
+ # Note: shell script that rebuilds the expected files is in the same
+ # directory as files themselves.
+ # Note: allowed diff list can be changed both when changing expected
+ # files and when changing tests.
+ if ($name =~ m#^tests/data/acpi/# and not $name =~ m#^\.sh$#) {
+ $$acpi_testexpected = $name;
+ } elsif ($name !~ m#^tests/qtest/bios-tables-test-allowed-diff.h$#) {
+ $$acpi_nontestexpected = $name;
+ }
+ if (defined $$acpi_testexpected and defined $$acpi_nontestexpected) {
+ ERROR("Do not add expected files together with tests, " .
+ "follow instructions in " .
+ "tests/qtest/bios-tables-test.c: both " .
+ $$acpi_testexpected . " and " .
+ $$acpi_nontestexpected . " found\n");
+ }
+}
+
sub process {
my $filename = shift;
my %suppress_whiletrailers;
my %suppress_export;
+ my $acpi_testexpected;
+ my $acpi_nontestexpected;
+
# Pre-scan the patch sanitizing the lines.
sanitise_line_reset();
if ($line =~ /^diff --git.*?(\S+)$/) {
$realfile = $1;
$realfile =~ s@^([^/]*)/@@ if (!$file);
+ checkfilename($realfile, \$acpi_testexpected, \$acpi_nontestexpected);
} elsif ($line =~ /^\+\+\+\s+(\S+)/) {
$realfile = $1;
$realfile =~ s@^([^/]*)/@@ if (!$file);
+ checkfilename($realfile, \$acpi_testexpected, \$acpi_nontestexpected);
$p1_prefix = $1;
if (!$file && $tree && $p1_prefix ne '' &&
# 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";
ERROR("suspicious ; after while (0)\n" . $herecurr);
}
+# Check superfluous trailing ';'
+ if ($line =~ /;;$/) {
+ ERROR("superfluous trailing semicolon\n" . $herecurr);
+ }
+
# Check relative indent for conditionals and blocks.
if ($line =~ /\b(?:(?:if|while|for)\s*\(|do\b)/ && $line !~ /^.\s*#/ && $line !~ /\}\s*while\s*/) {
my ($s, $c) = ($stat, $cond);
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;
$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);
}
}
return 1;
}
- if (!$is_patch) {
+ if (!$is_patch && $filename !~ /cover-letter\.patch$/) {
ERROR("Does not appear to be a unified-diff format patch\n");
}