This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Karl Williamson [Wed, 6 Jul 2016 01:32:19 +0000 (19:32 -0600)]
regcomp.c: Change some append_range_to_invlist() calls
Now that add_range_to_invlist() is more efficient, some current calls to
append_range_to_invlist() can be changed to make things slightly
clearer.
Karl Williamson [Mon, 27 Jun 2016 23:11:35 +0000 (17:11 -0600)]
regcomp.c: Reimplement add_range_to_invlist()
Previously, this function was essentially implemented by turning the new
range into an inversion list and then unioning that with the existing
inversion list. This was easy to write, but expensive in terms of
operations, with memory allocations and copies, etc.
After discussing this with Tony Cook, I have reimplemented this. Only
in one uncommonly encountered case does it resort to using the union,
because that case is somewhat tricky, and there is no need to have to
know that trickiness in yet another place given its rarity.
Otherwise, the function manipulates the inversion list. Some cases are
no-ops, some just change a single array element, some move things within
the array, extending or splicing it. But these are cheaper than the
previous implementation.
Karl Williamson [Wed, 13 Jul 2016 21:50:32 +0000 (15:50 -0600)]
t/re/anyof.t: add tests for ranges
These exercise the code changes that are coming the next commit, and are
to show that it doesn't change what gets compiled.
Karl Williamson [Wed, 13 Jul 2016 03:15:07 +0000 (21:15 -0600)]
regcomp.c: Refactor code dealing with m/[...]/d
This consolidates some code that deals with bracketed character classes
under /d. As a result, some throw-away steps can be omitted, and things
aren't scattered about. The earlier version skipped doing some things
if the class is to be inverted. The reason turns out to not be because
it was necessary, but that the dump of the compiled pattern was unclear.
Previous commits have fixed that, so this now handles inverted character
classes.
Karl Williamson [Sat, 16 Jul 2016 04:06:49 +0000 (22:06 -0600)]
regcomp.c: Improve -Dr output
This improves the output of a bracketed character class under /d that has
things that match only if not in utf8.
Karl Williamson [Sat, 16 Jul 2016 04:05:25 +0000 (22:05 -0600)]
t/re/pat.t: Add some tests
I'm unsure if these, [^\S ], get adequate tests, so added a few to make
sure, where the bracket class should compile to a posix class minus a
character normally in that class.
Karl Williamson [Wed, 6 Jul 2016 01:41:30 +0000 (19:41 -0600)]
regcomp.[ch]: Comments, White-space, only
This indents code and reflows the comments to account for the enclosing
block added by the previous commit.
At the same time, it adds some other miscellaneous white space changes,
and adds, revises other comments.
Karl Williamson [Wed, 6 Jul 2016 01:37:46 +0000 (19:37 -0600)]
regcomp.c: Improve -Dr output
Previously when dumping the compiled ANYOF node under -Dr, it could say
something like \x1B-\x1B. A single element range should be dumped as a
single element.
Karl Williamson [Tue, 12 Jul 2016 03:40:13 +0000 (21:40 -0600)]
anyof.t: Add tests for previous commit
The tests are being kept separate in case we want to put the previous
commit into a maintenance release. The tests need infrastructure added
since the release of 5.24, so can't easily be backported.
Karl Williamson [Wed, 6 Jul 2016 17:52:01 +0000 (11:52 -0600)]
Fix -Dr output regression
Several commits in the 5.23 series improved the display of the compiled
ANYOF regnodes, but introduced two bugs. One of them is in \p{Any} and
similar things that match the entire range 0-255. That range is omitted,
so it looks like \p{Any} only matches code points above 255. Note that
this is only what gets displayed under -Dr. What actually gets compiled
has been and still is fine.
The other is that when displaying a pattern that still has unresolved
user-defined properties that are complemented, it doesn't show properly
that the whole thing is complemented. That is, the output looks like it
doesn't obey De Morgan's laws.
The fixes to these are quite intertwined, and so I didn't try to
separate them.
Karl Williamson [Mon, 11 Jul 2016 17:54:56 +0000 (11:54 -0600)]
Add t/re/anyof.t
The ANYOF regnode is by far the most complicated to compile in regular
expression patterns. This new test file makes sure that what gets
compiled doesn't get changed accidentally, nor how the compiled node is
dumped for human readable output.
I created tests for this from what changed in
b77aba85f6ec3b2a2341077b14f39261c5753cea
"Revamp -Dr handling of /[...]/", and from trying to exercise all
branches in it using gcov.
Making this test file showed some bugs, and infelicitous representations
from that commit, which will be fixed in the next few commits, and tests
added as each change is done.
Karl Williamson [Mon, 11 Jul 2016 04:06:12 +0000 (22:06 -0600)]
t/test.pl: Add fresh_perl() function
This will be useful for cases where the results don't readily fall into
fresh_perl_is and fresh_perl_like, such as when a bunch of massaging of
the results is needed before it is convenient to test them.
fresh_perl_like() could be used, but in the case of failure there could
be lines and lines of noise output.
Karl Williamson [Wed, 6 Jul 2016 01:23:59 +0000 (19:23 -0600)]
SSize_t instead of IV
This is a sized STRLEN equivalent, so IV is less correct
Karl Williamson [Wed, 6 Jul 2016 01:17:18 +0000 (19:17 -0600)]
regcomp.h: Use #define mnemonic, not hard-coded number
Father Chrysostomos [Sat, 16 Jul 2016 08:08:20 +0000 (01:08 -0700)]
Get regen to work before 5.10
Since it uses the system perl, it’s useful to keep it working with
earlier versions.
Jarkko Hietaniemi [Sat, 16 Jul 2016 13:45:04 +0000 (16:45 +0300)]
[PATCH] in
15899733 the condition was supposed to stay optional
Addresses [perl #128630] commit "VAX: test changes for VAX floats" causesfails on Win32 in op/sprintf.t
While at it, comment the syntax a bit.
Father Chrysostomos [Fri, 15 Jul 2016 23:04:53 +0000 (16:04 -0700)]
[perl #128621] #define PL_encoding
to a NULL SV for non-core code, so that code that checks
if(PL_encoding) will continue to compile and work.
Steve Hay [Fri, 29 Apr 2016 22:40:03 +0000 (23:40 +0100)]
Add epigraph for 5.22.2
(cherry picked from commit
57ddee768a888d233288efe61bd6952e0fcf01c2)
Ævar Arnfjörð Bjarmason [Fri, 15 Jul 2016 21:26:31 +0000 (21:26 +0000)]
gv.c: Add a comment about what powers Foo->import|unimport
This comments some ancient code added by Larry back in
perl-5.000-ga0d0e21, I was searching for what made this not error:
$ ./miniperl -we 'package Foo {} Foo->import'
Commenting out this "if" clause will make that error the same way that
this would:
$ ./miniperl -we 'package Foo {} Foo->whatever
Can't locate object method "whatever" via package "Foo" at -e line 1.
Sawyer X [Fri, 15 Jul 2016 12:19:40 +0000 (14:19 +0200)]
Steve Hay will release next two maints on the 25th
Sawyer X [Wed, 6 Jul 2016 13:34:17 +0000 (15:34 +0200)]
Chad will be taking October, Sawyer December
Dan Collins [Mon, 4 Jul 2016 19:21:05 +0000 (15:21 -0400)]
Configure: clarify "version-specific"
This has long been a confusing configure question. It sounds like
it saves time by installing /less/, but really it just installs
binaries with a version number suffix.
Karl Williamson [Thu, 14 Jul 2016 04:06:30 +0000 (22:06 -0600)]
PATCH: [perl #128628] divide by 0 in locale.c
It turned out to be possible to divide by 0 in Win32 when trying to find
the strxfrm() of an empty string. On other platforms, the result of
this is consistent with other strings, but on Windows, it is longer than
expected, and the code was trying to adapt to this, dividing by the
input length without checking its validity. This commit just skips the
adapting on a 0-length input.
Karl Williamson [Wed, 13 Jul 2016 20:42:59 +0000 (14:42 -0600)]
cpan/Encode/encoding.pm: Fix typo in pod
Aristotle Pagaltzis [Wed, 13 Jul 2016 16:40:10 +0000 (18:40 +0200)]
perlfunc: remove obsolete study docs
Future historians may want to take note of the following writings:
http://www.nntp.perl.org/group/perl.perl5.porters/;msgid=alpine.DEB.2.00.
1105021253190.4448@fractal.phys.lafayette.edu
http://www.nntp.perl.org/group/perl.perl5.porters/;msgid=CANgJU+WeUK9bWM8+4AtQ7stpR+3MVNatSzR8sJf-2AiBEWAw0Q@mail.gmail.com
http://www.nntp.perl.org/group/perl.perl5.porters/;msgid=
CB1A246E-858C-4BBD-AE45-
4656E5A76272@cpan.org
http://www.nntp.perl.org/group/perl.perl5.porters/;msgid=alpine.DEB.2.00.
1201311052320.21742@fractal.phys.lafayette.edu
http://www.nntp.perl.org/group/perl.perl5.porters/;msgid=
20120131164322.GH9069@plum.flirble.org
David Mitchell [Wed, 13 Jul 2016 15:32:34 +0000 (16:32 +0100)]
op.c: explain op_next generation better
Update the big comment block at the top of op.c to better explain how all
the op_next pointers get calculated.
Aristotle Pagaltzis [Wed, 13 Jul 2016 14:56:20 +0000 (16:56 +0200)]
perlfunc: fix seek/tell/sysseek byte offset note akwardness
Aristotle Pagaltzis [Wed, 13 Jul 2016 14:56:15 +0000 (16:56 +0200)]
perlfunc: unrearrange sysseek doc to prepare next patch
David Mitchell [Wed, 13 Jul 2016 11:46:34 +0000 (12:46 +0100)]
fix removal of PL_(lex_)encoding under threads
PL_encoding and PL_lex_encoding have just been removed, but usage of them
remained in perl_clone_using(), which broke threaded builds.
Father Chrysostomos [Wed, 13 Jul 2016 08:12:58 +0000 (01:12 -0700)]
[Merge] Remove ${^ENCODING} functionality
• encoding::warnings is now a no-op that gives a warning.
• ‘use encoding’ now dies, unless you specify a Filter argument.
• The ${^ENCODING} and ${^E_NCODING} variables and all the code they
affected have been removed.
Father Chrysostomos [Tue, 12 Jul 2016 00:46:27 +0000 (17:46 -0700)]
concat2.t: Remove encoding test
Its purpose was to test the interaction between . and encoding.pm
causing the stack to be reallocated. Since encoding.pm is disabled in
5.25.3 and above, the test is no longer necessary.
Father Chrysostomos [Mon, 11 Jul 2016 15:39:46 +0000 (08:39 -0700)]
Remove t/uni/tr_?jis.t
I disabled them a few commits ago, thinking that maybe reworking them
to test y’s utf8 support might be a good idea; but they duplicate tests
already in t/uni/tr_utf8.t, so they are no longer necessary.
Father Chrysostomos [Mon, 11 Jul 2016 05:07:27 +0000 (22:07 -0700)]
Increase $encoding::VERSION to 2.17_01
Father Chrysostomos [Mon, 11 Jul 2016 04:42:43 +0000 (21:42 -0700)]
Update t/porting/customized.dat
Father Chrysostomos [Mon, 11 Jul 2016 01:53:05 +0000 (18:53 -0700)]
Remove t/uni/chr.t
Without ‘use encoding’, tests like
ok(chr(0x7f) eq "\x7f");
have little to do with perl’s Unicode support, and they duplicate
tests in t/op/chr.t.
It is not necessary to convert these to use chars > 0xff, to test chr
with Unicode, as t/op/chr.t already does that, too.
Move the warning test to t/lib/warnings/pp. That is the only thing
tested here that is not tested elsewhere.
Father Chrysostomos [Sun, 10 Jul 2016 20:01:05 +0000 (13:01 -0700)]
Disable encoding.pm’s default mode; update docs
Its default mode became a no-op in recent commits, because
${^ENCODING} stopped doing anything.
Also, fix/delete/skip tests that fail as a result.
Father Chrysostomos [Sun, 22 May 2016 21:37:43 +0000 (14:37 -0700)]
Remove mg.c:_get_encoding
Nothing uses it now, and it does nothing.
Father Chrysostomos [Sun, 22 May 2016 21:35:31 +0000 (14:35 -0700)]
Remove PL_(lex_)encoding and all dependent code
Father Chrysostomos [Sun, 22 May 2016 21:32:40 +0000 (14:32 -0700)]
Remove IN_ENCODING macro, and all code dependent on it
Father Chrysostomos [Sat, 21 May 2016 19:22:33 +0000 (12:22 -0700)]
Disable ${^ENCODING}
${^ENCODING} is disabled and tests are modified to account.
Father Chrysostomos [Sun, 22 May 2016 20:51:58 +0000 (13:51 -0700)]
Increase $encoding::warnings::VERSION to 0.13
Father Chrysostomos [Sun, 22 May 2016 20:51:14 +0000 (13:51 -0700)]
Make encoding::warnings a no-op in 5.26
with a single warning at import time.
Karl Williamson [Wed, 13 Jul 2016 03:44:00 +0000 (21:44 -0600)]
regexec.c: Silence compiler warning
A formal parameter was missing a 'const'
Tony Cook [Wed, 13 Jul 2016 01:52:52 +0000 (11:52 +1000)]
darwin was failing this test under PERLIO=stdio
fdopen() on darwin seems to set errno to 2 (ENOENT) when it runs out of
FILE entries.
Lukas Mai [Tue, 12 Jul 2016 20:33:20 +0000 (22:33 +0200)]
perlfunc: clarify seek/sysseek documentation re byte offsets (RT #128607)
- The perlfunc entries for seek/sysseek were talking about tell instead
of themselves in the section on byte offsets. Fix that.
- Rearrange the paragraphs in the sysseek entry to describe parameters
first, return value second, then everything else. This way the "byte
offsets" section can refer to the (previously described) return value.
- Hyperlink the 'systell' example in the tell entry to the sysseek
entry.
Aaron Crane [Tue, 12 Jul 2016 10:39:52 +0000 (11:39 +0100)]
pod/perldata.pod: fix tiny typo
Steve Hay [Tue, 12 Jul 2016 07:43:31 +0000 (08:43 +0100)]
Upgrade Test-Simple from version 1.302037 to 1.302040
Steve Hay [Tue, 12 Jul 2016 07:37:08 +0000 (08:37 +0100)]
Upgrade bignum from version 0.42 to 0.43
Steve Hay [Tue, 12 Jul 2016 07:34:21 +0000 (08:34 +0100)]
We're in sync with XSLoader-0.22 (since
ae635bbffa)
Chris Lamb [Sun, 3 Jul 2016 14:31:27 +0000 (10:31 -0400)]
Make the build reproducible.
See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=829295.
Increment $VERSION throughout ExtUtils-ParseXS/lib.
For RT #128517
Father Chrysostomos [Mon, 11 Jul 2016 21:49:17 +0000 (14:49 -0700)]
[perl #128597] Crash from gp_free/ckWARN_d
See the explanation in the test added and in the RT ticket.
The solution is to make the warn macros check that PL_curcop
is non-null.
Steffen Mueller [Mon, 11 Jul 2016 20:08:43 +0000 (22:08 +0200)]
Update Data::Dumper to 2.161
No real changes for blead, but a fixed CPAN distribution with old-perl
backcompat fixes. Thanks to Aaron Crane for the debugging and patches!
Tony Cook [Mon, 11 Apr 2016 03:55:45 +0000 (13:55 +1000)]
make Configure abort if both -Duselongdouble and -Dusequadmath are requested
See [perl #126203]
Dan Collins [Sat, 18 Jun 2016 21:24:22 +0000 (17:24 -0400)]
t/re/regexp.t: Remove extra semicolons from output.
The $code segment in t/re/regexp.t contains an extra ';' for the first iteration
of each test, due to how 'study' and 'utf8::upgrade' testing is implemented.
Since this is the only test likely to fail (what with study being a no-op), this
is almost always line noise. This patch removes that ';'.
It would be nice to remove the back to back newlines as well.
Dan Collins [Sat, 18 Jun 2016 20:52:26 +0000 (16:52 -0400)]
t/re/regexp.t: Better formatting for test failures
On test failure, most of our tests output a description of the test,
followed by the actual result ("got") and the desired result
("expected"). This brings the tests in t/re/re_tests in line by
adding "expected" to the output, and changing the order slightly,
to more naturally describe the test, the output, and the expectation.
David Mitchell [Fri, 8 Jul 2016 08:48:04 +0000 (09:48 +0100)]
RT #128255: Assert fail in S_sublex_done
Some code that handles deprecated behaviour in formats was triggering
an assertion. This:
format STDOUT =
@
0"$x"
gave this warning:
Use of comma-less variable list is deprecated
but then gave this panic:
toke.c:2457: S_sublex_done: Assertion `(PL_parser->lex_inwhat) ==
OP_SUBST || (PL_parser->lex_inwhat) == OP_TRANS' failed.
This is due to the lexer calling scan_str(), then backing off and doing
the warning and returning a comma, then on the next token get, calling
scan_str() again. Because scan_str() has been called twice, the
second time it extracts the string to PL_sublex_info.repl rather than
PL_lex_stuff, as it does with things like s/foo/bar/ and tr/abc/ABC/.
Later an assert that PL_sublex_info.repl is only set for a s/// or tr///
fails.
The solution seems to be to check and return a comma *before*
trying to call scan_str().
David Mitchell [Thu, 7 Jul 2016 16:03:29 +0000 (17:03 +0100)]
SEGV in "Subroutine redefined" warning
RT #128257
The following SEGVed:
sub P::f{}
undef *P::;
*P::f =sub{};
due to the code which generates the "Subroutine STASH::NAME redefined"
warning assuming that the GV always has a stash. Make it so that if it
hasn't, the message changes to "Subroutine NAME redefined" rather than
just crashing.
David Mitchell [Thu, 7 Jul 2016 15:24:41 +0000 (16:24 +0100)]
handle magic in multideref "unit val" var names
[perl #128253] Assert fail in S_find_uninit_var
$ perl5240 -we'$ISA[0][0]'
Useless use of array element in void context at -e line 1.
perl5240: sv.c:16078: S_find_uninit_var: Assertion `is_hv' failed.
The code in find_uninit_var() which looks for a variable name associated
with an uninitialized value assumed, in the OP_MULTIDEREF branch, that the
value was either an index if the op was top-level ($foo[$uninit]), or an
array/hash element otherwise (1+$foo[...]).
It turns out here's a third possibility: magic. In $ISA[0][0], the first
array lookup is in lval context, so it initially autovivifies to undef.
Normally it would shortly afterwards be upgraded to a ref to an empty AV,
but first ISA set magic for @ISA is invoked. This ends up scanning @ISA
and finds an uninit value which it tries to use as a key into the stash
cache, triggering an ununit value warning.
This commit expands the OP_MULTIDEREF code in find_uninit_var() to handle
this third possibility - chiefly by not returning a variable name unless
the index var is the same SV as the uninit value. As well as fixing the
assert failure in this ticket, it also stops printing an incorrect index in
code like this:
$ perl -we'my $i = 0; $ISA[$i] = 1'
before:
....
Use of uninitialized value $i in array element at -e line 1.
Use of uninitialized value $i in array element at -e line 1.
Recursive inheritance detected in package 'main' at -e line 1.
after:
....
Use of uninitialized value in array element at -e line 1.
Use of uninitialized value in array element at -e line 1.
Recursive inheritance detected in package 'main' at -e line 1.
@ISA magic still has recursion issues with undef values, as can be seen
above. I don't address those issues here. Because of that, I haven't
been able to add tests.
David Mitchell [Thu, 7 Jul 2016 08:40:22 +0000 (09:40 +0100)]
undeprecate hv_bucket_ratio()
This function was recently added, but marked as deprecated in embed.fnc.
Based on this thread:
http://nntp.perl.org/group/perl.perl5.porters/237486
It looks like the 'M' (may change) flag is sufficient to capture what was
intended. Removing the 'D' avoids every usage in core emitting a warning
to STDERR during build, while it still adds a caution to the entry in
perlapi.pod:
NOTE: this function is experimental and may change or be
removed without notice.
H.Merijn Brand [Wed, 6 Jul 2016 07:03:08 +0000 (09:03 +0200)]
Minor change after backpotinr
The oxford comma makes no sense in a list of just two
Sébastien Aperghis-Tramoni [Tue, 5 Jul 2016 21:53:08 +0000 (14:53 -0700)]
Synchronize blead with CPAN XSLoader 0.22
H.Merijn Brand [Tue, 5 Jul 2016 16:49:29 +0000 (18:49 +0200)]
[perl #128538] [PATCH] Fix copy/paste error in Configure
Self-explanatory. The code in question adds -quadmath to archname, but only if it isn't already there. However, since this was copied from a few lines earlier, it checks for -ld instead of -quadmath.
Jarkko Hietaniemi [Tue, 5 Jul 2016 07:59:59 +0000 (10:59 +0300)]
The
47918419 mistakenly made miniperl skippage unconditional
Chad Granum [Mon, 4 Jul 2016 19:36:02 +0000 (12:36 -0700)]
Update Test-Simple to 1.302037
This includes many bugfixes and documentation updates.
This also fixes a notable bug where one test would pass under the
harness, but fail when run directly under perl (due to perl RT #128530)
For: RT #128536
Father Chrysostomos [Mon, 4 Jul 2016 15:48:57 +0000 (08:48 -0700)]
Fix XSLoader to recognize drive letters
Commit
08e3451d made XSLoader confirm that the file path it got
from (caller)[2] was in @INC if it looked like a relative path.
Not taking drive letters into account, it made that @INC search
mandatory on Windows and some other systems. It still worked, but
was slightly slower.
Sawyer X [Mon, 4 Jul 2016 19:44:22 +0000 (21:44 +0200)]
Abigail volunteered to handle January's release of 5.25.9
Father Chrysostomos [Mon, 4 Jul 2016 05:23:34 +0000 (22:23 -0700)]
[perl #128532] Crash vivifying stub in deleted pkg
v5.17.0-515-g186a5ba, which added newSTUB, did not take into account
that a GV may have a null GvSTASH pointer, if its stash has been
freed, so this crashes:
delete $My::{"Foo::"}; \&My::Foo::foo
Steve Hay [Mon, 4 Jul 2016 07:43:43 +0000 (08:43 +0100)]
Silence podcheck.t failure from Data-Dumper's updated Changes file
Steve Hay [Mon, 4 Jul 2016 07:26:29 +0000 (08:26 +0100)]
Upgrade Data-Dumper from version 2.154 to 2.160
Steve Hay [Mon, 4 Jul 2016 07:24:32 +0000 (08:24 +0100)]
Upgrade Parse-CPAN-Meta from version 1.4421 to 1.4422
David Mitchell [Sun, 3 Jul 2016 21:19:26 +0000 (22:19 +0100)]
Revert "FREETMPS when leaving eval, even when void/dying"
This reverts commit
214949f5cdc4164f25e32c1a6ce989286456c205.
It breaks Variable::Magic.
Temporarily revert while we work out what to do.
Father Chrysostomos [Sun, 3 Jul 2016 05:57:46 +0000 (22:57 -0700)]
Increase $XSLoader::VERSION to 0.22
Father Chrysostomos [Sun, 3 Jul 2016 05:56:51 +0000 (22:56 -0700)]
Don’t let XSLoader load relative paths
[rt.cpan.org #115808]
The logic in XSLoader for determining the library goes like this:
my $c = () = split(/::/,$caller,-1);
$modlibname =~ s,[\\/][^\\/]+$,, while $c--; # Q&D basename
my $file = "$modlibname/auto/$modpname/$modfname.bundle";
(That last line varies by platform.)
$caller is the calling package. $modlibname is the calling file. It
removes as many path segments from $modlibname as there are segments
in $caller. So if you have Foo/Bar/XS.pm calling XSLoader from the
Foo::Bar package, the $modlibname will end up containing the path in
@INC where XS.pm was found, followed by "/Foo". Usually the fallback
to Dynaloader::bootstrap_inherit, which does an @INC search, makes
things Just Work.
But if our hypothetical Foo/Bar/XS.pm actually calls
XSLoader::load from inside a string eval, then path ends up being
"(eval 1)/auto/Foo/Bar/Bar.bundle".
So if someone creates a directory named ‘(eval 1)’ with a naughty
binary file in it, it will be loaded if a script using Foo::Bar is run
in the parent directory.
This commit makes XSLoader fall back to Dynaloader’s @INC search if
the calling file has a relative path that is not found in @INC.
Karl Williamson [Sat, 2 Jul 2016 14:49:11 +0000 (08:49 -0600)]
perl.h: Fix typo in comment
Father Chrysostomos [Sat, 2 Jul 2016 07:08:48 +0000 (00:08 -0700)]
[perl #128508] Fix line numbers with perl -x
When lex_start is invoked with an SV and a handle pointer, it expects
the SV to contain the beginning of the code to be parsed. The handle
will be read from for subsequent code.
The -x command line option happens to invoke lex_start with two non-
null pointers like this (a line and a handle), since, to find the
#!perl line, it has to read that first line out of the file handle.
There is a line of code in lex_start that adds "\n;" to the buffer
goes back to
8990e30710 (perl 5.0 alpha 6) and string eval fails
catastrophically without it.
As of v5.19.1-485-g2179133 multiple lines are supported in the current
parsing buffer (PL_linestr) when there is a file handle, and as of
v5.19.3-63-gbf1b738 the line number is correctly incremented when the
parser goes past a newline.
So, for -x, "#!perl\n" turns into "#!perl\n\n" (the final ; is skipped
as of v5.19.3-63-gbf1b738 if there is a handle). That throws line
numbers off by one.
In the case where we have a string to parse and a file handle, the
extra "\n;" added to the end of the buffer turns out to be completely
unnecessary. So this commit makes it conditional on rsfp.
The existing tests for -x are quite exotic. I have made no effort to
make them less so.
Jarkko Hietaniemi [Sat, 2 Jul 2016 00:14:00 +0000 (20:14 -0400)]
If only miniperl, no use re for you.
Jarkko Hietaniemi [Sat, 2 Jul 2016 00:07:18 +0000 (20:07 -0400)]
If only miniperl, no use utf8 for you.
Jarkko Hietaniemi [Mon, 27 Jun 2016 22:57:14 +0000 (18:57 -0400)]
VAX: test changes for VAX floats
The hexfp (literals or %a) seems to be partially working: simple cases
seem to work, but there are failures.
Jarkko Hietaniemi [Sun, 26 Jun 2016 02:14:41 +0000 (22:14 -0400)]
VAX: code changes for VAX floats
Mainly to avoid Inf and NaN, which VAX does does not have.
There is something like Inf called "excess" but that is
a deadly exception, seems to manifest itself in vax-netbsd
either as a SIGFPE or SIGSEGV (pretty much untrappable at
least from Perl level).
The range of VAX floats is different from IEEE.
There is positive zero, but no negative zero.
Jarkko Hietaniemi [Sun, 26 Jun 2016 01:57:55 +0000 (21:57 -0400)]
VAX: Configure changes for VAX floats
Detect the VAX floating point formats D and G.
And the F float, but that is float (duh), never likely to be
the double, but do it for consistency (we detect IEEE single
precision floats, too).
The T float and X float are the IEEE 64-bit and 128-bit,
but those were available only on the Alpha.
Tested on vax-netbsd.
David Mitchell [Fri, 1 Jul 2016 10:22:51 +0000 (11:22 +0100)]
op_lvalue_flags(): silence compiler warning
op.c:3071:4: warning: enumeral and non-enumeral type in conditional
expression [-Wextra]
David Mitchell [Fri, 1 Jul 2016 10:13:52 +0000 (11:13 +0100)]
[MERGE] make eval scope exit free temps
plus a bunch of cleanup of the eval scope exit code
David Mitchell [Thu, 30 Jun 2016 09:56:28 +0000 (10:56 +0100)]
FREETMPS when leaving eval, even when void/dying
When a scope is exited normally (e.g. pp_leavetry, pp_leavesub),
we do a FREETMPS only in scalar or list context; in void context
we don't bother for efficiency reasons. Similarly, when there's an
exception and we unwind to (and then pop) an EVAL context, we haven't
been bothering to FREETMPS.
The problem with this in try/eval (exiting normally or via an exception)
is that it can delay some SVs getting freed until *after* $@ has been
set. If that freeing calls a destructor which happens to set $@,
then that overwrites the "real" value of $@.
For example
sub DESTROY { eval { die "died in DESTROY"; } }
eval { bless []; };
is ($@, "");
Before this commit, that test would fail because $@ is "died in DESTROY".
This commit ensures that leaving an eval/try by whatever means always
clears the tmps stack before setting $@.
See http://nntp.perl.org/group/perl.perl5.porters/237380.
For now, I haven't added a FREETMPS to the other pp_leavefoo()
void context cases, since I can't think of a case where it would
matter.
David Mitchell [Thu, 30 Jun 2016 09:12:06 +0000 (10:12 +0100)]
die_unwind(): mortalise, not mortalcopy the err SV
The error string needs to be preserved while unwinding the stacks,
but doing a simple sv_2mortal() and bumping the reference count seems
sufficient, rather than making a complete copy.
Also, avoid the mortalised SV's buffer from being stolen by using the
SV_NOSTEAL flag rather than unsetting SvTEMP.
Finally, add some basic comments above Perl_die_unwind() explaining what
it's for.
David Mitchell [Wed, 29 Jun 2016 08:16:51 +0000 (09:16 +0100)]
cx_popeval(): don't mortalise blk_eval.old_namesv
Currently whenever we pop an eval context used for a require, rather than
freeing the SV holding the name of the require, we just mortalise it,
since some callers of cx_popeval() need the SV to remain long enough to
use it to "undo" %INC and to croak with a message such as ""$name did not
return a true value".
Now that all those usages have been gathered into one place
(S_pop_eval_context_maybe_croak), make that function responsible for
mortalising when there's a require error, and make the general-case case
of cx_popeval() just decrement the reference count.
David Mitchell [Tue, 28 Jun 2016 20:22:39 +0000 (21:22 +0100)]
expand and rename S_undo_inc_then_croak()
This function is called from 3 places in pp_ctl.c to do things on require
failure like:
delete $INC{$name};
croak "$errsv: Compilation failed in require"
After some previous commits, all 3 callers are now very similar around the
time they call this function: for example they all do
CX_LEAVE_SCOPE(cx);
cx_popeval(cx);
cx_popblock(cx);
So incorporate all that into the function too, and rename it to
S_pop_eval_context_maybe_croak() to reflect its expanded role.
David Mitchell [Tue, 28 Jun 2016 16:14:41 +0000 (17:14 +0100)]
harmonise die_unwind, doeval_compile, leaveeval
There is some similar code in each of these functions. Reorganise each of
those blocks to make them more similar. In particular, move some of the
EVAL context field preserving to earlier; i.e. change
CX_LEAVE_SCOPE(cx);
cx_popeval(cx);
cx_popblock(cx);
saved_foo = cx->blk_eval.foo;
to
saved_foo = cx->blk_eval.foo;
CX_LEAVE_SCOPE(cx);
cx_popeval(cx);
cx_popblock(cx);
and always examine the context entry to determine whether the EVAL is a
require, rather than using any other method (but assert they're the same);
and for leaveeval, move the CvDEPTH(evalcv)=0 setting earlier.
David Mitchell [Tue, 28 Jun 2016 15:31:45 +0000 (16:31 +0100)]
tidy doeval_compile()
After the previous commit removed some dead code, the rest of the
code can be re-arranged to be slightly tidier. In particular, this
structure:
if (foo) {
...;
}
if (in_require) {
assert(foo);
croak(...);
}
becomes the logically equivalent
if (foo) {
...;
if (in_require) {
croak(...);
}
}
assert(!in_require);
David Mitchell [Tue, 28 Jun 2016 15:22:03 +0000 (16:22 +0100)]
doeval_compile(): remove dead code
The combination of in_require and yystatus ==3 (i.e. we caught a
JUMPENV(3)) should never happen, so remove the code that handles this
combo and replace with an assertion.
I think the dead code was wrong anyway - it re-croaked without having
first popped he current EVAL context.
Steve Hay [Fri, 1 Jul 2016 07:27:18 +0000 (08:27 +0100)]
Upgrade Time::HiRes from version 1.9734 to 1.9739
Steve Hay [Fri, 1 Jul 2016 07:25:16 +0000 (08:25 +0100)]
Upgrade Parse::CPAN::Meta from version 1.4417 to 1.4421
Karl Williamson [Fri, 1 Jul 2016 04:05:55 +0000 (22:05 -0600)]
Change \p{foo} to mean \p{scx: foo}
when 'foo' is a script. Also update the pods correspondingly, and to
encourage scx property use.
See http://nntp.perl.org/group/perl.perl5.porters/237403
Karl Williamson [Thu, 30 Jun 2016 19:13:17 +0000 (13:13 -0600)]
perlapi: Add entry for hv_bucket_ratio
autodoc doesn't find things like Per_hv_bucket_ratio().
Craig A. Berry [Thu, 30 Jun 2016 14:08:31 +0000 (09:08 -0500)]
Use catfile, not catdir in metadata.t.
Otherwise $basename comes up empty on VMS. Already pushed
upstream as:
https://github.com/Perl-Toolchain-Gang/Module-Metadata/commit/
59b3f5b45ff862a1a422a409518255736fe81b66
Steve Hay [Tue, 28 Jun 2016 13:18:30 +0000 (14:18 +0100)]
Upgrade version from version 0.9916 to 0.9917
Steve Hay [Tue, 28 Jun 2016 13:01:47 +0000 (14:01 +0100)]
Upgrade Test::Simple from version 1.302026 to 1.302035
Steve Hay [Tue, 28 Jun 2016 12:46:07 +0000 (13:46 +0100)]
We're in sync with CPAN version 2.14
Steve Hay [Tue, 28 Jun 2016 12:40:31 +0000 (13:40 +0100)]
We're closer to being in sync with XSLoader 0.20 than with 0.16
(This just drops the module off the list of modules that are "behind" the
latest CPAN release. We're actually slightly *ahead* of CPAN.)
Steve Hay [Tue, 28 Jun 2016 12:35:10 +0000 (13:35 +0100)]
Upgrade Perl::OSType from version 1.009 to 1.010
David Mitchell [Tue, 28 Jun 2016 09:50:41 +0000 (10:50 +0100)]
Add test for RT #128252
was already fixed by v5.25.2-53-g36efb5a