summaryrefslogtreecommitdiff
path: root/autodoc.pl
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2019-05-29 16:06:51 -0600
committerKarl Williamson <khw@cpan.org>2019-05-30 18:13:29 -0600
commit8902d5545f28d09d06be64c2fec58139f1492af0 (patch)
treef1e402333794e224fa1e2352ef6ba5d5f61dd51d /autodoc.pl
parent0a60f600e691409aab41f710bbbd8801a3162143 (diff)
downloadperl-8902d5545f28d09d06be64c2fec58139f1492af0.tar.gz
autodoc.pl: Use embed.fnc entry when available
Having two different pod definitions for the same function leads to things being out of sync. This commit ignores the one in the '=for apidoc' line if there is one in embed.fnc. Doing so led to a bunch of changes in perlapi, showing that the apidoc lines were inaccurate. The ones in embed.fnc must be accurate enough to get perl to compile. I added a warning for when there's a redundant entry, and in the next commit I will remove the many such.
Diffstat (limited to 'autodoc.pl')
-rw-r--r--autodoc.pl45
1 files changed, 8 insertions, 37 deletions
diff --git a/autodoc.pl b/autodoc.pl
index c0643585d0..421d8de900 100644
--- a/autodoc.pl
+++ b/autodoc.pl
@@ -128,49 +128,20 @@ DOC:
}
$docs = "\n$docs" if $docs and $docs !~ /^\n/;
- # Check the consistency of the flags
- my ($embed_where, $inline_where);
- my ($embed_may_change, $inline_may_change);
-
+ # If the entry is also in embed.fnc, it should be defined
+ # completely there, but not here
my $embed_docref = delete $funcflags{$name};
if ($embed_docref and %$embed_docref) {
- $embed_where = $embed_docref->{flags} =~ /A/ ? 'api' : 'guts';
- $embed_may_change = $embed_docref->{flags} =~ /x/;
- $flags .= 'D' if $embed_docref->{flags} =~ /D/;
- $flags .= 'O' if $embed_docref->{flags} =~ /O/;
- $flags .= 'p' if $embed_docref->{flags} =~ /p/;
- $flags .= 'M' if $embed_docref->{flags} =~ /M/;
- $flags .= 'T' if $embed_docref->{flags} =~ /T/;
+ warn "embed.fnc entry overrides redundant information in"
+ . " '$proto_in_file' in $file" if $flags || $ret || @args;
+ $flags = $embed_docref->{'flags'};
+ $ret = $embed_docref->{'retval'};
+ @args = @{$embed_docref->{args}};
} else {
$missing{$name} = $file;
}
- if ($flags =~ /m/) {
- $inline_where = $flags =~ /A/ ? 'api' : 'guts';
- $inline_may_change = $flags =~ /x/;
-
- if (defined $embed_where && $inline_where ne $embed_where) {
- warn "Function '$name' inconsistency: embed.fnc says $embed_where, Pod says $inline_where";
- }
- if (defined $embed_may_change
- && $inline_may_change ne $embed_may_change) {
- my $message = "Function '$name' inconsistency: ";
- if ($embed_may_change) {
- $message .= "embed.fnc says 'may change', Pod does not";
- } else {
- $message .= "Pod says 'may change', embed.fnc does not";
- }
- warn $message;
- }
- } elsif (!defined $embed_where) {
- warn "Unable to place $name!\n";
- next;
- } else {
- $inline_where = $embed_where;
- $flags .= 'x' if $embed_may_change;
- @args = @{$embed_docref->{args}};
- $ret = $embed_docref->{retval};
- }
+ my $inline_where = $flags =~ /A/ ? 'api' : 'guts';
if (exists $docs{$inline_where}{$curheader}{$name}) {
warn "$0: duplicate API entry for '$name' in $inline_where/$curheader\n";