Skip to content

Commit 5023d34

Browse files
JoePerchestorvalds
authored andcommitted
checkpatch: warn on unnecessary line continuations
When the previous line is not a line continuation and the current line has a line continuation but is not a #define, emit a warning. Signed-off-by: Joe Perches <joe@perches.com> Cc: Peter Hurley <peter@hurleysoftware.com> Cc: Andy Whitcroft <apw@canonical.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 0ad50c3 commit 5023d34

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

‎scripts/checkpatch.pl‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3013,6 +3013,15 @@ sub process {
30133013
"Macros with complex values should be enclosed in parenthesis\n" . "$herectx");
30143014
}
30153015
}
3016+
3017+
# check for line continuations outside of #defines
3018+
3019+
} else {
3020+
if ($prevline !~ /^..*\\$/ &&
3021+
$line =~ /^\+.*\\$/) {
3022+
WARN("LINE_CONTINUATIONS",
3023+
"Avoid unnecessary line continuations\n" . $herecurr);
3024+
}
30163025
}
30173026

30183027
# do {} while (0) macro tests:

0 commit comments

Comments
 (0)