Re: [PATCH] update checkpatch.pl to version 0.03

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Jun 4 2007 10:46, Andy Whitcroft wrote:
>
>  - catch use of volatile

Speaking of volatile, "register" is probably just as unwanted.
Then, "extern inline" is one thing to catch (does not happen
that often, but it does not cost too much either).

>  - warn about #ifdef's in c files

Really? There are a lot of ifdefs in existing code, and it is
probably inevitable to add some in newer code ... overall
leading to more false positives and cluttering the output.
Or am I gone wrong somewhere?

>+
>+		} elsif (/^Funcs:\s+(.*\S)/) {
>+			for my $func (split(/[, ]+/, $1)) {
>+				push(@dep_functions, $func);
>+			}

for -> foreach, although it does not functionally change anything.
Yeah, Perl is funny, for(one arg) is actually foreach().
Quite confusing to for(three args).

>+sub line_stats {
                ^ = \n ?

>+		last if (scalar(@o) == scalar(@c));

Or last if $#o == $#c. Again, personal taste (=do it your way).
I do not think $#a is any cheaper than scalar(@a) anyway.

>+sub has_non_quoted {
>+	return ($_[0] =~ m{$_[1]} and $_[0] !~ m{\".*$_[1].*\"});
>+}

Safe? Or intended? Did you want to allow regexes?
Otherwise...

	return $_[0] =~ /\Q$_[1]\E/ && $_[0] !~ /".*\Q$_[1]\E.*"/;

> 			if (!($line =~ /^\s*Signed-off-by:/)) {
                            ^       ^^
 => if($line !~ /.../)
Gotta love perl. Perhaps one language where you'll always find a
way to circumvent any CodingStyle ever written :p

> #80 column limit
>-		if (!($prevline=~/\/\*\*/) && length($lineforcounting) > 80) {
>+		if (!($prevline=~/\/\*\*/) && $length > 80) {

I say thee 79. But we had that more or less already.

>+			for my $ctx (@ctx) {

>-			while ($remaining > 0 && scalar @opened > scalar @closed) {
>+			while ($remaining > 1 && scalar @opened > scalar @closed) {

Although scalar might bind as hard as sizeof in C, I suggest parentheses.
(Or $#)

	while ($remaining > 1 && scalar(@opened) > scalar(@closed))

>+# warn about #ifdefs in C files
>+		if ($line =~ /^.#\s*if(|n)def/ && ($realfile =~ /\.c$/)) {

save a capture operation:	/^.#\s*ifn?def/



	Jan
-- 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux