qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH] checkpatch: allow longer lines for logging function


From: Greg Kurz
Subject: [Qemu-devel] [PATCH] checkpatch: allow longer lines for logging functions
Date: Fri, 17 Mar 2017 11:36:59 +0100
User-agent: StGit/0.17.1-20-gc0b1b-dirty

Commit f1e155bbf863a removed a bunch of stuff that really don't make sense
outside the linux kernel. An exception though is logging functions: it is
convenient to be able to grep error messages in the code. For this to work,
error strings mustn't be broken down on multiple lines, and therefore are
likely to overcome the 90 characters limit, and make checkpatch unhappy.

This patch reverts the change for logging functions and adapts it to QEMU.

Signed-off-by: Greg Kurz <address@hidden>
---
 scripts/checkpatch.pl |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index f0845429342a..cc2796238170 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -192,6 +192,11 @@ our $typeTypedefs = qr{(?x:
         | QEMUBH                            # all uppercase
 )};
 
+our $logFunctions = qr{(?x:
+       error_report|
+       error_printf
+)};
+
 our @typeList = (
        qr{void},
        qr{(?:unsigned\s+)?char},
@@ -1341,7 +1346,8 @@ sub process {
 
 #90 column limit
                if ($line =~ /^\+/ &&
-                   !($line =~ /^\+\s*"[^"]*"\s*(?:\s*|,|\)\s*;)\s*$/) &&
+                   !($line =~ 
/^\+\s*$logFunctions\s*\(\s*(?:([^"]*))?"[X\t]*"\s*(?:,|\)\s*;)\s*$/ ||
+                     $line =~ /^\+\s*"[^"]*"\s*(?:\s*|,|\)\s*;)\s*$/) &&
                    $length > 80)
                {
                        if ($length > 90) {




reply via email to

[Prev in Thread] Current Thread [Next in Thread]