* [PATCH] checkpatch: Add check for function pointer arrays in declarations
@ 2026-04-18 17:34 Joe Perches
0 siblings, 0 replies; only message in thread
From: Joe Perches @ 2026-04-18 17:34 UTC (permalink / raw)
To: Andrew Morton, Andy Whitcroft, Dwaipayan Ray, Lukas Bulwahn
Cc: Dan Carpenter, linux-kernel
checkpatch did not allow function pointer arrays when testing
declaration blocks.
Add it.
Signed-off-by: Joe Perches <joe@perches.com>
---
Too many script running folk people that don't really understand what
a declaration is send patches to add unnecessary blank lines because
checkpatch didn't recognize a function pointer array.
scripts/checkpatch.pl | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index e0f1d6a6bc636..76197c9fb58a5 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -4128,7 +4128,7 @@ sub process {
$pl =~ s/\b(?:$Attribute|$Sparse)\b//g;
if (($pl =~ /^\+\s+$Declare\s*$Ident\s*[=,;:\[]/ ||
# function pointer declarations
- $pl =~ /^\+\s+$Declare\s*\(\s*\*\s*$Ident\s*\)\s*[=,;:\[\(]/ ||
+ $pl =~ /^\+\s+$Declare\s*\(\s*\*\s*$Ident(?:\s*\[\s*(?:$Ident|$Constant)?\s*\])?\s*\)\s*[=,;:\[\(]/ ||
# foo bar; where foo is some local typedef or #define
$pl =~ /^\+\s+$Ident(?:\s+|\s*\*\s*)$Ident\s*[=,;\[]/ ||
# known declaration macros
@@ -4142,7 +4142,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*\[\s*(?:$Ident|$Constant)?\s*\])?\s*\)\s*[=,;:\[\(]/ ||
# foo bar; where foo is some local typedef or #define
$sl =~ /^\+\s+$Ident(?:\s+|\s*\*\s*)$Ident\s*[=,;\[]/ ||
# known declaration macros
--
2.53.0
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-04-18 17:35 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-04-18 17:34 [PATCH] checkpatch: Add check for function pointer arrays in declarations Joe Perches
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®