Message ID | AANLkTik_jC62pdS9RR-WPOm2iPFxmXhrxB52ZfzBh5rU@mail.gmail.com |
---|---|
State | New |
Headers | show |
Am 09.01.2011 14:24, Blue Swirl wrote: > On Sun, Jan 9, 2011 at 1:01 PM, Stuart Brady <sdb@zubnet.me.uk> wrote: >> On Sun, Jan 09, 2011 at 11:46:33AM +0000, Blue Swirl wrote: >>> Change checkpatch.pl for QEMU use: >>> - Root directory detection >>> - Forbid tabs >>> - Indent at 4 spaces >>> - Allow typedefs >>> - Enforce brace use even for single statement blocks >>> - Don't suggest nonexistent cleanup tools > > BTW, I checked the last 99 commits with the script. The only real > problems I saw were that the script complains that CPP #if statements > are missing braces and the tabs check fires also for old code. I bet that's fixable with a few additional checks. :) > > for i in '' 1 2 3 4 5 6 7 8 9; do for j in 0 1 2 3 4 5 6 7 8 9; do > echo $i$j; git show HEAD~$i$j >a; clear;cat a; perl > checkpatch.pl-0.31+QEMU --root=. a; read foo; done; done > >> Could you separate out the coding style changes, please? >> >> Otherwise, it's just 2900 lines added and 2900 lines removed. > > Does git-am understand patches in -M style? Is there a config option? Would be surprising if not. > > Here's the patch with rename detection on for easier commenting: Line-wrapped unfortunately. > diff --git a/checkpatch.pl-0.31 b/checkpatch.pl-0.31+QEMU > similarity index 97% > rename from checkpatch.pl-0.31 > rename to checkpatch.pl-0.31+QEMU I prefer to track the origin in git, not in the file name. For convenience, we need executable(!) checkpath.pl, at least a symbolic link to it. Otherwise, kudos for picking this up! Jan
diff --git a/checkpatch.pl-0.31 b/checkpatch.pl-0.31+QEMU similarity index 97% rename from checkpatch.pl-0.31 rename to checkpatch.pl-0.31+QEMU index cd51a65..8541916 100644 --- a/checkpatch.pl-0.31 +++ b/checkpatch.pl-0.31+QEMU @@ -328,9 +328,9 @@ sub top_of_kernel_tree { my ($root) = @_; my @tree_check = ( - "COPYING", "CREDITS", "Kbuild", "MAINTAINERS", "Makefile", - "README", "Documentation", "arch", "include", "drivers", - "fs", "init", "ipc", "kernel", "lib", "scripts", + "COPYING", "MAINTAINERS", "Makefile", + "README", "docs", "VERSION", + "vl.c" ); foreach my $check (@tree_check) { @@ -1494,31 +1494,13 @@ sub process { # check we are in a valid source file C or perl if not then ignore this hunk next if ($realfile !~ /\.(h|c|pl)$/); -# at the beginning of a line any tabs must come first and anything -# more than 8 must use tabs. - if ($rawline =~ /^\+\s* \t\s*\S/ || - $rawline =~ /^\+\s* \s*/) { +# in QEMU, no tabs are allowed + if ($rawline =~ /\t/) { my $herevet = "$here\n" . cat_vet($rawline) . "\n"; - ERROR("code indent should use tabs where possible\n" . $herevet); + ERROR("code indent should never use tabs\n" . $herevet); $rpt_cleaners = 1; } -# check for space before tabs. - if ($rawline =~ /^\+/ && $rawline =~ / \t/) { - my $herevet = "$here\n" . cat_vet($rawline) . "\n"; - WARN("please, no space before tabs\n" . $herevet); - } - -# check for spaces at the beginning of a line. -# Exceptions: -# 1) within comments -# 2) indented preprocessor commands -# 3) hanging labels - if ($rawline =~ /^\+ / && $line !~ /\+ *(?:$;|#|$Ident:)/) { - my $herevet = "$here\n" . cat_vet($rawline) . "\n"; - WARN("please, no spaces at the start of a line\n" . $herevet); - } - # check we are in a valid C source file if not then ignore this hunk