[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20171205163403.32470-1-ynorov@caviumnetworks.com>
Date: Tue, 5 Dec 2017 19:34:03 +0300
From: Yury Norov <ynorov@...iumnetworks.com>
To: linux-kernel@...r.kernel.org, Andy Whitcroft <apw@...onical.com>,
Joe Perches <joe@...ches.com>
Cc: Yury Norov <ynorov@...iumnetworks.com>
Subject: [PATCH v2] checkpatch: suppress false long-line warining
For DOS-formatted patches, extra ^M symbol at the end of line
increases overall line length by 1.
It triggers unneeded warning if line is exactly 80 chars length.
This patch fixes it.
Discovered in discussion to this patch:
https://lkml.org/lkml/2017/11/25/24
v2: simplify as suggested by Joe Perches.
Signed-off-by: Yury Norov <ynorov@...iumnetworks.com>
CC: Joe Perches <joe@...ches.com>
---
scripts/checkpatch.pl | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 040aa79e1d9d..e7b941b8e6d7 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -2732,6 +2732,13 @@ sub process {
#trailing whitespace
if ($line =~ /^\+.*\015/) {
+ # If DOS line detected, additional ^M symbol at the end
+ # of line increases line length, so remove that ^M and
+ # decrease $length to avoid false positives when
+ # checking length of the line.
+ $line =~ s/[\s\015]+$//;
+ $length--;
+
my $herevet = "$here\n" . cat_vet($rawline) . "\n";
if (ERROR("DOS_LINE_ENDINGS",
"DOS line endings\n" . $herevet) &&
--
2.11.0
Powered by blists - more mailing lists