Skip to content

Commit 76d4023

Browse files
committed
regen/embed.pl: Handle m with p flags
Prior to this commit these were illegal. This allows it when there is no pesky thread context in the way. This causes embed.fnc to generate macro 'Perl_foo' #defined to be macro 'foo'. This could be used to easily convert existing macros into having long names should that become a name space pollution problem. But more immediately, we have scattered around, various one line functions that simply call something else. Those were typically created to preserve the pre-existing API should someone be using the long name, and the implementation changed. This commit allows those (that don't use thread context) to be conveniently replaced by a macro. The next couple commits will do that for a couple of them.
1 parent 5403449 commit 76d4023

File tree

2 files changed

+15
-8
lines changed

2 files changed

+15
-8
lines changed

autodoc.pl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1899,7 +1899,7 @@ ($fh, $section_name, $element_name, $docref)
18991899
# Here, has a long name and we didn't create one just
19001900
# above. Check that there really is a long name entry.
19011901
my $real_proto = delete $protos{"Perl_$name"};
1902-
if ($real_proto) {
1902+
if ($real_proto || $flags =~ /m/) {
19031903

19041904
# Set up to redo the loop at the end. This iteration
19051905
# adds the short form; the redo causes its long form

regen/embed.pl

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -137,11 +137,18 @@ sub generate_proto_h {
137137

138138
die_at_end "$plain_func: S and p flags are mutually exclusive"
139139
if $flags =~ /S/ && $flags =~ /p/;
140-
die_at_end "$plain_func: m and $1 flags are mutually exclusive"
141-
if $has_mflag && $flags =~ /([pS])/;
142-
143-
die_at_end "$plain_func: u flag only usable with m" if $flags =~ /u/
144-
&& ! $has_mflag;
140+
if ($has_mflag) {
141+
if ($flags =~ /S/) {
142+
die_at_end "$plain_func: m and S flags are mutually exclusive";
143+
}
144+
elsif ($flags =~ /p/ && $has_context) {
145+
die_at_end "$plain_func: m flag with p flag currently requires"
146+
. " T flag";
147+
}
148+
}
149+
else {
150+
die_at_end "$plain_func: u flag only usable with m" if $flags =~ /u/;
151+
}
145152

146153
my ($static_flag, @extra_static_flags)= $flags =~/([SsIi])/g;
147154

@@ -500,9 +507,9 @@ sub embed_h {
500507
my $ind= $level ? " " : "";
501508
$ind .= " " x ($level-1) if $level>1;
502509
my $inner_ind= $ind ? " " : " ";
503-
unless ($flags =~ /[omM]/) {
510+
if ($flags !~ /[omM]/ or ($flags =~ /m/ && $flags =~ /p/)) {
504511
my $argc = scalar @$args;
505-
if ($flags =~ /T/) {
512+
if ($flags =~ /[Tm]/) {
506513
my $full_name = full_name($func, $flags);
507514
next if $full_name eq $func; # Don't output a no-op.
508515
$ret = indent_define($func, $full_name, $ind);

0 commit comments

Comments
 (0)