From: Joe Perches Date: Wed, 25 May 2011 00:13:39 +0000 (-0700) Subject: checkpatch: add check for line continuations in quoted strings X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=428e2fdc4ecee2312829e97549f99c12312f4faf;p=GitHub%2FLineageOS%2Fandroid_kernel_samsung_universal7580.git checkpatch: add check for line continuations in quoted strings Add a warning for unterminated quoted strings with line continuations as these frequently add unwanted whitespace. Signed-off-by: Joe Perches Cc: Andy Whitcroft Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index d8670810db6..5c967295107 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -2748,6 +2748,11 @@ sub process { WARN("sizeof(& should be avoided\n" . $herecurr); } +# check for line continuations in quoted strings with odd counts of " + if ($rawline =~ /\\$/ && $rawline =~ tr/"/"/ % 2) { + WARN("Avoid line continuations in quoted strings\n" . $herecurr); + } + # check for new externs in .c files. if ($realfile =~ /\.c$/ && defined $stat && $stat =~ /^.\s*(?:extern\s+)?$Type\s+($Ident)(\s*)\(/s)