3 => [ 'SYNOPSIS', 'RETURN\s+VALUES' ],
5 => [ ],
7 => [ ] );
-my %default_sections =
- ( apps => 1,
- crypto => 3,
- ssl => 3 );
# Cross-check functions in the NAME and SYNOPSIS section.
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;
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\([^)]+\)/int/g;
+ $line =~ s/__declspec\([^)]+\)//;
+ if ( $line =~ /typedef.* (\S+);/ ) {
+ $sym = $1;
+ } elsif ( $line =~ /#define ([A-Za-z0-9_]+)/ ) {
+ $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;
+
+ # Do some sanity checks on the prototype.
+ print "$id prototype missing spaces around commas: $line\n"
+ if ( $line =~ /[a-z0-9],[^ ]/ );
}
foreach my $n ( keys %names ) {
my $id = "${filename}:1:";
- &name_synopsis($id, $filename, $contents);
+ &name_synopsis($id, $filename, $contents)
+ unless $contents =~ /=for comment generic/
+ or $filename =~ m@man[157]/@;
print "$id doesn't start with =pod\n"
if $contents !~ /^=pod/;
# Find what section this page is in. If run from "." assume
# section 3.
- my $section = $default_sections{$dirname} || 3;
- if ($contents =~ /^=for\s+comment\s+openssl_manual_section:\s*(\d+)\s*$/m) {
- $section = $1;
- }
+ my $section = 3;
+ $section = $1 if $dirname =~ /man([1-9])/;
foreach ((@{$mandatory_sections{'*'}}, @{$mandatory_sections{$section}})) {
print "$id doesn't have a head1 section matching $_\n"