In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/d72cd2ebf566c9150ba4911766b066626c2f2e63?hp=b245455d191e476f86c230c28cb55fabbc5f21ca>
- Log ----------------------------------------------------------------- commit d72cd2ebf566c9150ba4911766b066626c2f2e63 Author: David Mitchell <[email protected]> Date: Fri Sep 19 13:12:23 2014 +0100 perldelta: mention the op_private work M pod/perldelta.pod commit 9927527652fc4dfb3aba4dcf487b9b7684b9e942 Author: David Mitchell <[email protected]> Date: Fri Sep 19 10:51:15 2014 +0100 add $VERSION to B::Op_private Since this is an auto-generated .pm file, set $VERSION to the perl version (i.e. 5.mmmnnn), the same trick that Config.pm does. Since regen scripts are usually executed by a different perl, and the current perl may not be built yet, don't rely on $]; instead get the info from patchlevel.h. Add a new sub for this purpose, perl_version(), to regen/regen_lib.pl. (I feel that such a routine should already exist somewhere, but I couldn't find such a beastie.) M lib/B/Op_private.pm M regen/opcode.pl M regen/regen_lib.pl ----------------------------------------------------------------------- Summary of changes: lib/B/Op_private.pm | 3 +++ pod/perldelta.pod | 14 +++++++++++++- regen/opcode.pl | 2 ++ regen/regen_lib.pl | 20 ++++++++++++++++++++ 4 files changed, 38 insertions(+), 1 deletion(-) diff --git a/lib/B/Op_private.pm b/lib/B/Op_private.pm index f7948d3..6c77420 100644 --- a/lib/B/Op_private.pm +++ b/lib/B/Op_private.pm @@ -109,6 +109,9 @@ package B::Op_private; our %bits; + +our $VERSION = "5.021004"; + $bits{$_}{3} = 'OPpENTERSUB_AMPER' for qw(entersub rv2cv); $bits{$_}{4} = 'OPpENTERSUB_DB' for qw(entersub rv2cv); $bits{$_}{2} = 'OPpENTERSUB_HASTARG' for qw(entersub rv2cv); diff --git a/pod/perldelta.pod b/pod/perldelta.pod index e8b373e..9e9419b 100644 --- a/pod/perldelta.pod +++ b/pod/perldelta.pod @@ -148,7 +148,8 @@ dual-life modules would have a F<Changes> file that could be cribbed. =item * -XXX +L<B::Op_private> provides detailed information about the flags used in +the C<op_private> field of perl opcodes. =back @@ -589,6 +590,17 @@ certain non-Perl libraries called from XS, such as C<Gtk> do so. When this happens, Perl needs to be told that the locale has changed. Use this function to do so, before returning to Perl. +=item * + +The defines and labels for the flags in the C<op_private> field of OPs +are now auto-generated from data in F<regen/op_private>. The noticeable +affect of this is that some of the flag output of C<Concise> might differ +slightly, and the flag output of C<perl -Dx> may differ considerably (they +both use the same set of labels now). Also in debugging builds, there +is a new assert in C<op_free()> that checks that the op doesn't have any +unrecognised flags set in C<op_private>. + + =back =head1 Selected Bug Fixes diff --git a/regen/opcode.pl b/regen/opcode.pl index ee71935..38c235f 100755 --- a/regen/opcode.pl +++ b/regen/opcode.pl @@ -490,6 +490,8 @@ EOF # remove podcheck.t-defeating leading char $header =~ s/^\@//gm; print $fh $header; + my $v = (::perl_version())[3]; + print $fh qq{\nour \$VERSION = "$v";\n\n}; # for each flag/bit combination, find the ops which use it my %combos; diff --git a/regen/regen_lib.pl b/regen/regen_lib.pl index b64e0b0..463b5cd 100644 --- a/regen/regen_lib.pl +++ b/regen/regen_lib.pl @@ -224,4 +224,24 @@ sub wrap { Text::Wrap::wrap(@_); } +# return the perl version as defined in patchlevel.h. +# (we may be being run by another perl, so $] won't be right) +# return e.g. (5, 14, 3, "5.014003") + +sub perl_version { + my $plh = 'patchlevel.h'; + open my $fh, "<", $plh or die "can't open '$plh': $!\n"; + my ($v1,$v2,$v3); + while (<$fh>) { + $v1 = $1 if /PERL_REVISION\s+(\d+)/; + $v2 = $1 if /PERL_VERSION\s+(\d+)/; + $v3 = $1 if /PERL_SUBVERSION\s+(\d+)/; + } + die "can't locate PERL_REVISION in '$plh'" unless defined $v1; + die "can't locate PERL_VERSION in '$plh'" unless defined $v2; + die "can't locate PERL_SUBVERSION in '$plh'" unless defined $v3; + return ($v1,$v2,$v3, sprintf("%d.%03d%03d", $v1, $v2, $v3)); +} + + 1; -- Perl5 Master Repository
