From: Dr. David von Oheimb Date: Thu, 6 Jan 2022 22:14:27 +0000 (+0100) Subject: check-format.pl: Fix report on space before ';' and allow it after ')' X-Git-Tag: openssl-3.2.0-alpha1~3109 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c30bc4e2093f47a37736944da548653bc08d774d;p=thirdparty%2Fopenssl.git check-format.pl: Fix report on space before ';' and allow it after ')' Reviewed-by: Paul Dale (Merged from https://github.com/openssl/openssl/pull/17434) --- diff --git a/util/check-format-test-negatives.c b/util/check-format-test-negatives.c index 3ea792a72fc..4d925572c40 100644 --- a/util/check-format-test-negatives.c +++ b/util/check-format-test-negatives.c @@ -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 */ diff --git a/util/check-format.pl b/util/check-format.pl index 836fe30fa91..17bdc0aa15a 100755 --- a/util/check-format.pl +++ b/util/check-format.pl @@ -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'