[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1253585691-10987-1-git-send-email-dwalker@fifo99.com>
Date: Mon, 21 Sep 2009 19:14:47 -0700
From: Daniel Walker <dwalker@...o99.com>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: Andy Whitcroft <apw@...onical.com>, linux-kernel@...r.kernel.org,
Daniel Walker <dwalker@...o99.com>
Subject: [PATCH 1/5] checkpatch: fix false errors due to macro concatenation
The macro concatenation (##) sequence can cause false errors when checking
macro's. Checkpatch doesn't currently know about the operator.
For example this line,
+ entry = (struct ftrace_raw_##call *)raw_data; \
is correct but it produces the following error,
ERROR: need consistent spacing around '*' (ctx:WxB)
+ entry = (struct ftrace_raw_##call *)raw_data;\
^
The line above doesn't have any spacing problems, and if you remove the
macro concatenation sequence checkpatch doesn't give any errors. This change
resolves this by just always removing "##" in every line checked.
Signed-off-by: Daniel Walker <dwalker@...o99.com>
---
scripts/checkpatch.pl | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 2d5ece7..09bab22 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -397,6 +397,11 @@ sub sanitise_line {
$res =~ s@(\#\s*(?:error|warning)\s+).*@...clean@;
}
+ # The macro concatenation sequence is unique so we can just delete it.
+ # If it's not deleted it screws up the rest of the matching and can
+ # result in false errors.
+ $res =~ s/($Ident|\s)\s*\#\#\s*($Ident|\s)/$1$2/g;
+
return $res;
}
--
1.5.6.3
--
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