Commit 25bdda2b authored by Miles Chen's avatar Miles Chen Committed by Linus Torvalds

checkpatch: support function pointers for unnamed function definition arguments

Current unnamed function definition argument does not include function
pointer cases and it reports something like:

  WARNING: function definition argument 'void' should also have an identifier name
  +unsigned int (*dummy)(void);

Support function pointers for unnamed function arguments

Link: http://lkml.kernel.org/r/[email protected]Signed-off-by: default avatarMiles Chen <[email protected]>
Acked-by: default avatarJoe Perches <[email protected]>
Signed-off-by: default avatarAndrew Morton <[email protected]>
Signed-off-by: default avatarLinus Torvalds <[email protected]>
parent 4441fca0
...@@ -5957,7 +5957,7 @@ sub process { ...@@ -5957,7 +5957,7 @@ sub process {
# check for function declarations that have arguments without identifier names # check for function declarations that have arguments without identifier names
if (defined $stat && if (defined $stat &&
$stat =~ /^.\s*(?:extern\s+)?$Type\s*$Ident\s*\(\s*([^{]+)\s*\)\s*;/s && $stat =~ /^.\s*(?:extern\s+)?$Type\s*(?:$Ident|\(\s*\*\s*$Ident\s*\))\s*\(\s*([^{]+)\s*\)\s*;/s &&
$1 ne "void") { $1 ne "void") {
my $args = trim($1); my $args = trim($1);
while ($args =~ m/\s*($Type\s*(?:$Ident|\(\s*\*\s*$Ident?\s*\)\s*$balanced_parens)?)/g) { while ($args =~ m/\s*($Type\s*(?:$Ident|\(\s*\*\s*$Ident?\s*\)\s*$balanced_parens)?)/g) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment