* [PATCH] checkpatch: Add --strict test for concatenated string elements
@ 2014-09-01 17:33 Joe Perches
0 siblings, 0 replies; only message in thread
From: Joe Perches @ 2014-09-01 17:33 UTC (permalink / raw)
To: Andrew Morton; +Cc: Andy Whitcroft, LKML, Dan Carpenter
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>
---
scripts/checkpatch.pl | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index d89857d..48a2d8c 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -4335,6 +4335,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",
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2014-09-01 17:33 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-01 17:33 [PATCH] checkpatch: Add --strict test for concatenated string elements Joe Perches
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®