lkml.org 
[lkml]   [2007]   [Jul]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] Check patch reports multiple var with a function assignment
Running checkpatch.pl products an warning when it should not.  I believe 
it can be fixed by adding to the regular expression, but feel free to
fix it another way as I may not know all the cases this is trying to catch.

-- check patch output --
WARNING: declaring multiple variables together should be avoided
#451: FILE: drivers/serial/8250.c:1685:
+ unsigned char lsr = serial_inp(up, UART_LSR);

-- end check patch output --

Signed-off-by: Jason Wessel <jason.wessel@windriver.com>

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 73751ab..32c6d74 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -825,8 +825,8 @@ sub process {

# check for multiple declarations, allowing for a function declaration
# continuation.
- if ($line =~
/^.\s*$Type\s+$Ident(?:\s*=[^,{]*)?\s*,\s*$Ident.*/ &&
- $line !~
/^.\s*$Type\s+$Ident(?:\s*=[^,{]*)?\s*,\s*$Type\s*$Ident.*/) {
+ if ($line =~
/^.\s*$Type\s+$Ident(?:\s*=[^,{\(]*)?\s*,\s*$Ident.*/ &&
+ $line !~
/^.\s*$Type\s+$Ident(?:\s*=[^,{\(]*)?\s*,\s*$Type\s*$Ident.*/) {
WARN("declaring multiple variables together
should be avoided\n" . $herecurr);
}

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
\
 
 \ /
  Last update: 2007-07-31 04:49    [from the cache]
©2003-2011 Jasper Spaans