diff options
author | Joe Perches <joe@perches.com> | 2012-12-18 01:01:47 +0100 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-12-18 02:15:18 +0100 |
commit | 5023d3472d444747bfa12e9798d7993e7efb8287 (patch) | |
tree | 384454623fc76da468021e0d58846debec536014 /scripts | |
parent | compat: generic compat_sys_sched_rr_get_interval() implementation (diff) | |
download | linux-5023d3472d444747bfa12e9798d7993e7efb8287.tar.xz linux-5023d3472d444747bfa12e9798d7993e7efb8287.zip |
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>
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/checkpatch.pl | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index f18750e3bd6c..d4f61a6fed5d 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -3013,6 +3013,15 @@ sub process { "Macros with complex values should be enclosed in parenthesis\n" . "$herectx"); } } + +# check for line continuations outside of #defines + + } else { + if ($prevline !~ /^..*\\$/ && + $line =~ /^\+.*\\$/) { + WARN("LINE_CONTINUATIONS", + "Avoid unnecessary line continuations\n" . $herecurr); + } } # do {} while (0) macro tests: |