Messages in this thread Patch in this message | | | Subject | [PATCH] checkpatch: Fix function pointers in blank line needed after declarations test | From | Joe Perches <> | Date | Fri, 06 Jun 2014 11:33:14 -0700 |
| |
Add a function pointer declaration check to the test for blank line needed after declarations.
Reported-by: Bruce W Allan <bruce.w.allan@intel.com> Signed-off-by: Joe Perches <joe@perches.com> --- On Fri, 2014-06-06 at 17:23 +0000, Allan, Bruce W wrote: > > WARNING: Missing a blank line after declarations > > #318: FILE: drivers/crypto/qat/qat_common/adf_accel_devices.h:140: > > + struct adf_hw_device_class *dev_class; > > + uint32_t (*get_accel_mask)(uint32_t fuse); > > This one is a false positive from checkpatch
scripts/checkpatch.pl | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 010b18e..f4b8911 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -2295,6 +2295,8 @@ sub process { if ($sline =~ /^\+\s+\S/ && #Not at char 1 # actual declarations ($prevline =~ /^\+\s+$Declare\s*$Ident\s*[=,;:\[]/ || + # function pointer declarations + $prevline =~ /^\+\s+$Declare\s*\(\s*\*\s*$Ident\s*\)\s*[=,;:\[\(]/ || # foo bar; where foo is some local typedef or #define $prevline =~ /^\+\s+$Ident(?:\s+|\s*\*\s*)$Ident\s*[=,;\[]/ || # known declaration macros @@ -2307,6 +2309,8 @@ sub process { $prevline =~ /(?:\{\s*|\\)$/) && # looks like a declaration !($sline =~ /^\+\s+$Declare\s*$Ident\s*[=,;:\[]/ || + # function pointer declarations + $sline =~ /^\+\s+$Declare\s*\(\s*\*\s*$Ident\s*\)\s*[=,;:\[\(]/ || # foo bar; where foo is some local typedef or #define $sline =~ /^\+\s+$Ident(?:\s+|\s*\*\s*)$Ident\s*[=,;\[]/ || # known declaration macros
| |