[lkml]   [2008]   [May]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
Subject[PATCH] checkpatch: update the 80-char-line check to allow for long strings
19:29 * dilinger sends his patch to lkml for a proper flaming
19:32 Quozl> dilinger: it's called "patch hardening"? ;-} the heat
of the flames makes the patch stronger.

I've wasted too much time massaging printk strings in order to satisfy Comments on this?

From: Andres Salomon <> is pretty strict in its lines-must-be-less-than-80-chars
check. I consider this a good thing in most scenarios; however,
when it comes to strings, I don't consider the following to be readable:

"one two three "

CodingStyle backs me up on this (if I'm interpreting that section clearly).
Ingo[0] has also pointed out why this might be a bad thing as well.

This patch is an attempt to make more useful. Folks ignore
long string warnings[1], which is bad form; we don't _want_ people getting
used to ignoring warnings any more than we want people
getting used to ignoring compiler warnings.

The patch updates to ignore lines that are > 80 chars
if they contain only (quoted) strings and perhaps some additional stuff
at the end. For example, the following no longer has warnings emitted:

+ "one two three fooooooooooooooooooooooooooooooooooooooooooooooo\n");

+ "one two three fooooooooooooooooooooooooooooooooooooooooo\n",
+ xyz);

However, the following still triggers warnings:

+ printk(KERN_WARNING "one two three fooooooooooooooooooooooooooooooooooooooooooooooo\n");

+ "one two three foooooooooooooooooooooooooooooooooooooo\n", xyz);

I'm sure it's possible to fool the check, but we're not trying to guard
against malicious patch authors.


Signed-off-by: Andres Salomon <>
scripts/ | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/scripts/ b/scripts/
index b6bbbcd..00f3d05 100755
--- a/scripts/
+++ b/scripts/
@@ -1117,7 +1117,7 @@ sub process {
ERROR("trailing whitespace\n" . $herevet);
#80 column limit
- if ($line =~ /^\+/ && !($prevrawline=~/\/\*\*/) && $length > 80) {
+ if ($line =~ /^\+/ && !($prevrawline=~/\/\*\*/) && !($line =~ /^\+\s*"/ && $line =~ /"[);,\s]*$/) && $length > 80) {
WARN("line over 80 characters\n" . $herecurr);


 \ /
  Last update: 2008-05-14 06:53    [W:0.046 / U:2.680 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site