From: Joe Perches Date: Wed, 10 Dec 2014 23:51:59 +0000 (-0800) Subject: checkpatch: add test for consecutive string fragments X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=90ad30e5b2a759333f06eee64e59a0d886d02036;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git checkpatch: add test for consecutive string fragments Emit a warning when single line string coalescing occurs. Code that uses compiler string concatenation on a single line like: printk("foo" "bar"); is generally better to read concatenated like: printk("foobar"); Signed-off-by: Joe Perches Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index d06b6be2841e..5e63dce2e428 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -4464,6 +4464,12 @@ sub process { "Concatenated strings should use spaces between elements\n" . $herecurr); } +# uncoalesced string fragments + if ($line =~ /"X*"\s*"/) { + WARN("STRING_FRAGMENTS", + "Consecutive strings are generally better as a single string\n" . $herecurr); + } + # warn about #if 0 if ($line =~ /^.\s*\#\s*if\s+0\b/) { CHK("REDUNDANT_CODE",