On Tue, 2023-10-31 at 13:27 +0300, Dan Carpenter wrote: > On Tue, Oct 31, 2023 at 10:06:10AM +0000, Rohit Chavan wrote: > > Fixes below warning reported by checkpatch. > > WARNING: Missing a blank line after declarations > > > > Signed-off-by: Rohit Chavan <roheetchavan@xxxxxxxxx> > > This is a checkpatch false positive. (It's not "after declarations"). > Just ignore it. > checkpatch could accept function pointer and function pointer arrays --- scripts/checkpatch.pl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 25fdb7fda1128..de1f4962f55d6 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -1073,6 +1073,7 @@ our $Typecast = qr{\s*(\(\s*$NonptrType\s*\)){0,1}\s*}; # Any use must be runtime checked with $^V our $balanced_parens = qr/(\((?:[^\(\)]++|(?-1))*\))/; +our $balanced_brackets = qr/(\[(?:[^\[\]]++|(?-1))*\])/; our $LvalOrFunc = qr{((?:[\&\*]\s*)?$Lval)\s*($balanced_parens{0,1})\s*}; our $FuncArg = qr{$Typecast{0,1}($LvalOrFunc|$Constant|$String)}; @@ -4107,7 +4108,7 @@ sub process { # looks like a declaration !($sl =~ /^\+\s+$Declare\s*$Ident\s*[=,;:\[]/ || # function pointer declarations - $sl =~ /^\+\s+$Declare\s*\(\s*\*\s*$Ident\s*\)\s*[=,;:\[\(]/ || + $sl =~ /^\+\s+$Declare\s*\(\s*\*\s*$Ident(?:\s*$balanced_brackets)*\s*\)\s*[=,;:\[\(]/ || # foo bar; where foo is some local typedef or #define $sl =~ /^\+\s+$Ident(?:\s+|\s*\*\s*)$Ident\s*[=,;\[]/ || # known declaration macros