summaryrefslogtreecommitdiff
path: root/autodoc.pl
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2022-05-03 05:57:00 -0600
committerKarl Williamson <khw@cpan.org>2022-05-03 06:25:21 -0600
commit4be56a7dcc87c5118fec95660e633d3ab27885d0 (patch)
treeea05afbe0630c6902a1f89870701e18d6542d814 /autodoc.pl
parentb63f8ed45dd7f3116ce5aeaf340ebe6d5fec7750 (diff)
downloadperl-4be56a7dcc87c5118fec95660e633d3ab27885d0.tar.gz
autodoc.pl: Include thread context in arg calculation
When several different functions are grouped together into one entry, only the signature of the first one is output provided that all have the same signature (except for the function name). Until this commit, whether or not there was a hidden thread context parameter was not considered in this calculation. This could lead to confusion.
Diffstat (limited to 'autodoc.pl')
-rw-r--r--autodoc.pl8
1 files changed, 6 insertions, 2 deletions
diff --git a/autodoc.pl b/autodoc.pl
index b8208be12e..8fef2e3838 100644
--- a/autodoc.pl
+++ b/autodoc.pl
@@ -1296,7 +1296,8 @@ sub docout ($$$) { # output the docs for one function group
}
# Look through all the items in this entry. If all have the same
- # return type and arguments, only the main entry is displayed.
+ # return type and arguments (including thread context), only the
+ # main entry is displayed.
# Also, find the longest return type and longest name so that if
# multiple ones are shown, they can be vertically aligned nicely
my $need_individual_usage = 0;
@@ -1304,12 +1305,15 @@ sub docout ($$$) { # output the docs for one function group
my $base_ret_type = $items[0]->{ret_type};
my $longest_ret = length $base_ret_type;
my @base_args = $items[0]->{args}->@*;
+ my $base_thread_context = $items[0]->{flags} =~ /T/;
for (my $i = 1; $i < @items; $i++) {
no warnings 'experimental::smartmatch';
my $item = $items[$i];
$need_individual_usage = 1
if $item->{ret_type} ne $base_ret_type
- || ! ($item->{args}->@* ~~ @base_args);
+ || ! ($item->{args}->@* ~~ @base_args)
+ || ( $item->{flags} =~ /T/
+ != $base_thread_context);
my $ret_length = length $item->{ret_type};
$longest_ret = $ret_length if $ret_length > $longest_ret;
my $name_length = length $item->{name};