summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2014-08-06 16:11:29 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2014-08-06 18:01:29 -0700
commitece9659f16e369d344fe4325d87fab3bb50d1fe2 (patch)
tree8a2b086dbc5c0fa7829603c786fa6beeb7dcf575
parent308cc8d8f0deab2c5a5162316277ced556acc71f (diff)
checkpatch: warn on missing spaces in broken up quoted
Checkpatch already complains when people break up quoted strings but it's still pretty common. One mistake that people often make is they leave out the space character between the two strings. This check adds around 450 new warnings and has a low rate of false positives. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Cc: Andy Whitcroft <apw@canonical.com> Acked-by: Joe Perches <joe@perches.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rwxr-xr-xscripts/checkpatch.pl6
1 files changed, 6 insertions, 0 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 9f14bf928cc7..da74e65064d1 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -2361,6 +2361,12 @@ sub process {
"quoted string split across lines\n" . $hereprev);
}
+# check for missing a space in a string concatination
+ if ($prevrawline =~ /[^\\]\w"$/ && $rawline =~ /^\+[\t ]+"\w/) {
+ WARN('MISSING_SPACE',
+ "break quoted strings at a space character\n" . $hereprev);
+ }
+
# check for spaces before a quoted newline
if ($rawline =~ /^.*\".*\s\\n/) {
if (WARN("QUOTED_WHITESPACE_BEFORE_NEWLINE",