[openssl-commits] [openssl] master update
Rich Salz
rsalz at openssl.org
Thu Nov 17 01:42:51 UTC 2016
The branch master has been updated
via 71a8b85574aefaad93e4fe50ed2fc7a5923c6b29 (commit)
from e1940e9f7a73bf3a560fbe3550a9b69a612118ec (commit)
- Log -----------------------------------------------------------------
commit 71a8b85574aefaad93e4fe50ed2fc7a5923c6b29
Author: Rich Salz <rsalz at openssl.org>
Date: Sun Nov 13 01:00:44 2016 -0500
Merge find-undoc-api into find-doc-nits
Use \b on NOEXIST and EXPORT_VAR_AS_FUNC patterns as suggested by Andy.
Reviewed-by: Andy Polyakov <appro at openssl.org>
(Merged from https://github.com/openssl/openssl/pull/1912)
-----------------------------------------------------------------------
Summary of changes:
util/find-doc-nits.pl | 98 ++++++++++++++++++++++++++++++++++++++++++++++++--
util/find-undoc-api.pl | 79 ----------------------------------------
2 files changed, 95 insertions(+), 82 deletions(-)
delete mode 100755 util/find-undoc-api.pl
diff --git a/util/find-doc-nits.pl b/util/find-doc-nits.pl
index 9d73c99..8945fa6 100755
--- a/util/find-doc-nits.pl
+++ b/util/find-doc-nits.pl
@@ -13,9 +13,28 @@ use strict;
use Pod::Checker;
use File::Find;
use File::Basename;
+use File::Spec::Functions;
use Getopt::Std;
+use lib catdir(dirname($0), "perl");
+use OpenSSL::Util::Pod;
+# Options.
our($opt_s);
+our($opt_u);
+our($opt_h);
+our($opt_n);
+
+sub help()
+{
+ print <<EOF;
+Find small errors (nits) in documentation. Options:
+ -n Print nits in POD pages
+ -s Also print missing sections in POD pages (implies -n)
+ -u List undocumented functions
+ -h Print this help message
+EOF
+ exit;
+}
my $temp = '/tmp/docnits.txt';
my $OUT;
@@ -173,10 +192,83 @@ sub check()
unlink $temp || warn "Can't remove $temp, $!";
}
-getopts('s');
+my %dups;
+
+sub parsenum()
+{
+ my $file = shift;
+ my @apis;
+
+ open my $IN, '<', $file
+ or die "Can't open $file, $!, stopped";
+
+ while ( <$IN> ) {
+ next if /\bNOEXIST\b/;
+ next if /\bEXPORT_VAR_AS_FUNC\b/;
+ push @apis, $1 if /([^\s]+).\s/;
+ }
+
+ close $IN;
+
+ print "# Found ", scalar(@apis), " in $file\n";
+ return sort @apis;
+}
+
+sub getdocced()
+{
+ my $dir = shift;
+ my %return;
+
+ foreach my $pod ( glob("$dir/*.pod") ) {
+ my %podinfo = extract_pod_info($pod);
+ foreach my $n ( @{$podinfo{names}} ) {
+ $return{$n} = $pod;
+ print "# Duplicate $n in $pod and $dups{$n}\n"
+ if defined $dups{$n} && $dups{$n} ne $pod;
+ $dups{$n} = $pod;
+ }
+ }
+
+ return %return;
+}
+
+my %docced;
+
+sub printem()
+{
+ my $libname = shift;
+ my $numfile = shift;
+ my $count = 0;
+
+ foreach my $func ( &parsenum($numfile) ) {
+ next if $docced{$func};
+
+ # Skip ASN1 utilities
+ next if $func =~ /^ASN1_/;
+
+ print "$libname:$func\n";
+ $count++;
+ }
+ print "# Found $count missing from $numfile\n\n";
+}
+
+
+getopts('nshu');
-foreach (@ARGV ? @ARGV : glob('doc/*/*.pod')) {
- &check($_);
+&help() if ( $opt_h );
+
+if ( $opt_n or $opt_s ) {
+ foreach (@ARGV ? @ARGV : glob('doc/*/*.pod')) {
+ &check($_);
+ }
+}
+if ( $opt_u ) {
+ my %temp = &getdocced('doc/man3');
+ foreach ( keys %temp ) {
+ $docced{$_} = $temp{$_};
+ }
+ &printem('crypto', 'util/libcrypto.num');
+ &printem('ssl', 'util/libssl.num');
}
exit;
diff --git a/util/find-undoc-api.pl b/util/find-undoc-api.pl
deleted file mode 100755
index 585ccc4..0000000
--- a/util/find-undoc-api.pl
+++ /dev/null
@@ -1,79 +0,0 @@
-#! /usr/bin/env perl
-# Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.
-#
-# Licensed under the OpenSSL license (the "License"). You may not use
-# this file except in compliance with the License. You can obtain a copy
-# in the file LICENSE in the source distribution or at
-# https://www.openssl.org/source/license.html
-
-use strict;
-use warnings;
-
-use File::Spec::Functions;
-use File::Basename;
-#use File::Copy;
-#use File::Path;
-use lib catdir(dirname($0), "perl");
-use OpenSSL::Util::Pod;
-
-my %dups;
-
-sub parsenum()
-{
- my $file = shift;
- my @apis;
-
- open my $IN, '<', $file
- or die "Can't open $file, $!, stopped";
-
- while ( <$IN> ) {
- next if /\sNOEXIST/;
- next if /EXPORT_VAR_AS_FUNC/;
- push @apis, $1 if /([^\s]+).\s/;
- }
-
- close $IN;
-
- print "# Found ", scalar(@apis), " in $file\n";
- return sort @apis;
-}
-
-sub getdocced()
-{
- my $dir = shift;
- my %return;
-
- foreach my $pod ( glob("$dir/*.pod") ) {
- my %podinfo = extract_pod_info($pod);
- foreach my $n ( @{$podinfo{names}} ) {
- $return{$n} = $pod;
- print "# Duplicate $n in $pod and $dups{$n}\n"
- if defined $dups{$n} && $dups{$n} ne $pod;
- $dups{$n} = $pod;
- }
- }
-
- return %return;
-}
-
-my %docced = &getdocced('doc/man3');
-
-sub printem()
-{
- my $numfile = shift;
- my $count = 0;
-
- foreach my $func ( &parsenum($numfile) ) {
- next if $docced{$func};
-
- # Skip ASN1 utilities
- next if $func =~ /^ASN1_/;
-
- print $func, "\n";
- $count++;
- }
- print "# Found $count missing from $numfile\n\n";
-}
-
-&printem('util/libcrypto.num');
-&printem('util/libssl.num');
More information about the openssl-commits
mailing list