diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2014-08-06 19:11:29 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-08-06 21:01:29 -0400 |
commit | ece9659f16e369d344fe4325d87fab3bb50d1fe2 (patch) | |
tree | 8a2b086dbc5c0fa7829603c786fa6beeb7dcf575 /scripts | |
parent | 308cc8d8f0deab2c5a5162316277ced556acc71f (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>
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/checkpatch.pl | 6 |
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 { | |||
2361 | "quoted string split across lines\n" . $hereprev); | 2361 | "quoted string split across lines\n" . $hereprev); |
2362 | } | 2362 | } |
2363 | 2363 | ||
2364 | # check for missing a space in a string concatination | ||
2365 | if ($prevrawline =~ /[^\\]\w"$/ && $rawline =~ /^\+[\t ]+"\w/) { | ||
2366 | WARN('MISSING_SPACE', | ||
2367 | "break quoted strings at a space character\n" . $hereprev); | ||
2368 | } | ||
2369 | |||
2364 | # check for spaces before a quoted newline | 2370 | # check for spaces before a quoted newline |
2365 | if ($rawline =~ /^.*\".*\s\\n/) { | 2371 | if ($rawline =~ /^.*\".*\s\\n/) { |
2366 | if (WARN("QUOTED_WHITESPACE_BEFORE_NEWLINE", | 2372 | if (WARN("QUOTED_WHITESPACE_BEFORE_NEWLINE", |