Add a warning for unterminated quoted strings with line continuations as these frequently add unwanted whitespace.
Showing the changes to scripts/checkpatch.pl (1 of 1 file). Show all
Unified · Split
| @@ -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) |