提交 00ef4ece 编写于 作者: A Andy Whitcroft 提交者: Linus Torvalds

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: NAndy Whitcroft <apw@canonical.com>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 e2f7aa4b
...@@ -1658,7 +1658,7 @@ sub process { ...@@ -1658,7 +1658,7 @@ sub process {
# * goes on variable not on type # * goes on variable not on type
# (char*[ const]) # (char*[ const])
if ($line =~ m{\($NonptrType(\s*\*[\s\*]*(?:$Modifier\s*)*)\)}) { if ($line =~ m{\($NonptrType(\s*(?:$Modifier\b\s*|\*\s*)+)\)}) {
my ($from, $to) = ($1, $1); my ($from, $to) = ($1, $1);
# Should start with a space. # Should start with a space.
...@@ -1673,7 +1673,7 @@ sub process { ...@@ -1673,7 +1673,7 @@ sub process {
if ($from ne $to) { if ($from ne $to) {
ERROR("\"(foo$from)\" should be \"(foo$to)\"\n" . $herecurr); 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); my ($from, $to, $ident) = ($1, $1, $2);
# Should start with a space. # Should start with a space.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册