]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
check-format.pl: Report empty lines only if -s (--sloppy-spc) is not used
authorDr. David von Oheimb <David.von.Oheimb@siemens.com>
Sun, 7 Jun 2020 12:53:20 +0000 (14:53 +0200)
committerDr. David von Oheimb <David.von.Oheimb@siemens.com>
Mon, 20 Jul 2020 09:17:34 +0000 (11:17 +0200)
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/12270)

util/check-format-test-positives.c
util/check-format.pl

index 40077925ff172e70d3bc4277be7fccc7c0962cbd..7d9bbea5c7c9f32eb427b923047154555d0c59bb 100644 (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: */
 
index 2bbf7e7c54a276fe48ef683fc29053adbeb453cf..0619240f828b3979ca0316d04e76314f9c6f4bdf 100755 (executable)
@@ -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