diff options
author | Joe Perches <joe@perches.com> | 2014-10-13 18:51:51 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-10-13 20:18:15 -0400 |
commit | f17dba4fc0496eb0daf018074fccebdc85993c75 (patch) | |
tree | 600a0d028973abcdbd469e4d31003bebdd01cd17 /scripts | |
parent | 56193274ef54265afc93fd282655836595fcff9d (diff) |
checkpatch: add --strict test for concatenated string elements
Using a space between concatenated string elements is easier for a human
to read.
ie:
"String"FOO"bar"
is easier to read as:
"String" FOO "bar"
So suggest this style with a --strict command line option.
Signed-off-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 969b365f8690..9846ddeafdf0 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl | |||
@@ -4344,6 +4344,12 @@ sub process { | |||
4344 | "Use of volatile is usually wrong: see Documentation/volatile-considered-harmful.txt\n" . $herecurr); | 4344 | "Use of volatile is usually wrong: see Documentation/volatile-considered-harmful.txt\n" . $herecurr); |
4345 | } | 4345 | } |
4346 | 4346 | ||
4347 | # concatenated string without spaces between elements | ||
4348 | if ($line =~ /"X+"[A-Z_]+/ || $line =~ /[A-Z_]+"X+"/) { | ||
4349 | CHK("CONCATENATED_STRING", | ||
4350 | "Concatenated strings should use spaces between elements\n" . $herecurr); | ||
4351 | } | ||
4352 | |||
4347 | # warn about #if 0 | 4353 | # warn about #if 0 |
4348 | if ($line =~ /^.\s*\#\s*if\s+0\b/) { | 4354 | if ($line =~ /^.\s*\#\s*if\s+0\b/) { |
4349 | CHK("REDUNDANT_CODE", | 4355 | CHK("REDUNDANT_CODE", |