In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/0b81c0dda6db9e4b1756ad9c7269e34b793dced7?hp=c62df97fd6a0ef53562060054f04dfeadb67f5f8>
- Log ----------------------------------------------------------------- commit 0b81c0dda6db9e4b1756ad9c7269e34b793dced7 Author: Father Chrysostomos <[email protected]> Date: Sat Nov 15 10:31:06 2014 -0800 Donât always skip in-memory tests is t/base/rs.t There is no PerlIO::via::scalar, as far as I can tell. In-memory han- dles just use PerlIO::scalar. The code was added by cd1a9f552. Iâm not sure it was ever cor- rect. It was intended to skip tests under -Uuseperlio (see <[email protected]>), but skipped them on all builds. Iâm not sure that we even support -Uuseperlio any more. In the mean time, 1ab48e3a screwed up the test count. M t/base/rs.t commit 7af094e040d44c75a7669cf30c00887d7279a690 Author: Father Chrysostomos <[email protected]> Date: Sat Nov 15 10:19:47 2014 -0800 t/base/rs.t: Suppress warning M t/base/rs.t commit 953c8b803c4f6f9b009938456f308e41848dbeb6 Author: Father Chrysostomos <[email protected]> Date: Sat Nov 15 10:09:24 2014 -0800 Put PL_cop_seqmax++ code in one spot M op.c M pad.c M pad.h commit d88d1fe0d14de0ef0ec01efc190c3a77e59a1459 Author: Father Chrysostomos <[email protected]> Date: Sat Nov 15 09:56:50 2014 -0800 [perl #115066] Fix wrongly nested âuseâ deparsing B::Deparse was incorrectly putting âuseâ statements and BEGIN blocks inside other âuseâ statements containing do-blocks, even if they were originally outside. Subroutines (except for cloned closures, which we donât have to worry about here) have an OUTSIDE pointer, pointing to the outer sub con- taining the declaration of the sub in question. So we can check that to make sure we are putting the sub declaration in the right place. Not only does this fix the reported case, but it also will allow sequence numbers in inner subs to be reused by statements in outer subs, which I may need in a future commit. M lib/B/Deparse.pm M lib/B/Deparse.t ----------------------------------------------------------------------- Summary of changes: lib/B/Deparse.pm | 8 ++++++++ lib/B/Deparse.t | 3 +-- op.c | 10 +++------- pad.c | 8 ++------ pad.h | 3 +++ t/base/rs.t | 15 +++++++-------- 6 files changed, 24 insertions(+), 23 deletions(-) diff --git a/lib/B/Deparse.pm b/lib/B/Deparse.pm index 3a943e4..1e42ef1 100644 --- a/lib/B/Deparse.pm +++ b/lib/B/Deparse.pm @@ -1645,10 +1645,18 @@ sub seq_subs { #push @text, "# ($seq)\n"; return "" if !defined $seq; + my @pending; while (scalar(@{$self->{'subs_todo'}}) and $seq > $self->{'subs_todo'}[0][0]) { + my $cv = $self->{'subs_todo'}[0][1]; + my $outside = $cv && $cv->OUTSIDE; + if ($cv and ${$cv->OUTSIDE || \0} != ${$self->{'curcv'}}) { + push @pending, shift @{$self->{'subs_todo'}}; + next; + } push @text, $self->next_todo; } + unshift @{$self->{'subs_todo'}}, @pending; return @text; } diff --git a/lib/B/Deparse.t b/lib/B/Deparse.t index bdc54f4..d73d858 100644 --- a/lib/B/Deparse.t +++ b/lib/B/Deparse.t @@ -367,12 +367,11 @@ EOCODJ } # [perl #115066] -$::TODO = ' '; my $prog = 'use constant FOO => do { 1 }; no overloading; die'; $a = readpipe qq`$^X $path "-MO=-qq,Deparse" -e "$prog" 2>&1`; is($a, <<'EOCODK', '[perl #115066] use statements accidentally nested'); use constant ('FOO', do { - 1; + 1 }); no overloading; die; diff --git a/op.c b/op.c index 8a0c7fa..98d6ff3 100644 --- a/op.c +++ b/op.c @@ -3706,9 +3706,8 @@ Perl_block_start(pTHX_ int full) { const int retval = PL_savestack_ix; - PL_compiling.cop_seq = PL_cop_seqmax++; - if (PL_cop_seqmax == PERL_PADSEQ_INTRO) /* not a legal value */ - PL_cop_seqmax++; + PL_compiling.cop_seq = PL_cop_seqmax; + COP_SEQMAX_INC; pad_block_start(full); SAVEHINTS(); PL_hints &= ~HINT_BLOCK_SCOPE; @@ -5889,10 +5888,7 @@ Perl_utilize(pTHX_ int aver, I32 floor, OP *version, OP *idop, OP *arg) PL_hints |= HINT_BLOCK_SCOPE; PL_parser->copline = NOLINE; - PL_cop_seqmax++; /* Purely for B::*'s benefit */ - if (PL_cop_seqmax == PERL_PADSEQ_INTRO) /* not a legal value */ - PL_cop_seqmax++; - + COP_SEQMAX_INC; /* Purely for B::*'s benefit */ } /* diff --git a/pad.c b/pad.c index 0775a42..1533ec5 100644 --- a/pad.c +++ b/pad.c @@ -1571,9 +1571,7 @@ Perl_intro_my(pTHX) ); } } - PL_cop_seqmax++; - if (PL_cop_seqmax == PERL_PADSEQ_INTRO) /* not a legal value */ - PL_cop_seqmax++; + COP_SEQMAX_INC; PL_min_intro_pending = 0; PL_comppad_name_fill = PL_max_intro_pending; /* Needn't search higher */ DEBUG_Xv(PerlIO_printf(Perl_debug_log, @@ -1631,9 +1629,7 @@ Perl_pad_leavemy(pTHX) } } } - PL_cop_seqmax++; - if (PL_cop_seqmax == PERL_PADSEQ_INTRO) /* not a legal value */ - PL_cop_seqmax++; + COP_SEQMAX_INC; DEBUG_Xv(PerlIO_printf(Perl_debug_log, "Pad leavemy: seq = %ld\n", (long)PL_cop_seqmax)); return o; diff --git a/pad.h b/pad.h index 3ca79d3..0e29b10 100644 --- a/pad.h +++ b/pad.h @@ -39,6 +39,9 @@ struct padlist { * flagging that a lexical is being introduced, or has not yet left scope */ #define PERL_PADSEQ_INTRO U32_MAX +#define COP_SEQMAX_INC \ + (PL_cop_seqmax++, \ + (void)(PL_cop_seqmax == PERL_PADSEQ_INTRO && PL_cop_seqmax++)) /* B.xs needs these for the benefit of B::Deparse */ diff --git a/t/base/rs.t b/t/base/rs.t index 416696e..c81b2dc 100644 --- a/t/base/rs.t +++ b/t/base/rs.t @@ -1,7 +1,7 @@ #!./perl # Test $! -print "1..48\n"; +print "1..38\n"; $test_count = 1; $teststring = "1\n12\n123\n1234\n1234\n12345\n\n123456\n1234567\n"; @@ -32,9 +32,10 @@ open TESTFILE, "<./foo"; binmode TESTFILE; test_record(*TESTFILE); close TESTFILE; -test_bad_setting(); $test_count_end = $test_count; # Needed to know how many tests to skip +test_bad_setting(); + # Now for the tricky bit--full record reading if ($^O eq 'VMS') { @@ -121,14 +122,11 @@ $/ = "\n"; # binary-incompatible previously-installed version. The eval wonât help in # intercepting a SIGTRAP. local @INC = ("../lib", "lib", @INC); - if (not eval q/use PerlIO::scalar; use PerlIO::via::scalar; 1/) { - # In-memory files necessitate PerlIO::via::scalar, thus a perl with + if (not eval q/use PerelIO::scalar; 1/) { + # In-memory files necessitate PerlIO::scalar, thus a perl with # perlio and dynaloading enabled. miniperl won't be able to run this # test, so skip it - # PerlIO::via::scalar has to be tested as well. - # use PerlIO::scalar succeeds with ./TEST and with ./perl harness but not with ./perl - for $test ($test_count .. $test_count + ($test_count_end - $test_count_start - 1)) { print "ok $test # skipped - Can't test in memory file with miniperl/without PerlIO::Scalar\n"; $test_count++; @@ -236,7 +234,8 @@ sub test_record { $test_count++; # Naughty straight number - should get the rest of the file - $/ = \0; + # no warnings 'deprecated'; # but not in t/base/* + { local $SIG{__WARN__} = sub {}; $/ = \0 } $bar = <FH>; if ($bar ne "90123456789012345678901234567890") {print "not ";} print "ok $test_count # \$/ = \\0\n"; -- Perl5 Master Repository
