linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/5] checkpatch: fix false errors due to macro concatenation
@ 2009-09-22  2:14 Daniel Walker
  2009-09-22  2:14 ` [PATCH 2/5] checkpatch: fix hang in relative indent checking Daniel Walker
  2009-09-30 17:46 ` [PATCH 1/5] checkpatch: fix false errors due to macro concatenation Andy Whitcroft
  0 siblings, 2 replies; 32+ messages in thread
From: Daniel Walker @ 2009-09-22  2:14 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Andy Whitcroft, linux-kernel, Daniel Walker

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@fifo99.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+).*@$1$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


^ permalink raw reply related	[flat|nested] 32+ messages in thread

end of thread, other threads:[~2009-10-07 22:00 UTC | newest]

Thread overview: 32+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-09-22  2:14 [PATCH 1/5] checkpatch: fix false errors due to macro concatenation Daniel Walker
2009-09-22  2:14 ` [PATCH 2/5] checkpatch: fix hang in relative indent checking Daniel Walker
2009-09-22  2:14   ` [PATCH 3/5] checkpatch: add a blacklist Daniel Walker
2009-09-22  2:14     ` [PATCH 4/5] checkpatch: fix __attribute__ matching Daniel Walker
2009-09-22  2:14       ` [PATCH 5/5] checkpatch: fix false EXPORT_SYMBOL warning Daniel Walker
2009-09-30 17:46         ` Andy Whitcroft
2009-10-01 14:28           ` Daniel Walker
2009-10-02  7:39             ` Andy Whitcroft
2009-09-30 17:46       ` [PATCH 4/5] checkpatch: fix __attribute__ matching Andy Whitcroft
2009-10-01 14:26         ` Daniel Walker
2009-10-02  7:43           ` Andy Whitcroft
2009-09-22  6:29     ` [PATCH 3/5] checkpatch: add a blacklist Li Zefan
2009-09-30 15:27       ` Andy Whitcroft
2009-10-01 14:18         ` Daniel Walker
2009-10-06 19:51           ` Steven Rostedt
2009-10-06 20:50           ` Krzysztof Halasa
2009-10-07  3:52             ` Daniel Walker
2009-10-07 10:17               ` Krzysztof Halasa
2009-10-07 14:26                 ` Daniel Walker
2009-10-07 14:44                   ` Krzysztof Halasa
2009-10-07 14:57                     ` Daniel Walker
2009-10-07 15:11                       ` Alan Cox
2009-10-07 15:41                         ` Daniel Walker
2009-10-07 15:52                           ` Alan Cox
2009-10-07 16:11                             ` Daniel Walker
2009-10-07 15:08                   ` Steven Rostedt
2009-10-07 15:38                     ` Daniel Walker
2009-10-07 21:30                       ` Krzysztof Halasa
2009-10-07 21:58                         ` Daniel Walker
2009-09-30 15:24   ` [PATCH 2/5] checkpatch: fix hang in relative indent checking Andy Whitcroft
2009-09-30 17:46 ` [PATCH 1/5] checkpatch: fix false errors due to macro concatenation Andy Whitcroft
2009-10-01 14:20   ` Daniel Walker

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).