Rename "private" file, doc doc changes in CHANGES

Use err() for find-doc-nits -e output
Doing this meant we could remove the -s flag, so we do so; move
option/help stuff to top of script.
Add a CHANGES entry.
Rename missing to other.syms

Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/10039)
This commit is contained in:
Rich Salz 2019-09-27 14:03:57 -04:00 committed by Richard Levitte
parent df553b7941
commit 185ec4be6d
4 changed files with 43 additions and 45 deletions

View file

@ -15,6 +15,11 @@
pages for further details. pages for further details.
[Matt Caswell] [Matt Caswell]
*) Over two thousand fixes were made to the documentation, including:
adding missing command flags, better style conformance, documentation
of internals, etc.
[Rich Salz, Richard Levitte]
*) s390x assembly pack: add hardware-support for P-256, P-384, P-521, *) s390x assembly pack: add hardware-support for P-256, P-384, P-521,
X25519, X448, Ed25519 and Ed448. X25519, X448, Ed25519 and Ed448.
[Patrick Steuer] [Patrick Steuer]

View file

@ -729,7 +729,7 @@ generate: generate_apps generate_crypto_bn generate_crypto_objects \
.PHONY: doc-nits .PHONY: doc-nits
doc-nits: build_generated doc-nits: build_generated
(cd $(SRCDIR); $(PERL) util/find-doc-nits -n -p -s ) (cd $(SRCDIR); $(PERL) util/find-doc-nits -n -e )
# Test coverage is a good idea for the future # Test coverage is a good idea for the future
#coverage: $(PROGRAMS) $(TESTPROGRAMS) #coverage: $(PROGRAMS) $(TESTPROGRAMS)

View file

@ -33,24 +33,39 @@ our($opt_u);
our($opt_v); our($opt_v);
our($opt_c); our($opt_c);
# Print usage message and exit.
sub help { sub help {
print <<EOF; print <<EOF;
Find small errors (nits) in documentation. Options: Find small errors (nits) in documentation. Options:
-c List undocumented commands and options
-d Detailed list of undocumented (implies -u) -d Detailed list of undocumented (implies -u)
-e Detailed list of new undocumented (implies -v) -e Detailed list of new undocumented (implies -v)
-s Same as -e except no output is generated if nothing is undocumented -h Print this help message
-o Causes -e/-v to count symbols added since 1.1.1 as new (implies -v)
-l Print bogus links -l Print bogus links
-n Print nits in POD pages -n Print nits in POD pages
-p Warn if non-public name documented (implies -n) -o Causes -e/-v to count symbols added since 1.1.1 as new (implies -v)
-u Count undocumented functions -u Count undocumented functions
-v Count new undocumented functions -v Count new undocumented functions
-h Print this help message
-c List undocumented commands and options
EOF EOF
exit; exit;
} }
getopts('cdehlnouv');
help() if $opt_h;
$opt_u = 1 if $opt_d;
$opt_v = 1 if $opt_o || $opt_e;
die "Cannot use both -u and -v"
if $opt_u && $opt_v;
die "Cannot use both -d and -e"
if $opt_d && $opt_e;
# We only need to check c, l, n, u and v.
# Options d, e, o imply one of the above.
die "Need one of -[cdehlnouv] flags.\n"
unless $opt_c or $opt_l or $opt_n or $opt_u or $opt_v;
my $temp = '/tmp/docnits.txt'; my $temp = '/tmp/docnits.txt';
my $OUT; my $OUT;
my %public; my %public;
@ -109,9 +124,11 @@ sub name_synopsis {
if %foundfilenames; if %foundfilenames;
err($id, "$simplename (filename) missing from NAME section") err($id, "$simplename (filename) missing from NAME section")
unless $foundfilename; unless $foundfilename;
foreach my $n ( keys %names ) { if ( $filename !~ /internal/ ) {
err($id, "$n is not public") foreach my $n ( keys %names ) {
if $opt_p and !defined $public{$n}; err($id, "$n is not public")
if !defined $public{$n};
}
} }
# Find all functions in SYNOPSIS # Find all functions in SYNOPSIS
@ -525,7 +542,6 @@ sub parsenum {
close $IN; close $IN;
print "# Found ", scalar(@apis), " in $file\n" unless $opt_p;
return sort @apis; return sort @apis;
} }
@ -538,7 +554,7 @@ sub getdocced
my %podinfo = extract_pod_info($pod); my %podinfo = extract_pod_info($pod);
foreach my $n ( @{$podinfo{names}} ) { foreach my $n ( @{$podinfo{names}} ) {
$return{$n} = $pod; $return{$n} = $pod;
print "# Duplicate $n in $pod and $dups{$n}\n" err("# Duplicate $n in $pod and $dups{$n}")
if defined $dups{$n} && $dups{$n} ne $pod; if defined $dups{$n} && $dups{$n} ne $pod;
$dups{$n} = $pod; $dups{$n} = $pod;
} }
@ -577,8 +593,6 @@ sub checkmacros {
@missing = loadmissing('util/missingmacro.txt'); @missing = loadmissing('util/missingmacro.txt');
} }
print "# Checking macros (approximate)\n"
if !$opt_s;
foreach my $f ( glob('include/openssl/*.h') ) { foreach my $f ( glob('include/openssl/*.h') ) {
# Skip some internals we don't want to document yet. # Skip some internals we don't want to document yet.
next if $f eq 'include/openssl/asn1.h'; next if $f eq 'include/openssl/asn1.h';
@ -598,15 +612,15 @@ sub checkmacros {
# Skip macros known to be missing # Skip macros known to be missing
next if $opt_v && grep( /^$macro$/, @missing); next if $opt_v && grep( /^$macro$/, @missing);
print "$f:$macro\n" err("$f:", "macro $macro undocumented")
if $opt_d || $opt_e; if $opt_d || $opt_e;
$count++; $count++;
$seen{$macro} = 1; $seen{$macro} = 1;
} }
close(IN); close(IN);
} }
print "# Found $count macros missing\n" err("# $count macros undocumented (count is approximate)")
if !$opt_s || $count > 0; if $count > 0;
} }
sub printem { sub printem {
@ -627,13 +641,13 @@ sub printem {
# Skip functions known to be missing # Skip functions known to be missing
next if $opt_v && grep( /^$func$/, @missing); next if $opt_v && grep( /^$func$/, @missing);
print "$libname:$func\n" err("$libname:", "function $func undocumented")
if $opt_d || $opt_e; if $opt_d || $opt_e;
$count++; $count++;
$seen{$func} = 1; $seen{$func} = 1;
} }
print "# Found $count missing from $numfile\n\n" err("# $count in $numfile are not documented")
if !$opt_s || $count > 0; if $count > 0;
} }
@ -721,6 +735,7 @@ sub checklinks {
} }
} }
# Load the public symbol/macro names
sub publicize { sub publicize {
foreach my $name ( parsenum('util/libcrypto.num') ) { foreach my $name ( parsenum('util/libcrypto.num') ) {
$public{$name} = 1; $public{$name} = 1;
@ -728,7 +743,7 @@ sub publicize {
foreach my $name ( parsenum('util/libssl.num') ) { foreach my $name ( parsenum('util/libssl.num') ) {
$public{$name} = 1; $public{$name} = 1;
} }
foreach my $name ( parsenum('util/private.num') ) { foreach my $name ( parsenum('util/other.syms') ) {
$public{$name} = 1; $public{$name} = 1;
} }
} }
@ -811,25 +826,6 @@ sub checkflags {
} }
} }
getopts('cdesolnphuv');
help() if $opt_h;
$opt_n = 1 if $opt_p;
$opt_u = 1 if $opt_d;
$opt_e = 1 if $opt_s;
$opt_v = 1 if $opt_o || $opt_e;
die "Cannot use both -u and -v"
if $opt_u && $opt_v;
die "Cannot use both -d and -e"
if $opt_d && $opt_e;
# We only need to check c, l, n, u and v.
# Options d, e, s, o and p imply one of the above.
die "Need one of -[cdesolnpuv] flags.\n"
unless $opt_c or $opt_l or $opt_n or $opt_u or $opt_v;
if ( $opt_c ) { if ( $opt_c ) {
my @commands = (); my @commands = ();
@ -876,15 +872,12 @@ if ( $opt_l ) {
} }
if ( $opt_n ) { if ( $opt_n ) {
publicize() if $opt_p; publicize();
foreach (@ARGV ? @ARGV : (glob('doc/*/*.pod'), glob('doc/*/*.pod.in'))) { foreach (@ARGV ? @ARGV : (glob('doc/*/*.pod'), glob('doc/*/*.pod.in'))) {
check($_); check($_);
} }
{ foreach (@ARGV ? @ARGV : glob('doc/internal/*/*.pod')) {
local $opt_p = undef; check($_);
foreach (@ARGV ? @ARGV : glob('doc/internal/*/*.pod')) {
check($_);
}
} }
# If not given args, check that all man1 commands are named properly. # If not given args, check that all man1 commands are named properly.