summaryrefslogtreecommitdiff
path: root/util/check-format.pl
diff options
context:
space:
mode:
authorDr. David von Oheimb <David.von.Oheimb@siemens.com>2022-07-13 00:05:48 +0200
committerHugo Landau <hlandau@openssl.org>2022-07-20 07:30:28 +0100
commit4e9fa07121abf3ebaaf7e0367bd9be3a8b273ebf (patch)
treec5077832af28a93728f176d57030efb6015ede2a /util/check-format.pl
parent63263147a3ad55cb26d7cfcdfca474ce324a15ac (diff)
downloadopenssl-new-4e9fa07121abf3ebaaf7e0367bd9be3a8b273ebf.tar.gz
check-format.pl: fix false positive on 'for(;; stmt)'
Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Hugo Landau <hlandau@openssl.org> (Merged from https://github.com/openssl/openssl/pull/18789)
Diffstat (limited to 'util/check-format.pl')
-rwxr-xr-xutil/check-format.pl1
1 files changed, 1 insertions, 0 deletions
diff --git a/util/check-format.pl b/util/check-format.pl
index 705455020d..9fcebb4382 100755
--- a/util/check-format.pl
+++ b/util/check-format.pl
@@ -677,6 +677,7 @@ while (<>) { # loop over all lines of all input files
$intra_line =~ s/\s+$//; # strip any (resulting) space at EOL
$intra_line =~ s/(for\s*\([^;]*);;(\))/"$1$2"/eg; # strip trailing ';;' in for (;;)
$intra_line =~ s/(for\s*\([^;]+;[^;]+);(\))/"$1$2"/eg; # strip trailing ';' in for (;;)
+ $intra_line =~ s/(for\s*\();(;)/"$1$2"/eg; # replace leading ';;' in for (;;) by ';'
$intra_line =~ s/(=\s*)\{ /"$1@ "/eg; # do not report {SPC in initializers such as ' = { 0, };'
$intra_line =~ s/, \};/, @;/g; # do not report SPC} in initializers such as ' = { 0, };'
report("space before '$1'") if $intra_line =~ m/[\w)\]]\s+(\+\+|--)/; # postfix ++/-- with preceding space