test/evptests.txt: add more XTS tests.
[openssl.git] / util / find-doc-nits.pl
index b0fab953539a913add600980153b8a1115089f48..69d7c93521363fc1cd3356c3de681b1cdea0268f 100755 (executable)
@@ -38,31 +38,50 @@ sub name_synopsis()
     my $filename = shift;
     my $contents = shift;
 
-    # If it's a generic page (all lowercase), or apps, skip it.
-    return if $filename =~ /[a-z]+\.pod/;
-    return if $filename =~ m@/apps/@;
-
     # Get NAME section and all words in it.
     return unless $contents =~ /=head1 NAME(.*)=head1 SYNOPSIS/ms;
     my $tmp = $1;
     $tmp =~ tr/\n/ /;
     $tmp =~ s/-.*//g;
     $tmp =~ s/,//g;
+
+    my $dirname = dirname($filename);
+    my $simplename = basename($filename);
+    $simplename =~ s/.pod$//;
+    my $foundfilename = 0;
+    my %foundfilenames = ();
     my %names;
     foreach my $n ( split ' ', $tmp ) {
         $names{$n} = 1;
+        $foundfilename++ if $n eq $simplename;
+        $foundfilenames{$n} = 1
+            if -f "$dirname/$n.pod" && $n ne $simplename;
     }
+    print "$id the following exist as other .pod files:\n",
+        join(" ", sort keys %foundfilenames), "\n"
+        if %foundfilenames;
+    print "$id $simplename (filename) missing from NAME section\n",
+        unless $foundfilename;
 
     # Find all functions in SYNOPSIS
     return unless $contents =~ /=head1 SYNOPSIS(.*)=head1 DESCRIPTION/ms;
     my $syn = $1;
     foreach my $line ( split /\n+/, $syn ) {
-        next if $line =~ /typedef/;
-        next if $line =~ /STACK_OF/;
-        next unless $line =~ /([A-Za-z0-9_]+)\(/;
-        print "$id $1 missing from NAME section\n"
-            unless defined $names{$1};
-        $names{$1} = 2;
+        my $sym;
+        $line =~ s/STACK_OF\([^)]+\)//;
+        if ( $line =~ /typedef.* (\S+);/ ) {
+            $sym = $1;
+        } elsif ( $line =~ /#define (\S+)/ ) {
+            $sym = $1;
+        } elsif ( $line =~ /([A-Za-z0-9_]+)\(/ ) {
+            $sym = $1;
+        }
+        else {
+            next;
+        }
+        print "$id $sym missing from NAME section\n"
+            unless defined $names{$sym};
+        $names{$sym} = 2;
     }
 
     foreach my $n ( keys %names ) {
@@ -86,7 +105,10 @@ sub check()
 
     my $id = "${filename}:1:";
 
-    &name_synopsis($id, $filename, $contents);
+    &name_synopsis($id, $filename, $contents)
+        unless $contents =~ /=for comment generic/
+            or $contents =~ /=for comment openssl_manual_section:7/
+            or $filename =~ m@/apps/@;
 
     print "$id doesn't start with =pod\n"
         if $contents !~ /^=pod/;