check-format.pl: Fix report on space before ';' and allow it after ')'

Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/17434)
This commit is contained in:
Dr. David von Oheimb 2022-01-06 23:14:27 +01:00 committed by Pauli
parent d45c0e1a5e
commit c30bc4e209
2 changed files with 3 additions and 1 deletions

View File

@ -70,6 +70,8 @@ int f(void) /*
;
for (i = 0; i < 1;)
;
for (;;) ; /* should not trigger: space before ';' */
lab: ; /* should not trigger: space before ';' */
#if X
if (1) /* bad style: just part of control structure depends on #if */

View File

@ -684,7 +684,7 @@ while (<>) { # loop over all lines of all input files
report("space before '$1'") if $intra_line =~ m/\s(\.|->)/; # '.' or '->' with preceding space
report("space after '$1'") if $intra_line =~ m/(\.|->)\s/; # '.' or '->' with following space
$intra_line =~ s/\-\>|\+\+|\-\-/@/g; # blind '->,', '++', and '--'
report("space before '$2'") if $intra_line =~ m/[^:]\s+(;)/; # space before ';' but not after ':'
report("space before '$1'") if $intra_line =~ m/[^:)]\s+(;)/; # space before ';' but not after ':' or ')'
report("space before '$1'") if $intra_line =~ m/\s([,)\]])/; # space before ,)]
report("space after '$1'") if $intra_line =~ m/([(\[~!])\s/; # space after ([~!
report("space after '$1'") if $intra_line =~ m/(defined)\s/; # space after 'defined'