Skip to content

Commit 8c8c45c

Browse files
JoePerchestorvalds
authored andcommitted
checkpatch: fix macro argument reuse test
Multiple line macro definitions where the arguments are separated by line continuations can cause checkpatch to emit invalid syntax regex tests. This can occur when a single argument is modified in a part of a patch. For example: (to not add a diff in the commit message) $ ./scripts/checkpatch.pl --git db02329 Unterminated \g... pattern in regex; <very long regex omitted> And, the test does not work correctly when these arguments are all new as the initial patch line addition "+" is used in the argument name. Fix this by stripping the line continuations and any "+" from the list of arguments. Link: http://lkml.kernel.org/r/86cdb43a4db70670c102020093f7fb4eb3003e01.camel@perches.com Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent cd26149 commit 8c8c45c

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

scripts/checkpatch.pl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4967,6 +4967,7 @@ sub process {
49674967
if (defined $define_args && $define_args ne "") {
49684968
$define_args = substr($define_args, 1, length($define_args) - 2);
49694969
$define_args =~ s/\s*//g;
4970+
$define_args =~ s/\\\+?//g;
49704971
@def_args = split(",", $define_args);
49714972
}
49724973

0 commit comments

Comments
 (0)