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
2748 WARN("sizeof(& should be avoided\n" . $herecurr);2748 WARN("sizeof(& should be avoided\n" . $herecurr);
2749 }2749 }
2750 2750
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
2751# check for new externs in .c files.2756# check for new externs in .c files.
2752 if ($realfile =~ /\.c$/ && defined $stat &&2757 if ($realfile =~ /\.c$/ && defined $stat &&
2753 $stat =~ /^.\s*(?:extern\s+)?$Type\s+($Ident)(\s*)\(/s)2758 $stat =~ /^.\s*(?:extern\s+)?$Type\s+($Ident)(\s*)\(/s)