linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] checkpatch: support function pointers for unnamed function definition arguments
@ 2017-09-14 11:52 Miles Chen
  2017-09-15  6:01 ` Joe Perches
  0 siblings, 1 reply; 2+ messages in thread
From: Miles Chen @ 2017-09-14 11:52 UTC (permalink / raw)
  To: Andy Whitcroft, Joe Perches
  Cc: linux-kernel, wsd_upstream, linux-mediatek, Miles Chen

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

Signed-off-by: Miles Chen <miles.chen@mediatek.com>
---
 scripts/checkpatch.pl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index dd2c262..03eb255 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -5957,7 +5957,7 @@ sub process {
 
 # check for function declarations that have arguments without identifier names
 		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") {
 			my $args = trim($1);
 			while ($args =~ m/\s*($Type\s*(?:$Ident|\(\s*\*\s*$Ident?\s*\)\s*$balanced_parens)?)/g) {
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] checkpatch: support function pointers for unnamed function definition arguments
  2017-09-14 11:52 [PATCH v2] checkpatch: support function pointers for unnamed function definition arguments Miles Chen
@ 2017-09-15  6:01 ` Joe Perches
  0 siblings, 0 replies; 2+ messages in thread
From: Joe Perches @ 2017-09-15  6:01 UTC (permalink / raw)
  To: Miles Chen, Andy Whitcroft, Andrew Morton
  Cc: linux-kernel, wsd_upstream, linux-mediatek

On Thu, 2017-09-14 at 19:52 +0800, Miles Chen wrote:
> 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
> 
> Signed-off-by: Miles Chen <miles.chen@mediatek.com>

Acked-by: Joe Perches <joe@perches.com>

> ---
>  scripts/checkpatch.pl | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index dd2c262..03eb255 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -5957,7 +5957,7 @@ sub process {
>  
>  # check for function declarations that have arguments without identifier names
>  		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") {
>  			my $args = trim($1);
>  			while ($args =~ m/\s*($Type\s*(?:$Ident|\(\s*\*\s*$Ident?\s*\)\s*$balanced_parens)?)/g) {

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-09-15  6:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-14 11:52 [PATCH v2] checkpatch: support function pointers for unnamed function definition arguments Miles Chen
2017-09-15  6:01 ` Joe Perches

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).