From: Andy Whitcroft Date: Fri, 27 Feb 2009 22:03:07 +0000 (-0800) Subject: checkpatch: correctly handle type spacing in the face of modifiers X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=00ef4ece05096a5c523e265b8ce6627fb5e171c2;p=linux-beck.git checkpatch: correctly handle type spacing in the face of modifiers We need to handle interspersed modifiers in the middle of pointer types, for example: void * __user * __user bar; Signed-off-by: Andy Whitcroft Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 5ffc940399be..92d13710ff52 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.