Skip to contentSkip to conversation

Check patch reports multiple var with a function assignment

PATCH In review Jason Wessel 2 participants 2 messages Jul 31, 2007 Checkpatch

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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 --

scripts/checkpatch.pl +0 -0
index 73751ab..32c6d74 100755
@@ -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);
               }
#1 lore raw
Quoted 3 lines · Jason Wessel

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.

Thanks for the patch. We had already caught this one and the test itself now is likely to be shelved, a new release with this update in is iminent.

-apw