check-format.pl: Report empty lines only if -s (--sloppy-spc) is not used

Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/12270)
This commit is contained in:
Dr. David von Oheimb 2020-06-07 14:53:20 +02:00
parent dc18781550
commit 174f4a4d6a
2 changed files with 5 additions and 5 deletions

View File

@ -334,11 +334,11 @@ void f_looong_body()
;
; /*@ 2 essentially empty lines before */
; /*@ 2 essentially empty lines before, if !sloppy-spc */
} /*@ function body length > 200 lines */
#if 0 /*@0 unclosed #if */
struct t { /*@0 unclosed brace at decl/block level */
enum { /*@0 unclosed brace at enum/expression level */
v = (1 /*@0 unclosed parenthesis */
etyp /*@0 empty line follows just before EOF: */
etyp /*@0 empty line follows just before EOF, if !sloppy-spc: */

View File

@ -1075,11 +1075,11 @@ while (<>) { # loop over all lines of all input files
}
if (m/^\s*$/) { # essentially empty line: just whitespace (and maybe a '\')
report("empty line at beginnig of file") if $line == 1;
report("empty line at beginnig of file") if $line == 1 && !$sloppy_SPC;
} else {
if ($line_before > 0) {
my $linediff = $line - $line_before - 1;
report("$linediff empty lines before") if $linediff > 1;
report("$linediff empty lines before") if $linediff > 1 && !$sloppy_SPC;
}
$line_before2 = $line_before;
$contents_before2 = $contents_before;
@ -1103,7 +1103,7 @@ while (<>) { # loop over all lines of all input files
if (eof) {
# check for essentially empty line (which may include a '\') just before EOF
report(($1 eq "\n" ? "empty line" : $2 ne "" ? "'\\'" : "whitespace")." at EOF")
if $contents =~ m/^(\s*(\\?)\s*)$/;
if $contents =~ m/^(\s*(\\?)\s*)$/ && !$sloppy_SPC;
# report unclosed expression-level nesting
check_nested_nonblock_indents("expr at EOF"); # also adapts @nested_block_indents