On Monday 2008-04-28 22:47, Rogan Dawes wrote:Even so, the regexes are not entirely accurate. Patch below. === commit e08a94e334d67ac5f2437c8aba4c6ffbb058d7db Author: Jan Engelhardt <jengelh@medozas.de> Date: Tue Apr 29 00:06:42 2008 +0200 checkpatch: fix recognition of preprocessor directives Signed-off-by: Jan Engelhardt <jengelh@medozas.de> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 58a9494..22df611 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -355,12 +355,12 @@ sub sanitise_line { } # The pathname on a #include may be surrounded by '<' and '>'. - if ($res =~ /^.#\s*include\s+\<(.*)\>/) { + if ($res =~ /^.\s*#\s*include\s+\<(.*)\>/) { my $clean = 'X' x length($1); $res =~ s@\<.*\>@<$clean>@; # The whole of a #error is a string. - } elsif ($res =~ /^.#\s*(?:error|warning)\s+(.*)\b/) { + } elsif ($res =~ /^.\s*#\s*(?:error|warning)\s+(.*)\b/) { my $clean = 'X' x length($1); $res =~ s@(#\s*(?:error|warning)\s+).*@$1$clean@; } @@ -1194,7 +1194,7 @@ sub process { # if/while/etc brace do not go on next line, unless defining a do while loop, # or if that brace on the next line is for something else - if ($line =~ /(.*)\b((?:if|while|for|switch)\s*\(|do\b|else\b)/ && $line !~ /^.#/) { + if ($line =~ /(.*)\b((?:if|while|for|switch)\s*\(|do\b|else\b)/ && $line !~ /^.\s*#/) { my $pre_ctx = "$1$2"; my ($level, @ctx) = ctx_statement_level($linenr, $realcnt, 0); @@ -1877,7 +1877,7 @@ sub process { } # warn about #if 0 - if ($line =~ /^.#\s*if\s+0\b/) { + if ($line =~ /^.\s*#\s*if\s+0\b/) { CHK("if this code is redundant consider removing it\n" . $herecurr); } @@ -1891,14 +1891,14 @@ sub process { } # warn about #ifdefs in C files -# if ($line =~ /^.#\s*if(|n)def/ && ($realfile =~ /\.c$/)) { +# if ($line =~ /^.\s*#\s*if(|n)def/ && ($realfile =~ /\.c$/)) { # print "#ifdef in C files should be avoided\n"; # print "$herecurr"; # $clean = 0; # } # warn about spacing in #ifdefs - if ($line =~ /^.#\s*(ifdef|ifndef|elif)\s\s+/) { + if ($line =~ /^.\s*#\s*(ifdef|ifndef|elif)\s\s+/) { ERROR("exactly one space required after that #$1\n" . $herecurr); } @@ -1972,7 +1972,7 @@ sub process { # use of NR_CPUS is usually wrong # ignore definitions of NR_CPUS and usage to define arrays as likely right if ($line =~ /\bNR_CPUS\b/ && - $line !~ /^.#\s*define\s+NR_CPUS\s+/ && + $line !~ /^.\s*#\s*define\s+NR_CPUS\s+/ && $line !~ /^.\s*$Declare\s.*\[[^\]]*NR_CPUS[^\]]*\]/) { WARN("usage of NR_CPUS is often wrong - consider using cpu_possible(), num_possible_cpus(), for_each_possible_cpu(), etc\n" . $herecurr); --
| jmerkey | [ANNOUNCE] mdb: Merkey's Linux Kernel Debugger 2.6.27-rc4 released |
| Valdis.Kletnieks | Re: [RFC/PATCH] Documentation of kernel messages |
| Greg Kroah-Hartman | [PATCH 004/196] Chinese: add translation of SubmittingPatches |
| Christoph Lameter | [04/14] vcompound: Core piece |
git: | |
| Ken Pratt | pack operation is thrashing my server |
| Peter Stahlir | Git as a filesystem |
| Kyle Moffett | Using GIT to store /etc (Or: How to make GIT store all file permission bits) |
| Francis Moreau | What about git cp ? |
| Richard Stallman | Real men don't attack straw men |
| GVG GVG | ssh_exchange_identification: Connection closed by remote host |
| Girish Venkatachalam | Ethernet jumbo frames? |
| L. V. Lammert | Re: How to find all package files |
| Christoph Hellwig | Re: silent semantic changes with reiser4 |
| Al Boldi | Re: [RFD] Incremental fsck |
| Jens Axboe | Re: [PATCH][RFC] fast file mapping for loop |
| Ian Kent | Re: [PATCH 2/4] autofs4 - track uid and gid of last mount requester |
