* [PATCH] checkpatch: Fix function pointers in blank line needed after declarations test
[not found] ` <804857E1F29AAC47BF68C404FC60A184656254DF@ORSMSX105.amr.corp.intel.com>
@ 2014-06-06 18:33 ` Joe Perches
0 siblings, 0 replies; only message in thread
From: Joe Perches @ 2014-06-06 18:33 UTC (permalink / raw)
To: Andrew Morton; +Cc: Allan, Bruce W, LKML, Andy Whitcroft
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
^ permalink raw reply [flat|nested] only message in thread