Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 428e2fdc authored by Joe Perches's avatar Joe Perches Committed by Linus Torvalds
Browse files

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: default avatarJoe Perches <joe@perches.com>
Cc: Andy Whitcroft <apw@canonical.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 5ca43f6c
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -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)