Skip to content

Commit

Permalink
check-format.pl: fix detection of function body start
Browse files Browse the repository at this point in the history
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: David von Oheimb <david.von.oheimb@siemens.com>
(Merged from #20254)

(cherry picked from commit a49ade2)
  • Loading branch information
DDvO committed Mar 14, 2023
1 parent 70b6fcb commit f11bd37
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions util/check-format.pl
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,8 @@
my $has_label; # current line contains label
my $local_offset; # current extra indent due to label, switch case/default, or leading closing brace(s)
my $line_body_start; # number of line where last function body started, or 0
my $line_function_start; # number of line where last function definition started, used if $line_body_start != 0
my $last_function_header; # header containing name of last function defined, used if $line_function_start != 0
my $line_function_start; # number of line where last function definition started, used for $line_body_start
my $last_function_header; # header containing name of last function defined, used if $line_body_start != 0
my $line_opening_brace; # number of previous line with opening brace after do/while/for, optionally for if/else

my $keyword_opening_brace; # name of previous keyword, used if $line_opening_brace != 0
Expand Down Expand Up @@ -1129,7 +1129,7 @@ sub check_nested_nonblock_indents {
if (!$assignment_start && !$local_in_expr) {
# at end of function definition header (or stmt or var definition)
report("'{' not at line start") if length($head) != $preproc_offset && $head =~ m/\)\s*/; # at end of function definition header
$line_body_start = $contents =~ m/LONG BODY/ ? 0 : $line;
$line_body_start = $contents =~ m/LONG BODY/ ? 0 : $line if $line_function_start != 0;
}
} else {
$line_opening_brace = $line if $keyword_opening_brace =~ m/do|while|for/;
Expand Down

0 comments on commit f11bd37

Please sign in to comment.