summaryrefslogtreecommitdiff
path: root/autodoc.pl
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2020-10-08 06:37:40 -0600
committerKarl Williamson <khw@cpan.org>2020-10-08 08:23:29 -0600
commit9e728159a33ae479369731865c6c86daea2deeb7 (patch)
treeab4cff722cb913c38289361fe40e57139a8ec151 /autodoc.pl
parent4f0d304ec835f478a4dd9b4ab7af01f5b826c6d7 (diff)
downloadperl-9e728159a33ae479369731865c6c86daea2deeb7.tar.gz
autodoc: Add ability to specify typedefs
Typedefs are part of the API; this allows us to document basic things such as CV, U8 that aren't currently covered.
Diffstat (limited to 'autodoc.pl')
-rw-r--r--autodoc.pl20
1 files changed, 13 insertions, 7 deletions
diff --git a/autodoc.pl b/autodoc.pl
index 40e1fd4c42..81ee3d965f 100644
--- a/autodoc.pl
+++ b/autodoc.pl
@@ -365,15 +365,16 @@ sub autodoc ($$) { # parse a file and extract documentation info
$ret_type = $embed_ret_type;
@args = @embed_args;
}
- elsif ($flags !~ /m/) { # Not in embed.fnc, is missing if not a macro
+ elsif ($flags !~ /[my]/) { # Not in embed.fnc, is missing if not
+ # a macro or typedef
$missing{$element_name} = $file;
}
die "flag $1 is not legal (for function $element_name (from $file))"
- if $flags =~ / ( [^AabCDdEeFfhiMmNnTOoPpRrSsUuWXx] ) /x;
+ if $flags =~ / ( [^AabCDdEeFfhiMmNnTOoPpRrSsUuWXxy] ) /x;
- die "'u' flag must also have 'm' flag' for $element_name"
- if $flags =~ /u/ && $flags !~ /m/;
+ die "'u' flag must also have 'm' or 'y' flags' for $element_name"
+ if $flags =~ /u/ && $flags !~ /[my]/;
warn ("'$element_name' not \\w+ in '$proto_in_file' in $file")
if $flags !~ /N/ && $element_name !~ / ^ [_[:alpha:]] \w* $ /x;
@@ -825,6 +826,7 @@ sub parse_config_h {
$handled = 1;
}
else {
+ my $flags = "";
if ($has_defn && ! $has_args) {
$configs{$name}{args} = 1;
}
@@ -883,6 +885,7 @@ sub parse_config_h {
}
elsif ($name =~ / $sb t $sb /x) {
$configs{$name}{'section'} = 'Typedef names';
+ $flags .= 'y';
}
elsif ( $name =~ / ^ PERL_ ( PRI | SCN ) | $sb FORMAT $sb /x
&& $configs{$name}{pod} =~ m/ \b format \b /ix)
@@ -1006,8 +1009,9 @@ sub parse_config_h {
my $section = $configs{$name}{'section'};
die "Internal error: '$section' not in \%valid_sections"
unless grep { $_ eq $section } keys %valid_sections;
- my $flags = 'AdmnT';
+ $flags .= 'AdmnT';
$flags .= 'U' unless defined $configs{$name}{usage};
+
$docs{'api'}{$section}{$name}{flags} = $flags;
$docs{'api'}{$section}{$name}{pod} = $configs{$name}{pod};
$docs{'api'}{$section}{$name}{ret_type} = "";
@@ -1096,8 +1100,10 @@ sub docout ($$$) { # output the docs for one function
}
}
- if ($flags =~ /U/) { # no usage
- warn("U and s flags are incompatible") if $flags =~ /s/;
+ if ($flags =~ /[Uy]/) { # no usage; typedefs are considered simple enough
+ # to never warrant a usage line
+ warn("U and s flags are incompatible")
+ if $flags =~ /U/ && $flags =~ /s/;
# nothing
} else {