This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Father Chrysostomos [Thu, 7 Jun 2012 21:57:06 +0000 (14:57 -0700)]
perldelta tweaks
Father Chrysostomos [Thu, 7 Jun 2012 21:56:32 +0000 (14:56 -0700)]
perldelta for new coresubs
Father Chrysostomos [Thu, 7 Jun 2012 17:02:29 +0000 (10:02 -0700)]
perldelta for #111782
Father Chrysostomos [Thu, 7 Jun 2012 16:57:28 +0000 (09:57 -0700)]
perldelta for #76546
Father Chrysostomos [Thu, 7 Jun 2012 16:44:57 +0000 (09:44 -0700)]
perldelta for #9423
Father Chrysostomos [Thu, 7 Jun 2012 16:42:24 +0000 (09:42 -0700)]
perldelta for #111510
Father Chrysostomos [Wed, 6 Jun 2012 22:55:16 +0000 (15:55 -0700)]
cop.h: Clarify comment
Ricardo Signes [Fri, 8 Jun 2012 01:58:31 +0000 (21:58 -0400)]
per the request of the metacpan crew, cc them on release
Karl Williamson [Thu, 7 Jun 2012 18:28:54 +0000 (12:28 -0600)]
UCD.t: Cope with $/ being set.
These tests fail in some earlier Unicode versions because $/ is being
set. Reset it to $/ around the reads and chomps this .t does.
Karl Williamson [Mon, 4 Jun 2012 15:08:19 +0000 (09:08 -0600)]
Revert "UCD.t: Don't use BEL for $/"
This reverts commit
9a8e4a54f8b3668a7ebd8f229cdfb405a1dce77c. It turns
out that the reason this was there was to add a stress test. Outside
setting of $/ should not break Unicode::UCD
Karl Williamson [Mon, 4 Jun 2012 15:06:07 +0000 (09:06 -0600)]
mktables: Use initialize instead of a push
The code later on used to be done only sometimes; now that it is
executed always, some of it can be done at initialization time.
Chris 'BinGOs' Williams [Thu, 7 Jun 2012 19:06:26 +0000 (20:06 +0100)]
Sync the version of Perl-Perldoc in Maintainers.pl with CPAN
Karl Williamson [Wed, 6 Jun 2012 21:56:09 +0000 (15:56 -0600)]
utf8.c: White-space only
Karl Williamson [Wed, 6 Jun 2012 21:50:53 +0000 (15:50 -0600)]
utf8.c: Refactor a portion of to_utf8_case()
This routine can never return 0, as if there is no case mapping, the
input is used instead. The code point for that input has already been
derived earlier in the function, so it doesn't have to be recalculated.
And, rearrange the order of things slightly.
Karl Williamson [Wed, 6 Jun 2012 21:40:38 +0000 (15:40 -0600)]
utf8.c: Avoid some extra work
In the case changed, the output is the input, so can just Copy it
instead of re-deriving it.
Karl Williamson [Wed, 6 Jun 2012 21:40:02 +0000 (15:40 -0600)]
utf8.c: Add, revise comments
Karl Williamson [Wed, 6 Jun 2012 17:12:24 +0000 (11:12 -0600)]
docs patch: 'unicode_strings' doesn't change utf8ness
We had a field report of lack of clarity around this, so add some
text.
Karl Williamson [Wed, 6 Jun 2012 17:11:34 +0000 (11:11 -0600)]
perlfunc: Add comma
Father Chrysostomos [Thu, 7 Jun 2012 15:28:01 +0000 (08:28 -0700)]
Remove droppings from t/
I accidentally added these when resolving merge conflicts.
Father Chrysostomos [Thu, 7 Jun 2012 15:19:32 +0000 (08:19 -0700)]
[Merge] SvPOK bug hunt
Spurred on by a comment in ticket #109542, I went looking for misuse
of SvPOK, where SvPOKp should be used instead (since variables with
get-magic don’t have SvPOK set).
I discovered a few bugs like that, plus many more bugs that were sim-
ilar, but not quite the same.
Father Chrysostomos [Thu, 7 Jun 2012 06:19:47 +0000 (23:19 -0700)]
Make warn treat $@=3 and $@="3" the same
If we get this:
$ ./perl -Ilib -e '$@ = "3"; warn'
3 ...caught at -e line 1.
then we shouldn’t get this:
$ ./perl -Ilib -e '$@ = 3; warn'
Warning: something's wrong at -e line 1.
as the two scalars hold the same value.
Father Chrysostomos [Thu, 7 Jun 2012 06:07:18 +0000 (23:07 -0700)]
pp.c:pp_negate: Move looks_like_number where it matters
Since we already have a check further down to see whether a string
begins with an identifier or sign, and since looks_like_number
was added for strings representing negative numbers, move the
looks_like_number down to where we already know the string
begins with '-'.
This is a micro-optimisation, but it also makes the code more
straightforward (to me at least).
This happens to let magical integers-as-strings fall down to code that
they used not to reach, so that has to change to account.
Father Chrysostomos [Thu, 7 Jun 2012 06:05:24 +0000 (23:05 -0700)]
pp_negate: Support magic big ints as strings
-$1 was treating $1 as a float even if the string consisted of an
integer, due to incorrect flag checks. It was doing the same things
with tied variables returning str+int dualvars.
Simply checking whether the privates flags consist solely of SVp_IOK
(which works for tie variables returning pure integers--so I wasn’t
entirely wrong in adding that logic a few commits ago), isn’t suffi-
cient. For gmagical variables that have already had get-magic called
on them, the private flags are equivalent to public flags for other
variables.
Father Chrysostomos [Wed, 6 Jun 2012 22:54:08 +0000 (15:54 -0700)]
pp_negate and the Unicode Bug
$ ./perl -Ilib -Mutf8 -CO -le 'print -"3 apples"'
-3
$ ./perl -Ilib -Mutf8 -CO -le 'print -"3 μῆλα"'
-3 μῆλα
This has been this way since 5.10.1. In 5.10.0, it was consistent:
$ perl5.10.0 -Mutf8 -CO -le 'print -"3 apples"'
-3
$ perl5.10.0 -Mutf8 -CO -le 'print -"3 μῆλα"'
-3
But the worst part is that we get a non-numeric warning now for a
string operation:
$ perl5.10.1 -Mutf8 -CO -lwe 'print -"3 μῆλα"'
Argument "\x{33}\x{20}..." isn't numeric in negation (-) at -e line 1.
-3 μῆλα
This goes back to commit
a43d94f2c089, which by itself looks perfectly
correct (I won’t quote the diff here, as it is long; but it doesn’t
touch pp_negate):
commit
a43d94f2c089c6f14197795daeebb7835550a747
Author: Nicholas Clark <nick@ccl4.org>
Date: Mon Jan 7 18:24:39 2008 +0000
Don't set the public IV or NV flags if the string converted from has
trailing garbage. This behaviour is consistent with not setting the
public IV or NV flags if the value is out of range for the type.
p4raw-id: //depot/perl@32894
It seems that pp_negate was already buggy before that (or ‘validly’
assumed that numeric coercion would set public flags). And it looks
as though commit
8eb28a70b2e is at fault here.
It changed this:
$ perl5.6.2 -Mutf8 -lwe 'print -"ð"'
-ð
to this:
$ perl5.8.1 -Mutf8 -lwe 'print -"ð"'
Argument "\x{f0}" isn't numeric in negation (-) at -e line 1.
0
to comply with what happens when the UTF8 flag is not set. But it was
relying on bugs in sv_2iv, etc.
So, from 5.8.0 to 5.10.0 inclusive, unary negation prepends "-" if the
string begins with [A-Za-z], but from 5.10.1 onwards it behaves diffe-
rently depending on the internal UTF8 flag (even prepending "-" to
ASCII-only strings like "%apples" if the UTF8 flag is on).
This commit restores the 5.8.0-5.10.0 behaviour, which was at least
self-consistent.
Father Chrysostomos [Wed, 6 Jun 2012 19:49:05 +0000 (12:49 -0700)]
Fix perl #57706 for magical vars: -"-10"
Commit
a5b92898 caused -"-10" to return 10, not "+10". But it wasn’t
working for magical variables.
SvIV_please_nomg was fixed recently for magical variables, but not
SvIV_please, so change pp_negate to use that.
(Ironically, SvIV_please has never called magic, so the
SvIV_please_nomg variant never needed to exist. So the two could
be merged.)
Father Chrysostomos [Wed, 6 Jun 2012 05:38:12 +0000 (22:38 -0700)]
pp_negate: Don’t treat nummified str as num
I think it’s a bug that this prints 0:
$ ./perl -lIlib -MDevel::Peek -e '$x = "dogs"; 0+$x; Dump $x; print -$x'
SV = PVNV(0x802340) at 0x821b90
REFCNT = 1
FLAGS = (POK,pIOK,pNOK,pPOK)
IV = 0
NV = 0
PV = 0x301620 "dogs"\0
CUR = 4
LEN = 16
0
This variable is a string, not a number. The number 0 is just a
cached value. It lacks the IOK flag precisely because the IV is not
representative of the actual value of the scalar.
This logic here is a little bit odd:
if( !SvNIOK( sv ) && looks_like_number( sv ) ){
SvIV_please( sv );
}
if ((flags & SVf_IOK) || ((flags & (SVp_IOK | SVp_NOK)) == SVp_IOK)) {
SvIV_please sets the flags on sv but then they are ignored when check-
ing for integrality.
To fix the bug mentioned above, I had to change this logic to use sv
directly, rather than the saved flags.
That meant that this bug was also fixed at the same time, since the
integer code is no longer bypassed when it is SvIV_please that sets
the integer flags:
$ ./perl -Ilib -le 'print -
97656250000000000'
-
97656250000000000
$ ./perl -Ilib -le 'print -"
97656250000000000"'
-9.765625e+16
Father Chrysostomos [Wed, 6 Jun 2012 03:09:32 +0000 (20:09 -0700)]
[perl #109542] Make num ops treat $1 as "$1"
Numeric ops were not taking magical variables into account. So $1 (a
magical variable) would be treated differently from "$1" (a non-magi-
cal variable0.
In determining whether to use an integer operation, they would call
SvIV_please_nomg, and then check whether the sv was SvIOK as a result.
SvIV_please_nomg would call SvIV_nomg if the sv were SvPOK or SvNOK.
The problem here is that gmagical variables are never SvIOK, but
only SvIOKp.
In fact, the private flags are used differently for gmagical and non-
magical variables. For non-gmagical variables, the private flag indi-
cates that there is a cached value. If the public flag is not set,
then the cached value is imprecise. For gmagical variables, imprecise
values are never cached; only the private flags are used, and they are
equivalent to the public flags on non-gmagical variables.
This commit changes SvIV_please_nomg to take gmagical variables
into account, using the newly-added sv_gmagical_2iv_please (see the
docs for it in the diff). SvIV_please_nomg now returns true or
false, not void, since a subsequent SvIOK is not reliable. So
‘SvIV_please_nomg(sv); if(SvIOK)’ becomes ‘if(SvIV_please_nomg(sv))’.
Father Chrysostomos [Sun, 27 May 2012 07:11:31 +0000 (00:11 -0700)]
Make warn handle magic vars (fixes [perl #97480])
pp_warn was checking flags before calling get-magic, resulting in sev-
eral bugs that I fixed all at once::
• warn now calls get-magic exactly once on its argument, when there
is just one argument (it always worked correctly for multiple)
[perl #97480].
• warn calls get-magic exactly once on $@ when falling back to it,
instead of zero times.
• A tied variable returning an object that stringifies as an empty
string is no longer ignored if the tied variable was not ROK
before FETCH.
• A tied $@ containing a string, or $@ aliased to $1, is no
longer ignored.
• A tied $@ that last returned a reference but will return a string on
the next FETCH now gets "\t...caught" appended.
Father Chrysostomos [Sat, 26 May 2012 13:00:01 +0000 (06:00 -0700)]
Make prototype call FETCH before checking CORE:: prefix
$ perl5.16.0 -e '"CORE::length" =~ /(.*)/; warn prototype $1;'
Warning: something's wrong at -e line 1.
$ perl5.16.0 -e 'warn prototype "CORE::length"'
_ at -e line 1.
Since sv_2cv calls get-magic, the easiest solution is to copy the
argument if it is magical.
Father Chrysostomos [Sat, 26 May 2012 05:44:39 +0000 (22:44 -0700)]
Make strict refs report $1 the same way as "$1"
A magical variable is never SvPOK, but only SvPOKp. The code that
determined whether to put an ellipsis mark after a truncated symbol
name was only checking SvPOK, resulting in this discrepancy:
$ perl5.15.9 -e 'use strict; *{"a"x40}'
Can't use string ("
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"...) as a symbol ref while "strict refs" in use at -e line 1.
$ perl5.15.9 -e 'use strict; ("a"x40)=~/(.*)/; *{$1}'
Can't use string ("
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") as a symbol ref while "strict refs" in use at -e line 1.
$ perl5.15.9 -e 'use strict; ${"a"x40}'
Can't use string ("
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"...) as a SCALAR ref while "strict refs" in use at -e line 1.
$ perl5.15.9 -e 'use strict; ("a"x40)=~/(.*)/; ${$1}'
Can't use string ("
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") as a SCALAR ref while "strict refs" in use at -e line 1.
SvPOK variables are also SvPOKp, so checking just the latter suffices.
Father Chrysostomos [Fri, 25 May 2012 06:13:37 +0000 (23:13 -0700)]
Make open(... "<&", $fileno) respect magic
A magical variable is never SvPOK, but only SvPOKp. The code for
checking whether a duplicatee is a numeric file descriptor was only
checking SvPOK. So a regular variable containing a fileno-as-a-string
would work, such as the $a below, as would a stringified magical vari-
able ("$1"), but not $1 itself.
$ echo foo | perl -le '$a = "0"; open a, "<&", $a; warn <a>'
foo
$ echo foo | perl -le '"0" =~ /(.)/; open a, "<&", $1; warn <a>'
Can't use an undefined value as filehandle reference at -e line 1.
$ echo foo | perl -le '"0" =~ /(.)/; open a, "<&", "$1"; warn <a>'
foo
SvPOK variables are also SvPOKp, so checking only the latter suffices.
Father Chrysostomos [Fri, 25 May 2012 05:46:56 +0000 (22:46 -0700)]
util.c:report_evil_fh: Report name w/initial null
In the error message, we shouldn’t omit a handle whose name begins
with "\0", but, rather, a handle whose name has no length to it.
Father Chrysostomos [Fri, 25 May 2012 05:46:16 +0000 (22:46 -0700)]
util.c:report_evil_fh: Rmv redundant SvPOK
newSVhek (used to create this SV) always returns an SvPOK scalar.
Father Chrysostomos [Fri, 25 May 2012 05:41:53 +0000 (22:41 -0700)]
util.c:report_wrongway_fh: Report name w/initial null
In the error message, we shouldn’t omit a handle whose name begins
with "\0", but, rather, a handle whose name has no length to it.
Father Chrysostomos [Fri, 25 May 2012 05:19:29 +0000 (22:19 -0700)]
util.c:report_evil_fh: Rmv redundant isGV check
Checking isGV_with_GP makes the isGV check redundant. The only case
in which isGV could be true when isGV_with_GP is false could be a GV
playing PVBM, but those don’t exist any more. When they did exist,
this check was probably wrong (and crashable).
Father Chrysostomos [Fri, 25 May 2012 05:16:52 +0000 (22:16 -0700)]
util.c:report_wrongway_fh: Don’t create an SV
Now that sv_vcatpvfn supports HEKs directly, we don’t need to create a
temporary SV out of one.
Father Chrysostomos [Fri, 25 May 2012 05:10:32 +0000 (22:10 -0700)]
util.c:report_wrongway_fh: Rmv redundant isGV check
Checking isGV_with_GP makes the isGV check redundant. The only case
in which isGV could be true when isGV_with_GP is false could be a GV
playing PVBM, but those don’t exist any more. When they did exist,
this check was probably wrong (and crashable).
Father Chrysostomos [Fri, 25 May 2012 03:37:01 +0000 (20:37 -0700)]
Make UNIVERSAL::can treats str and num the same way
Father Chrysostomos [Thu, 24 May 2012 19:45:58 +0000 (12:45 -0700)]
Use the same top format error for ""
See also the previous commit.
2dd78f96 added the ‘Undefined top format called’ message for those
cases where a GV doesn’t have a name. That was a bug that used to
happen with *{$io}, which can’t happen any more.
The code that
2dd78f96 added ended up changing a zero-length name to
be treated the same way as no name. It also checked the length by
cheating and checking the first character instead.
Now that we have support for embedded nulls, that logic ends up wrong
for names like "\0foo". And there is no need to treat "" differently
from "foo" anyway.
So this patch restores things the way they were before
2dd78f96.
It also improves the tests for ‘Undefined format’.
Writing tests for ‘Undefined top format’ was quite painful, as that
error seems to leave the internal state out of synch. I suspect
PL_formtarget needs to be localised, or the error just needs to come
earlier in pp_leavewrite. But I’ll save that for later, or for Dave
Mitchell. :-)
Father Chrysostomos [Thu, 24 May 2012 19:17:02 +0000 (12:17 -0700)]
Get rid of ‘Not a format reference’
This commit:
commit
2dd78f96d61cc6382dc72214930c993567209597
Author: Jarkko Hietaniemi <jhi@iki.fi>
Date: Sun Aug 6 01:33:55 2000 +0000
Continue fixing the io warnings. This also
sort of fixes bug ID
20000802.003: the core dump
is no more. Whether the current behaviour is correct
(giving a warning: "Not a format reference"), is another matter.
p4raw-id: //depot/perl@6531
added a check to see whether the format GV’s name is null, and, if
so, it dies with ‘Not a format reference’. Before that, that message
occurred only for lack of a GV.
The bug mentioned is now #3617, involving write(*STDOUT{IO}). write
puts an implicit *{} around its argument.
*{$io} has historically been very buggy in its stringification, so
this patch seems to have been working around that bugginess, by fall-
ing back to the ‘Not a format reference’ error if the name couldn’t be
determined for ‘Undefined format "foo" called’.
*{$io} was fixed once and for all in 5.16. It now stringifies as
*foopackage::__ANONIO__.
I don’t think producing a completetly different error based on the
name of the GV (whether it’s "foo" or "") is correct at all. And the
patch that made it happen was just a fix for a crash that can’t hap-
pen any more.
So the only case that should produce ‘Not a format reference’ is that
in which there is no format GV (fgv).
I can prove that fgv is always set (see below), and has been at least
since 5.000, so that ‘Not a format reference’ actually could never
occur before
2dd78f96d61c. (Actually, XS code could set PL_defoutgv
to null until the previous commit, but everything would start crashing
as a result, so it has never been done in practice.)
gv_efullname4 always returns a name, so checking SvPOK(tmpsv) is
redundant; checking whether the string buffer begins with a non-null
char is not even correct, as "\0foo" fails that test.
Proof that fgv is always set:
The current (prior to this commit) code in pp_enterwrite is like this:
if (MAXARG == 0) {
gv = PL_defoutgv;
EXTEND(SP, 1);
}
else {
gv = MUTABLE_GV(POPs);
if (!gv)
gv = PL_defoutgv;
}
If the stack value is null (which actually can’t happen), PL_defoutgv
is used. PL_defoutgv can’t be null.
At this point, gv is set to something non-null.
io = GvIO(gv);
if (!io) {
RETPUSHNO;
}
Here we only set fgv to IoFMT_GV(io) if it is non-null. Otherwise we
use gv, which we know is non-null.
if (IoFMT_GV(io))
fgv = IoFMT_GV(io);
else
fgv = gv;
Father Chrysostomos [Thu, 24 May 2012 19:07:37 +0000 (12:07 -0700)]
Make setdefout accept only NN
Just search through the source for GvIOp(PL_defoutgv) and you will see
that perl assumes that PL_defoutgv is never null.
I tried setting it to null from XS and got crashes, unsurprisingly.
The only CPAN user of PL_defoutgv sets it to STDOUT.
Father Chrysostomos [Thu, 24 May 2012 06:24:35 +0000 (23:24 -0700)]
Assertion failure with $/=*foo; warn;
$ ./perl -Ilib -e '$/=*foo; <>; warn' <./perl
Assertion failed: (!isGV_with_GP(_svcur)), function Perl_mess_sv, file util.c, line 1467.
Abort trap
The assertion happens when ‘<...> line 42’ is being appended to
the message.
The line of code in question is this:
const bool line_mode = (RsSIMPLE(PL_rs) &&
SvCUR(PL_rs) == 1 && *SvPVX_const(PL_rs) == '\n');
It uses this macro in perl.h:
#define RsSIMPLE(sv) (SvOK(sv) && (! SvPOK(sv) || SvCUR(sv)))
which was last modified by commit
af7d13df559:
-#define RsSIMPLE(sv) (SvOK(sv) && SvCUR(sv))
-#define RsPARA(sv) (SvOK(sv) && ! SvCUR(sv))
+#define RsSIMPLE(sv) (SvOK(sv) && (! SvPOK(sv) || SvCUR(sv)))
+#define RsPARA(sv) (SvPOK(sv) && ! SvCUR(sv))
So it looks as though it has always called SvCUR on something that is
not necessarily a PV. As of commit
af7d13df559, it has also called
SvPVX on a potential non-PV.
Fixing this simply involves using SvPV instead of SvPVX.
I don’t know that t/io/open.t is the best place for the test, but all
the other ‘<...> line 42’ tests are there.
Steve Hay [Thu, 7 Jun 2012 13:24:42 +0000 (14:24 +0100)]
Remove some commented-out lines from win32/config_h.PL
Steve Hay [Thu, 7 Jun 2012 12:39:01 +0000 (13:39 +0100)]
Remove some unnecessary apostrophes from win32/config_sh.PL
Steve Hay [Thu, 7 Jun 2012 12:36:37 +0000 (13:36 +0100)]
Use strict and warnings in win32/config_(s)h.PL
Steve Hay [Thu, 7 Jun 2012 07:58:13 +0000 (08:58 +0100)]
Remove $patchlevel from win32/config_h.PL since it is never used
Steve Hay [Thu, 7 Jun 2012 07:48:09 +0000 (08:48 +0100)]
Set version directly in Windows config.xxx files
There is no need for doing it via a ~VERSION~ substitution string since
that is not used anywhere else.
Steve Hay [Thu, 7 Jun 2012 07:35:23 +0000 (08:35 +0100)]
Update how subversion is set in win32 config.xxx files
SUBVERSION was the old name from patchlevel.h but we should prefer to use
PERL_SUBVERSION now, just like patchlevel is already set from PERL_VERSION
rather than the old PATCHLEVEL.
Steve Hay [Thu, 7 Jun 2012 07:20:09 +0000 (08:20 +0100)]
Remove INST_DRV from Windows makefiles' CFG_VARS
It isn't directly used by config_sh.PL, and the only appearance of it
in a config.xxx file was config.ce, where it was surely wrong: prefixexp
should be a ~name expanded version of prefix, so just set it to ~INST_TOP~
like the other config.xxx files all do.
Chris 'BinGOs' Williams [Thu, 7 Jun 2012 07:03:31 +0000 (08:03 +0100)]
Sync Maintainers.pl for recent Storable CPAN release
Yves Orton [Wed, 6 Jun 2012 06:53:05 +0000 (08:53 +0200)]
optimise (?:|) and related NOTHING like constructs out of the compiled optree
A pattern like (?:|) causes the regex engine to do extra work even though
it is equivelent to matching nothing. This optimises such sequences into
more efficient opcodes that do less work, and in some cases optimises
them away entirely.
Craig A. Berry [Thu, 7 Jun 2012 02:53:48 +0000 (21:53 -0500)]
Correct the dlsrc entry in configure.com.
It's not the .c, it's the .xs from which we generate the .c.
Spotted by Nicholas.
Steve Hay [Wed, 6 Jun 2012 18:17:16 +0000 (19:17 +0100)]
Remove Win9x hangover from win32/config_sh.PL
We no longer support Win9x so there is no need to undef d_flock and d_link
in that case.
Steve Hay [Wed, 6 Jun 2012 18:15:25 +0000 (19:15 +0100)]
Remove redundant substitution from win32/config_sh.PL
INST_VER doesn't contain a ~VERSION~ placeholder.
Steve Hay [Wed, 6 Jun 2012 18:13:28 +0000 (19:13 +0100)]
perldelta for
c2f56b9483 and
a970290aa9.
Andy Dougherty [Wed, 6 Jun 2012 15:12:58 +0000 (11:12 -0400)]
Configure: Avoid Cppsym warnings for extra tokens [perl #113024]
The cppsymbols can include macros such as __INT16_C(c), which can't
be tested with a simple #ifdef. This patch strips off the opening
parenthesis and everything following it. These macros were generated
by cpp -dM.
Also ensure Cppsym.true list is sorted for later input to comm.
(I noticed this while testing this change on Solaris.)
Andy Dougherty [Wed, 6 Jun 2012 13:07:11 +0000 (09:07 -0400)]
Replace $compile_ok by $compile for two probes that can fail.
The probes for _NSGetExecutablePath and KERN_PROC_PATHNAME
will fail on systems where they are not available. This is
normal, so use $compile to throw away the error messages.
Father Chrysostomos [Wed, 6 Jun 2012 03:13:21 +0000 (20:13 -0700)]
pending-author.t: Skip for lack of config
That ‘git config --get user.email’ will output something is a big
assumption.
Father Chrysostomos [Tue, 5 Jun 2012 23:31:31 +0000 (16:31 -0700)]
Make B::COP::stashpv respect utf8 and embedded nulls
This was mentioned in ticket #113060.
This commit also adds another stashoff test.
The diff looks a bit complicated, because it stops ->file and
->stashpv from being XS aliases.
Father Chrysostomos [Tue, 5 Jun 2012 23:06:34 +0000 (16:06 -0700)]
stash.t: 2 TODO tests I missed
Father Chrysostomos [Tue, 5 Jun 2012 23:03:47 +0000 (16:03 -0700)]
Fix version logic in B.xs
Father Chrysostomos [Tue, 5 Jun 2012 21:41:25 +0000 (14:41 -0700)]
Change B::COP::stashlen to stashoff
This was brought up in ticket #78742.
The stashlen method has never been in a stable release, and no longer
exists, as of
d4d03940c, since it is dependent on a define that
d4d03940c removed.
So this commit removes stashlen from B.xs and adds stashoff in its
place, since this is what B::C needs.
It also adds a few basic tests for the stash and stashpv methods.
Nicholas Clark [Tue, 5 Jun 2012 18:59:50 +0000 (20:59 +0200)]
Merge improvements to make_ext.pl
Nicholas Clark [Sun, 3 Jun 2012 20:05:58 +0000 (22:05 +0200)]
In make_ext.pl, inline _macroify_passthrough() into its only caller.
Nicholas Clark [Sat, 2 Jun 2012 10:17:29 +0000 (12:17 +0200)]
In make_ext.pl, only fudge the Makefile.PL timestamp when generating it.
The expedient fudge added by commit
23525070d6c0e51f was actually after the
closing } for the if block that auto-generated a Makefile.PL. Hence it was
*always* changing the timestamp on every Makefile.PL just before running it,
even the ones checked out from the repository. That seems a bit wrong.
Nicholas Clark [Fri, 27 Apr 2012 10:05:38 +0000 (12:05 +0200)]
make_ext.pl need not manipulate @INC, as buildcustomize.pl already does it.
Remove from make_ext.pl code that predates the introduction of
buildcustomize.pl, as that now sets up @INC correctly before make_ext.pl even
runs. During the build process make_ext.pl is only run by miniperl.
Nicholas Clark [Fri, 27 Apr 2012 11:05:26 +0000 (13:05 +0200)]
In make_ext.pl, move loading FindExt and Cwd into the Win32-only code.
As Cwd is now required instead of used and hence doesn't export, qualify
the calls to getcwd() with the package name.
Dominic Hargreaves [Mon, 4 Jun 2012 14:09:00 +0000 (15:09 +0100)]
Check for linuxthreads with POSIX semantics
In newer versions of GNU/kFreeBSD, linuxthreads supports POSIX semantics;
include a version check in t/op/getpid.t accordingly.
Yves Orton [Tue, 20 Mar 2012 01:01:16 +0000 (02:01 +0100)]
make TRIE nodes "absorb" NOTHING->EXACT sequences
Patterns like /(?:)foo|(?:)bar/ are not optimised into TRIE nodes
as the "NOTHING" gets in the way. This patch handles this properly.
Yves Orton [Sun, 22 Apr 2012 13:58:32 +0000 (15:58 +0200)]
fix [perl #76546] regex engine slowdown bug
An earlier version of this patch was reverted. This should resolve
that problem.
Father Chrysostomos [Tue, 5 Jun 2012 05:06:04 +0000 (22:06 -0700)]
[perl #113486] pp_ctl.c: Don’t assume CopSTASH is a hash
Calling HvNAME_HEK on something that is not a hash will result in a
crash if it happens to have the SvOOK flag on, because then it tries
to read to the end of HvARRAY, which may not even be a valid pointer.
This can happen with this convoluted test case:
{ package foo; sub bar { main::bar() } }
sub bar {
delete $::{"foo::"};
my $x = \($1+2);
my $y = \($1+2); # this is the one that reuses the mem addr, but
my $z = \($1+2); # try the others just in case
s/2// for $$x, $$y, $$z; # now SvOOK
warn scalar caller
};
foo::bar
This commit only partially fixes ticket #113486, by eliminating
the crash. We still have the problem of an unrelated stash reus-
ing the SV.
Father Chrysostomos [Tue, 5 Jun 2012 03:36:39 +0000 (20:36 -0700)]
Fix bad assertions in pp_ctl.c:pp_caller
If a stash is freed or undefined by code that it calls, then pp_caller
can encounter a freed stash or nameless stash. HvNAME_HEK returns
null for a freed scalar and for a hash without a name. So CopSTASHPV
will also be null in that case, which is expected. If the hash is
undefined, it may not be SvOOK any more, and if it is freed it defi-
nitely won’t be.
The following code *does* assume, however that CopSTASH is non-null,
so assert that.
Father Chrysostomos [Tue, 5 Jun 2012 00:06:03 +0000 (17:06 -0700)]
Do away with stashpv_hvname_match
For some reason this is listed in the API, even though it is not docu-
mented and is only available under ithreads.
It was added by commit
ed221c5717, which doesn’t explain why it needed
to be part of the API. (Presumably because a public macro used it,
even though there are better ways to solve that.)
It is unused on CPAN and (now) in core, so there is no reason
to keep it.
Father Chrysostomos [Mon, 4 Jun 2012 23:57:23 +0000 (16:57 -0700)]
Say goodbye to SAVECOPSTASH
This is undocumented and unused.
Father Chrysostomos [Mon, 4 Jun 2012 23:44:54 +0000 (16:44 -0700)]
Obliterate CopSTASH_free
It is unused outside the core, defined as a no-op, and undocumented.
Father Chrysostomos [Mon, 4 Jun 2012 23:41:23 +0000 (16:41 -0700)]
stash.t: Un-TODO passing tests
Father Chrysostomos [Mon, 4 Jun 2012 21:04:03 +0000 (14:04 -0700)]
[perl #78742] Store CopSTASH in a pad under threads
Before this commit, a pointer to the cop’s stash was stored in
cop->cop_stash under non-threaded perls, and the name and name length
were stored in cop->cop_stashpv and cop->cop_stashlen under ithreads.
Consequently, eval "__PACKAGE__" would end up returning the
wrong package name under threads if the current package had been
assigned over.
This commit changes the way cops store their stash under threads. Now
it is an offset (cop->cop_stashoff) into the new PL_stashpad array
(just a mallocked block), which holds pointers to all stashes that
have code compiled in them.
I didn’t use the lexical pads, because CopSTASH(cop) won’t work unless
PL_curpad is holding the right pad. And things start to get very
hairy in pp_caller, since the correct pad isn’t anywhere easily
accessible on the context stack (oldcomppad actually referring to the
current comppad). The approach I’ve followed uses far less code, too.
In addition to fixing the bug, this also saves memory. Instead of
allocating a separate PV for every single statement (to hold the stash
name), now all lines of code in a package can share the same stashpad
slot. So, on a 32-bit OS X, that’s 16 bytes less memory per COP for
short package names. Since stashoff is the same size as stashpv,
there is no difference there. Each package now needs just 4 bytes in
the stashpad for storing a pointer.
For speed’s sake PL_stashpadix stores the index of the last-used
stashpad offset. So only when switching packages is there a linear
search through the stashpad.
Father Chrysostomos [Mon, 4 Jun 2012 20:10:28 +0000 (13:10 -0700)]
Increase $B::VERSION to 1.36
Father Chrysostomos [Sun, 3 Jun 2012 02:03:52 +0000 (19:03 -0700)]
pad.c: Remove obsolete comment
We now store the UTF8-ness in the pad, as of 5.15.4 or so.
Father Chrysostomos [Fri, 1 Jun 2012 06:02:31 +0000 (23:02 -0700)]
Don’t localise CopSTASH(&PL_compiling) in newCONSTSUB
When newCONSTSUB was added in commit
5476c433, it did not set
curcop temporarily to &compiling, and so gv_fetchpv would look at
curcop->cop_stash. So cop_stash needed to be localised.
(Time passes.... curcop is now PL_curcop. &compiling is
now &PL_compiling. gv_fetchpv is now gv_fetchpvn_flags.
curcop->cop_stash is now CopSTASH(PL_curcop).)
Since commit
401667e9, newCONSTSUB has set PL_curcop to &PL_compiling
temporarily. When that is the case, gv_fetchpvn_flags uses
PL_curstash and ignores CopSTASH(PL_curcop).
So this localisation is no longer necessary, as newCONSTSUB has always
set (PL_)curstash.
Ricardo Signes [Tue, 5 Jun 2012 00:29:01 +0000 (20:29 -0400)]
add details for doy and TonyC for July 20
Nicholas Clark [Mon, 4 Jun 2012 19:27:58 +0000 (21:27 +0200)]
Bump $Pod::Html::VERSION to reflect the changes of commit
978af2c644ee9abf.
Steve Peters [Mon, 4 Jun 2012 14:52:17 +0000 (09:52 -0500)]
Merge branch 'post-5.16' into blead
Craig A. Berry [Mon, 4 Jun 2012 01:31:31 +0000 (20:31 -0500)]
Version bump for POSIX.pm.
Craig A. Berry [Sun, 3 Jun 2012 23:38:30 +0000 (18:38 -0500)]
extern "C" for POSIX.xs.
We are repeating standard prototypes but we haven't been making
them compatible with the standard versions when compiling under
C++. Now we do.
Craig A. Berry [Sun, 3 Jun 2012 23:17:28 +0000 (18:17 -0500)]
extern "C" for sdbm.c.
Whether we really need to be rolling our own prototypes for malloc
and free in this day and age is unclear, but since we do, we need
to keep them in the unmangled C namespace rather than in C++'s
std:: namespace.
Nicholas Clark [Sun, 3 Jun 2012 20:50:57 +0000 (22:50 +0200)]
Remove commented-out debugging print statements from File:DosGlob
None of these have been changed in over a decade, aside from re-indentation.
Leave in 3 commented-out print statements which are necessary to understand
a FIXME comment.
Nicholas Clark [Sun, 3 Jun 2012 20:39:50 +0000 (22:39 +0200)]
Refactor File::DosGlob to avoid an unescaped { in a regex.
This avoids generating deprecation warnings.
Karl Williamson [Sat, 2 Jun 2012 18:05:34 +0000 (12:05 -0600)]
mktables: Convert to BELL meaning U+1F514
As a result of the Unicode 6.0 mistake of using "BELL" to refer to
a different code point, Perl has deprecated use of this name for 2 major
release cycles, while not fully implementing Unicode in the interim, to
allow any affected code to migrate to the new name
This commit now switches to the new meaning of BELL.
Nicholas Clark [Sat, 2 Jun 2012 15:32:44 +0000 (16:32 +0100)]
mktables memory reduction
Does the attached patch make sense? It lowers RAM and CPU usage by about 10%
on Linux, and 6% on FreeBSD.
Nicholas Clark
>From
fe46bd796c282f6a6e4793afaf847e04d3be3524 Mon Sep 17 00:00:00 2001
From: Nicholas Clark <nick@ccl4.org>
Date: Mon, 7 May 2012 09:58:13 +0200
Subject: [PATCH] In mktables, lazily compute the 'standard_form' for Ranges.
Instead of calculating the standard form up front, calculate it only when
needed and cache the result. There are 368676 non-special objects, but
the standard form is only requested for 22047 of them. For the systems I
tested on, this reduces RAM and CPU usage by about 10% on Linux, and 6% on
FreeBSD.
This is more significant than it may first seem, because mktables is the
largest RAM user of anything run during the build process, so this reduces
the build process peak RAM requirement.
Karl Williamson [Fri, 1 Jun 2012 19:31:31 +0000 (13:31 -0600)]
podcheck.t: white-space only: indent properly
Karl Williamson [Sat, 2 Jun 2012 15:54:14 +0000 (09:54 -0600)]
perldelta entry for Perl working on all Unicode releases
Craig A. Berry [Sat, 2 Jun 2012 15:15:57 +0000 (10:15 -0500)]
VMS --> __VMS in a2p.h.
C++ does not define VMS, only __VMS. We define VMS in config.h
for C++, but here we're trying to figure out how to include config.h,
so we don't have it yet.
The only compiler that defined only VMS and not __VMS was VAX C,
which isn't C89-compliant and can't build Perls from the current
century.
Karl Williamson [Sat, 2 Jun 2012 14:37:18 +0000 (08:37 -0600)]
Allow Perl to use older Unicode releases
We have claimed for several releases now that Perl can handle any
release of Unicode so far. It turns out that this was never entirely
true, and became less true in 5.16 due to the changes necessitated by
Unicode's publishing names for the control characters. Enough work was
done in 5.16 so that Perl could continue to handle Unicode 6.0, which
meant that someone using Perl 5.14 and Unicode 6.0, and who didn't like
6.1 could still upgrade to Perl 5.16 while retaining 6.0. By having
mktables able to compile old releases of Unicode, we can continue to
evolve Perl without having to write special code in the core for
backwards Unicode compatibility.
This series of commits is mostly about allowing Perl to work on any
Unicode release. And, I have done a make test using these patches on
recent bleads for every Unicode release. Tests fail which use code
points that have yet to be assigned in those earlier releases, as well
as tests that expect certain values that Unicode has since changed, but
Perl works as well as can be expected on all releases. I changed a few
.t's so that they adapt more to the Unicode release they are run with.
The biggest outage is Unicode::Normalize. Prior to Unicode 3.0, there
could be decompositions containing more than 2 code points.
Unicode::Normalize will not compile with those early versions. However,
a trivial change to it (documented now in mktables) to use carp instead
of croak will cause it to compile and run, though all 3-or-more
character decompositions will be unknown to it. I think that the
earliest release of Unicode that it makes sense to do serious work on is
3.2.
There is the issue as to how to prevent future changes to mktables from
breaking backwards compatibility. I don't know how to fix that, except
that as long as I'm involved, I will test it on old releases some time
before code freeze.
Karl Williamson [Fri, 1 Jun 2012 02:22:26 +0000 (20:22 -0600)]
mktables: Use for loop instead of each
I think the 'for' is easier to understand
Karl Williamson [Fri, 1 Jun 2012 02:21:13 +0000 (20:21 -0600)]
mktables: Allow easy generation of Unicode-deprecated files
Sometimes in debugging, etc, it is useful to have these files; this adds
a single scalar to control if they get generated.
Karl Williamson [Fri, 1 Jun 2012 02:20:20 +0000 (20:20 -0600)]
mktables, README.perl: Add, fix comments
Karl Williamson [Fri, 1 Jun 2012 01:06:31 +0000 (19:06 -0600)]
perl.pod: Remove reference to specific Unicode version
I forgot to update this from 6.1, and it really isn't necessary. Also
update the instructions for new releases to omit reference to this.
Karl Williamson [Wed, 16 May 2012 17:31:50 +0000 (11:31 -0600)]
utf8.c: Use new internal properties for \X
These new properties are generated for all Unicode releases, and so \X
can now work on all Unicodes, not just the ones where Unicode has
defined them.
Karl Williamson [Wed, 16 May 2012 17:30:53 +0000 (11:30 -0600)]
mktables: White-space only
This outdents code since the surrounding blocks have been removed