mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-07-22 02:17:36 -04:00
checkpatch: add check for function pointer arrays in declarations
checkpatch did not allow function pointer arrays when testing declaration blocks. Add it. Link: https://lore.kernel.org/eb62763085eb42193a611bca00a62d6f0ae72e1e.1776530118.git.joe@perches.com Signed-off-by: Joe Perches <joe@perches.com> Cc: Andy Whitcroft <apw@canonical.com> Cc: Dan Carpenter <dan.carpenter@linaro.org> Cc: Dwaipayan Ray <dwaipayanray1@gmail.com> Cc: Lukas Bulwahn <lukas.bulwahn@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
committed by
Andrew Morton
parent
93c8c6ea90
commit
1877a09b64
@@ -4183,7 +4183,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
|
||||
@@ -4197,7 +4197,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
|
||||
|
||||
Reference in New Issue
Block a user