lkml.org 
[lkml]   [2009]   [Sep]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 1/5] checkpatch: fix false errors due to macro concatenation
Date
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


\
 
 \ /
  Last update: 2009-09-22 04:17    [from the cache]
©2003-2011 Jasper Spaans