History

checkpatch: add check for line continuations in quoted strings

Add a warning for unterminated quoted strings with line continuations as these frequently add unwanted whitespace.

Joe Perches committed 15 years ago

Commit 428e2fd1 parent 5ca43f61 file · +5 −0Browse files

Showing the changes to scripts/checkpatch.pl (1 of 1 file). Show all

Unified · Split

scripts/checkpatch.pl+5−0
@@ -2748,6 +2748,11 @@ sub process { · 2747 unmodified lines
27482748 WARN("sizeof(& should be avoided\n" . $herecurr);
27492749 }
27502750
2751+# check for line continuations in quoted strings with odd counts of "
2752+ if ($rawline =~ /\\$/ && $rawline =~ tr/"/"/ % 2) {
2753+ WARN("Avoid line continuations in quoted strings\n" . $herecurr);
2754+ }
2755+
27512756 # check for new externs in .c files.
27522757 if ($realfile =~ /\.c$/ && defined $stat &&
27532758 $stat =~ /^.\s*(?:extern\s+)?$Type\s+($Ident)(\s*)\(/s)