mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] checkpatch: Fix macro argument reuse test
@ 2018-07-15 16:34 Joe Perches
  0 siblings, 0 replies; only message in thread
From: Joe Perches @ 2018-07-15 16:34 UTC (permalink / raw)
  To: Andrew Morton; +Cc: LKML, Andy Whitcroft

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 db023296f0115d2fe01fdabad54678f2b806da23
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.

Signed-off-by: Joe Perches <joe@perches.com>
---
 scripts/checkpatch.pl | 1 +
 1 file changed, 1 insertion(+)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index b5c875d7132b..fa29aebff5a1 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -4950,6 +4950,7 @@ sub process {
 			if (defined $define_args && $define_args ne "") {
 				$define_args = substr($define_args, 1, length($define_args) - 2);
 				$define_args =~ s/\s*//g;
+				$define_args =~ s/\\\+?//g;
 				@def_args = split(",", $define_args);
 			}
 

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2018-07-15 16:34 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-15 16:34 [PATCH] checkpatch: Fix macro argument reuse test Joe Perches

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®