summaryrefslogtreecommitdiffstats
path: root/util/check-format.pl
diff options
context:
space:
mode:
authorDr. David von Oheimb <David.von.Oheimb@siemens.com>2020-03-10 08:12:57 +0100
committerDr. David von Oheimb <David.von.Oheimb@siemens.com>2020-03-18 13:43:36 +0100
commit90a7c90500ddb3c29eff988a8840ffc1e3e44e7a (patch)
tree7a7cfb94947ab96dd29cf037261037a1ae75d305 /util/check-format.pl
parentmake util/check-format.pl script executable (diff)
downloadopenssl-90a7c90500ddb3c29eff988a8840ffc1e3e44e7a.tar.xz
openssl-90a7c90500ddb3c29eff988a8840ffc1e3e44e7a.zip
fix false positive of check-format.pl regarding '#if' on preceding line; extend negative tests
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)
Diffstat (limited to 'util/check-format.pl')
-rwxr-xr-xutil/check-format.pl2
1 files changed, 1 insertions, 1 deletions
diff --git a/util/check-format.pl b/util/check-format.pl
index a0b493e600..b7c28f15ef 100755
--- a/util/check-format.pl
+++ b/util/check-format.pl
@@ -1001,7 +1001,7 @@ while (<>) { # loop over all lines of all input files
# check for opening brace after if/while/for/switch/do not on same line
# note that "no '{' on same line after '} else'" is handled further below
if (/^[\s@]*{/ && # leading '{'
- $line_before > 0 &&
+ $line_before > 0 && !($contents_before_ =~ m/^\s*#/) && # not preprocessor directive '#if
(my ($head, $mid, $tail) = ($contents_before_ =~ m/(^|^.*\W)(if|while|for|switch|do)(\W.*$|$)/))) {
my $brace_after = $tail =~ /^[\s@]*{/; # any whitespace or comments then '{'
report("'{' not on same line as preceding '$mid'") if !$brace_after;