diff options
Diffstat (limited to 'scripts/checkpatch.pl')
| -rwxr-xr-x | scripts/checkpatch.pl | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 732bb3e2fe9a..832e8150dba3 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl | |||
| @@ -3126,6 +3126,17 @@ sub process { | |||
| 3126 | # check we are in a valid C source file if not then ignore this hunk | 3126 | # check we are in a valid C source file if not then ignore this hunk |
| 3127 | next if ($realfile !~ /\.(h|c)$/); | 3127 | next if ($realfile !~ /\.(h|c)$/); |
| 3128 | 3128 | ||
| 3129 | # check if this appears to be the start function declaration, save the name | ||
| 3130 | if ($sline =~ /^\+\{\s*$/ && | ||
| 3131 | $prevline =~ /^\+(?:(?:(?:$Storage|$Inline)\s*)*\s*$Type\s*)?($Ident)\(/) { | ||
| 3132 | $context_function = $1; | ||
| 3133 | } | ||
| 3134 | |||
| 3135 | # check if this appears to be the end of function declaration | ||
| 3136 | if ($sline =~ /^\+\}\s*$/) { | ||
| 3137 | undef $context_function; | ||
| 3138 | } | ||
| 3139 | |||
| 3129 | # check indentation of any line with a bare else | 3140 | # check indentation of any line with a bare else |
| 3130 | # (but not if it is a multiple line "if (foo) return bar; else return baz;") | 3141 | # (but not if it is a multiple line "if (foo) return bar; else return baz;") |
| 3131 | # if the previous line is a break or return and is indented 1 tab more... | 3142 | # if the previous line is a break or return and is indented 1 tab more... |
