[PATCH 3/8] checkpatch: correctly handle type spacing in the face of modifiers

From: Andy Whitcroft
Date: Fri Jan 30 2009 - 10:05:55 EST


We need to handle interspersed modifiers in the middle of pointer types,
for example:

void * __user * __user bar;

Signed-off-by: Andy Whitcroft <apw@xxxxxxxxxxxxx>
---
scripts/checkpatch.pl | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 5ffc940..92d1371 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -1658,7 +1658,7 @@ sub process {

# * goes on variable not on type
# (char*[ const])
- if ($line =~ m{\($NonptrType(\s*\*[\s\*]*(?:$Modifier\s*)*)\)}) {
+ if ($line =~ m{\($NonptrType(\s*(?:$Modifier\b\s*|\*\s*)+)\)}) {
my ($from, $to) = ($1, $1);

# Should start with a space.
@@ -1673,7 +1673,7 @@ sub process {
if ($from ne $to) {
ERROR("\"(foo$from)\" should be \"(foo$to)\"\n" . $herecurr);
}
- } elsif ($line =~ m{\b$NonptrType(\s*\*[\s\*]*(?:$Modifier\s*)?)($Ident)}) {
+ } elsif ($line =~ m{\b$NonptrType(\s*(?:$Modifier\b\s*|\*\s*)+)($Ident)}) {
my ($from, $to, $ident) = ($1, $1, $2);

# Should start with a space.
--
1.6.1.2.419.g0d87e

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/