[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1428086160.13180.55.camel@perches.com>
Date: Fri, 03 Apr 2015 11:36:00 -0700
From: Joe Perches <joe@...ches.com>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: Andy Whitcroft <apw@...dowen.org>,
Madalin-Cristian Bucur <madalin.bucur@...escale.com>,
LKML <linux-kernel@...r.kernel.org>
Subject: [PATCH] checkpatch: Add #define foo "string" long line exception
There are #defines with long string constants like:
#define foo "some really long string > 80 columns"
Add a long line exception for them.
Miscellanea:
Use the $String variable for slightly better readability
Reported-by: Madalin-Cristian Bucur <madalin.bucur@...escale.com>
Signed-off-by: Joe Perches <joe@...ches.com>
---
> > WARNING: line over 80 characters
> > #22: FILE: drivers/net/ethernet/freescale/dpaa/dpaa_eth_trace.h:47:
> > +#define TR_FMT "[%s] fqid=%d, fd: addr=0x%llx, format=%s, off=%u, len=%u, status=0x%08x"
>
> That's a checkpatch defect. Thanks. I'll see about fixing it.
scripts/checkpatch.pl | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 9a8b2bd..36d7e70 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -2513,8 +2513,9 @@ sub process {
#line length limit
if ($line =~ /^\+/ && $prevrawline !~ /\/\*\*/ &&
$rawline !~ /^.\s*\*\s*\@$Ident\s/ &&
- !($line =~ /^\+\s*$logFunctions\s*\(\s*(?:(KERN_\S+\s*|[^"]*))?"[X\t]*"\s*(?:|,|\)\s*;)\s*$/ ||
- $line =~ /^\+\s*"[^"]*"\s*(?:\s*|,|\)\s*;)\s*$/) &&
+ !($line =~ /^\+\s*$logFunctions\s*\(\s*(?:(KERN_\S+\s*|[^"]*))?$String\s*(?:|,|\)\s*;)\s*$/ ||
+ $line =~ /^\+\s*$String\s*(?:\s*|,|\)\s*;)\s*$/ ||
+ $line =~ /^\+\s*#\s*define\s+\w+\s+$String$/) &&
$length > $max_line_length)
{
WARN("LONG_LINE",
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists