checkpatch: add #define foo "string" long line exception
authorJoe Perches <joe@perches.com>
Thu, 16 Apr 2015 19:44:30 +0000 (12:44 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 17 Apr 2015 13:03:57 +0000 (09:03 -0400)
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

Signed-off-by: Joe Perches <joe@perches.com>
Reported-by: Madalin-Cristian Bucur <madalin.bucur@freescale.com>
Cc: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
scripts/checkpatch.pl

index 9a8b2bd14dc2b511c7b8f2f849e35952c88d57dc..36d7e704af8f35bee4d9238f1f16c89008c65f64 100755 (executable)
@@ -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",