[PATCH] checkpatch: Add check for line continuations in quotedstrings

From: Joe Perches
Date: Tue Apr 12 2011 - 20:37:19 EST


Add a warning for unterminated quoted strings with line continuations
as these frequently add unwanted whitespace.

Signed-off-by: Joe Perches <joe@xxxxxxxxxxx>

---

scripts/checkpatch.pl | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index d867081..f3f907b 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)


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/