History

checkpatch: fix function pointers in blank line needed after declarations test

Add a function pointer declaration check to the test for blank line needed after declarations.

Joe Perches committed 12 years ago

Commit 5a4e1fd1 parent 356fd391 file · +4 −0Browse files

Showing the changes to scripts/checkpatch.pl (1 of 1 file). Show all

Unified · Split

scripts/checkpatch.pl+4−0
@@ -2295,6 +2295,8 @@ sub process { · 2294 unmodified lines
2295 if ($sline =~ /^\+\s+\S/ && #Not at char 12295 if ($sline =~ /^\+\s+\S/ && #Not at char 1
2296 # actual declarations2296 # actual declarations
2297 ($prevline =~ /^\+\s+$Declare\s*$Ident\s*[=,;:\[]/ ||2297 ($prevline =~ /^\+\s+$Declare\s*$Ident\s*[=,;:\[]/ ||
2298 # function pointer declarations
2299 $prevline =~ /^\+\s+$Declare\s*\(\s*\*\s*$Ident\s*\)\s*[=,;:\[\(]/ ||
2298 # foo bar; where foo is some local typedef or #define2300 # foo bar; where foo is some local typedef or #define
2299 $prevline =~ /^\+\s+$Ident(?:\s+|\s*\*\s*)$Ident\s*[=,;\[]/ ||2301 $prevline =~ /^\+\s+$Ident(?:\s+|\s*\*\s*)$Ident\s*[=,;\[]/ ||
2300 # known declaration macros2302 # known declaration macros
@@ -2307,6 +2309,8 @@ sub process { · 6 unmodified lines
2307 $prevline =~ /(?:\{\s*|\\)$/) &&2309 $prevline =~ /(?:\{\s*|\\)$/) &&
2308 # looks like a declaration2310 # looks like a declaration
2309 !($sline =~ /^\+\s+$Declare\s*$Ident\s*[=,;:\[]/ ||2311 !($sline =~ /^\+\s+$Declare\s*$Ident\s*[=,;:\[]/ ||
2312 # function pointer declarations
2313 $sline =~ /^\+\s+$Declare\s*\(\s*\*\s*$Ident\s*\)\s*[=,;:\[\(]/ ||
2310 # foo bar; where foo is some local typedef or #define2314 # foo bar; where foo is some local typedef or #define
2311 $sline =~ /^\+\s+$Ident(?:\s+|\s*\*\s*)$Ident\s*[=,;\[]/ ||2315 $sline =~ /^\+\s+$Ident(?:\s+|\s*\*\s*)$Ident\s*[=,;\[]/ ||
2312 # known declaration macros2316 # known declaration macros