fix false positive of check-format.pl reporting '{1 stmt}' after multi-line 'if(expr)'
authorDr. David von Oheimb <David.von.Oheimb@siemens.com>
Mon, 9 Mar 2020 13:42:40 +0000 (14:42 +0100)
committerDr. David von Oheimb <David.von.Oheimb@siemens.com>
Wed, 18 Mar 2020 12:43:36 +0000 (13:43 +0100)
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: David von Oheimb <david.von.oheimb@siemens.com>
(Merged from https://github.com/openssl/openssl/pull/11285)

util/check-format.pl

index af77d209200cd5109154f6f48aebf4ca1eb51ba9..a0b493e600f9ba3139e3d3821e42a982fba69e50 100644 (file)
@@ -868,7 +868,8 @@ while (<>) { # loop over all lines of all input files
     if ($paren_expr_start || $return_enum_start || $assignment_start)
     {
         my ($head, $mid, $tail) = ($1, $3, $4);
-        $keyword_opening_brace = $mid if $mid ne "=" && $tail =~ m/\{/;
+        $keyword_opening_brace = $mid if $mid ne "=";
+        # to cope with multi-line expressions, do this also if !($tail =~ m/\{/)
         push @in_if_hanging_offsets, $hanging_offset if $mid eq "if";
 
         # already handle $head, i.e., anything before expression