find-doc-nits: Check that man1 SYNOPSIS and OPTIONS contain same options

Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/15299)
This commit is contained in:
Dr. David von Oheimb 2021-05-16 15:38:19 +02:00 committed by Dr. David von Oheimb
parent 414823d2de
commit 9c1582807b
2 changed files with 21 additions and 7 deletions

View File

@ -13,13 +13,13 @@ I<command>
B<openssl>
B<list>
B<standard-commands> |
B<digest-commands> |
B<cipher-commands> |
B<cipher-algorithms> |
B<digest-algorithms> |
B<mac-algorithms> |
B<public-key-algorithms>
B<-standard-commands> |
B<-digest-commands> |
B<-cipher-commands> |
B<-cipher-algorithms> |
B<-digest-algorithms> |
B<-mac-algorithms> |
B<-public-key-algorithms>
B<openssl> B<no->I<XXX> [ I<options> ]

View File

@ -549,8 +549,10 @@ sub option_check {
err($id, "Malformed option [1] in SYNOPSIS: $&");
}
my @synopsis;
while ( $synopsis =~ /$markup_re/msg ) {
my $found = $&;
push @synopsis, $found if $found =~ /^B<-/;
print STDERR "$id:DEBUG[option_check] SYNOPSIS: found $found\n"
if $debug;
my $option_uw = normalise_option($id, $filename, $found);
@ -560,6 +562,7 @@ sub option_check {
# In OPTIONS, we look for =item paragraphs.
# (?=^\s*$) detects an empty line.
my @options;
while ( $options =~ /=item\s+(.*?)(?=^\s*$)/msg ) {
my $item = $&;
@ -573,8 +576,19 @@ sub option_check {
my $option_uw = normalise_option($id, $filename, $found);
err($id, "Malformed option in OPTIONS: $found")
if defined $option_uw && $option_uw eq '';
if ($found =~ /^B<-/) {
push @options, $found;
err($id, "OPTIONS entry $found missing from SYNOPSIS")
unless (grep /^\Q$found\E$/, @synopsis)
|| $id =~ /(openssl|-options)\.pod:1:$/;
}
}
}
foreach (@synopsis) {
my $option = $_;
err($id, "SYNOPSIS entry $option missing from OPTIONS")
unless (grep /^\Q$option\E$/, @options);
}
}
# Normal symbol form