Skip to contentSkip to conversation

checkpatch: improve quoted string and line continuation test

PATCH New [email protected] 1 participant 1 message Feb 6, 2018 Checkpatch

lore
Share & tools
lore
#0 lore raw

PATCH 49/114 checkpatch: improve quoted string and line continuation test

From: Joe Perches <[email protected]>
Subject: checkpatch: improve quoted string and line continuation test

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.

---

 scripts/checkpatch.pl |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/checkpatch.pl renamed from scripts/checkpatch.pl~checkpatch-improve-quoted-string-and-line-continuation-test +1 -1
diff -puN scripts/checkpatch.pl~checkpatch-improve-quoted-string-and-line-continuation-test 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);
 		}

_