aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/checkpatch.pl
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2011-05-24 20:13:39 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-05-25 11:39:55 -0400
commit428e2fdc4ecee2312829e97549f99c12312f4faf (patch)
tree5f5debb951822770cd6e325c6552e701a2874642 /scripts/checkpatch.pl
parent5ca43f6c3b365024d889bc77064bb331f5a72a45 (diff)
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. Signed-off-by: Joe Perches <joe@perches.com> Cc: Andy Whitcroft <apw@canonical.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'scripts/checkpatch.pl')
-rwxr-xr-xscripts/checkpatch.pl5
1 files changed, 5 insertions, 0 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index d8670810db65..5c9672951077 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -2748,6 +2748,11 @@ sub process {
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)