summaryrefslogtreecommitdiff
path: root/scripts/checkpatch.pl
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2014-10-14 02:51:51 +0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-10-14 04:18:15 +0400
commitf17dba4fc0496eb0daf018074fccebdc85993c75 (patch)
tree600a0d028973abcdbd469e4d31003bebdd01cd17 /scripts/checkpatch.pl
parent56193274ef54265afc93fd282655836595fcff9d (diff)
downloadlinux-f17dba4fc0496eb0daf018074fccebdc85993c75.tar.xz
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/checkpatch.pl')
-rwxr-xr-xscripts/checkpatch.pl6
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 {
"Use of volatile is usually wrong: see Documentation/volatile-considered-harmful.txt\n" . $herecurr);
}
+# concatenated string without spaces between elements
+ if ($line =~ /"X+"[A-Z_]+/ || $line =~ /[A-Z_]+"X+"/) {
+ CHK("CONCATENATED_STRING",
+ "Concatenated strings should use spaces between elements\n" . $herecurr);
+ }
+
# warn about #if 0
if ($line =~ /^.\s*\#\s*if\s+0\b/) {
CHK("REDUNDANT_CODE",