The following commit has been merged in the linux branch: commit 2ceb532b04b7a3b8f534d11a6e839f8b8bff94c1 Author: Andy Whitcroft apw@canonical.com Date: Mon Oct 26 16:50:14 2009 -0700
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.
Extend identifier handling to include ## concatenation within the definition of an identifier.
Reported-by: Daniel Walker dwalker@fifo99.com Signed-off-by: Andy Whitcroft apw@canonical.com Signed-off-by: Andrew Morton akpm@linux-foundation.org Signed-off-by: Linus Torvalds torvalds@linux-foundation.org
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 05b10d6..cb2dac3 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -130,7 +130,10 @@ if ($tree) {
my $emitted_corrupt = 0;
-our $Ident = qr{[A-Za-z_][A-Za-z\d_]*}; +our $Ident = qr{ + [A-Za-z_][A-Za-z\d_]* + (?:\s*##\s*[A-Za-z_][A-Za-z\d_]*)* + }x; our $Storage = qr{extern|static|asmlinkage}; our $Sparse = qr{ __user|