All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] checkpatch: Improve quoted string and line continuation test
@ 2017-12-19 15:54 Joe Perches
  0 siblings, 0 replies; only message in thread
From: Joe Perches @ 2017-12-19 15:54 UTC (permalink / raw)
  To: Andrew Morton, Andy Whitcroft; +Cc: Heinrich Schuchardt, linux-kernel

Given this patch context,

+#define EFI_ST_DISK_IMG { \
+       0x00000240, "\xbe\x5b\x7c\xac\x22\xc0\x74\x0b" /* .[|.".t. */ \
+       }

the current code misreports a quoted string line continuation defect
as there is a single quote in comment.

The 'raw' line should not be tested for quote count, the comment
substituted line should be instead.

Reported-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Joe Perches <joe@perches.com>
---
 scripts/checkpatch.pl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 168687ae24fa..7c635146cb80 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -5312,7 +5312,7 @@ sub process {
 		}
 
 # check for line continuations in quoted strings with odd counts of "
-		if ($rawline =~ /\\$/ && $rawline =~ tr/"/"/ % 2) {
+		if ($rawline =~ /\\$/ && $sline =~ tr/"/"/ % 2) {
 			WARN("LINE_CONTINUATIONS",
 			     "Avoid line continuations in quoted strings\n" . $herecurr);
 		}
-- 
2.15.0

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

only message in thread, other threads:[~2017-12-19 15:54 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-19 15:54 [PATCH] checkpatch: Improve quoted string and line continuation test Joe Perches

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.