diff --git a/util/check-format.pl b/util/check-format.pl index 04dde14c9d..c2277013ef 100755 --- a/util/check-format.pl +++ b/util/check-format.pl @@ -12,7 +12,7 @@ # - check formatting of C source according to OpenSSL coding style # # usage: -# check-format.pl [-l|--sloppy-len] [-l|--sloppy-bodylen] +# check-format.pl [-l|--strict-len] [-b|--sloppy-bodylen] # [-s|--sloppy-space] [-c|--sloppy-comment] # [-m|--sloppy-macro] [-h|--sloppy-hang] # [-e|--eol-comment] [-1|--1-stmt] @@ -28,8 +28,8 @@ # Still it should be useful for detecting most typical glitches. # # options: -# -l | --sloppy-len increase accepted max line length from 80 to 84 -# -l | --sloppy-bodylen do not report function body length > 200 +# -l | --strict-len decrease accepted max line length from 100 to 80 +# -b | --sloppy-bodylen do not report function body length > 200 # -s | --sloppy-space do not report whitespace nits # -c | --sloppy-comment do not report indentation of comments # Otherwise for each multi-line comment the indentation of @@ -93,7 +93,8 @@ use strict; use POSIX; use constant INDENT_LEVEL => 4; -use constant MAX_LINE_LENGTH => 80; +use constant MAX_LINE_LENGTH => 100; +use constant STRICT_LINE_LENGTH => 80; use constant MAX_BODY_LENGTH => 200; # global variables @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@ -110,8 +111,8 @@ my $extended_1_stmt = 0; while ($ARGV[0] =~ m/^-(\w|-[\w\-]+)$/) { my $arg = $1; shift; - if ($arg =~ m/^(l|-sloppy-len)$/) { - $max_length += INDENT_LEVEL; + if ($arg =~ m/^(l|-strict-len)$/) { + $max_length = STRICT_LINE_LENGTH; } elsif ($arg =~ m/^(b|-sloppy-bodylen)$/) { $sloppy_bodylen = 1; } elsif ($arg =~ m/^(s|-sloppy-space)$/) { @@ -425,7 +426,7 @@ sub check_indent { # used for lines outside multi-line string literals # do not report if contents have been shifted left of nested expr indent (but not as far as stmt indent) # apparently aligned to the right in order to fit within line length limit return if $stmt_indent < $count && $count < $expr_indent && - length($contents) == MAX_LINE_LENGTH + length("\n"); + length($contents) == $max_length + length("\n"); } report("indent = $count != $ref_indent for $ref_desc". @@ -677,7 +678,7 @@ while (<>) { # loop over all lines of all input files && length($1) < $max_length) # this allows over-long trailing string literals with beginning col before $max_length ) { - report("line length = $len > ".MAX_LINE_LENGTH); + report("line length = $len > ".$max_length); } # handle C++ / C99 - style end-of-line comments