Karl Williamson [Tue, 26 Nov 2013 02:03:29 +0000 (19:03 -0700)]
perluniprops: Tweaks
Every time I read over something I wrote, I see some improvements in the
wording, and in this case the layout as well: a couple of lists are set
off by indententation
Karl Williamson [Tue, 26 Nov 2013 01:24:17 +0000 (18:24 -0700)]
perlapi: Refer to correct formal parameter name
Karl Williamson [Sat, 23 Nov 2013 16:55:04 +0000 (09:55 -0700)]
handy.h: Remove duplicate line
Two adjacent lines were identical. Only one is needed.
Ricardo Signes [Mon, 25 Nov 2013 23:18:08 +0000 (18:18 -0500)]
document the deprecation of literal ctrl char varnames
Steve Hay [Mon, 25 Nov 2013 18:05:33 +0000 (18:05 +0000)]
List another VC++ 2013 test failure
The first two happened when in BST but don't happen now, back in GMT; but
lib/File/Copy.t now fails instead!
This is all due to _utime() being broken in VC++ 2013's CRT. Microsoft have
acknowledged there is a regression from previous versions of the CRT in a
support ticket that I logged with them, and will publish a Knowledge Base
article about it in due course.
(Users can workaround it by using the Win32::UTCFileTime module on CPAN,
which exists to fix other (long-standing) issues with _stat() and _utime(),
but also fixes this new breakage too.)
Father Chrysostomos [Mon, 25 Nov 2013 07:30:09 +0000 (23:30 -0800)]
Test that (??{$pvlvregexp}) does not recompile the regexp
2685dc2d9a accidentally fixed this. Oops! :-)
Father Chrysostomos [Mon, 25 Nov 2013 07:11:57 +0000 (23:11 -0800)]
Reënable qr caching for (??{}) retval where possible
When a scalar is returned from (??{...}) inside a regexp, it gets com-
piled into a regexp if it is not one already. Then the regexp is sup-
posed to be cached on that scalar (in magic), so that the same scalar
returned again will not require another compilation.
Commit
e4bfbed39b disabled caching except on references to overloaded
objects. But in that one case the caching caused erroneous behaviour,
which was just fixed by
636209429f and this commit’s parent, effect-
ively disabling the cache altogether.
The cache is disabled because it does not apply to TEMP variables
(those about to be freed anyway, for which caching would be a waste
of CPU), and all non-overloaded non-qr thingies get copied into
new mortal (TEMP) scalars (as of
e4bfbed39b) before reaching the
caching code.
This commit skips the copy if the return value is already a non-magi-
cal string or number. It also allows the caching to happen on con-
stants, which has never been permitted before. (There is actually no
reason for disallowing qr magic on read-only variables.)
Father Chrysostomos [Mon, 25 Nov 2013 07:10:42 +0000 (23:10 -0800)]
Don’t cache qr magic on references
When a scalar is returned from (??{...}) inside a regexp, it gets com-
piled into a regexp if it is not one already. Then the regexp is sup-
posed to be cached on that scalar (in magic), so that the same scalar
returned again will not require another compilation.
This has never worked correctly with references, because the value was
being cached against the returned scalar itself, whereas the *refer-
ent* of a returned reference was being checked for qr magic.
Commit
636209429 (recent) attempted to fix the resulting bug, but
ended up exposing another, older bug, that
e4bfbed39b (5.18) acciden-
tally (?) fixed. The stringification of a reference can easily change
without the reference itself being touched. So set-magic (which
clears the qr cache) is never triggered:
{ package o; use overload '""'=>sub{"abc"} }
$x = bless \$y, "o";
sub foo { warn "abc" =~ /(??{$x})/ }
foo();
bless \$y;
warn "$x";
foo();
__END__
Output:
1 at - line 3.
main=SCALAR(0x7fcbc3027478) at - line 6.
1 at - line 3.
Blessing \$y into main causes it to stringify as
main=SCALAR(0x7fcbc3027478). So how can "abc" match
/main=SCALAR(0x7fcbc3027478)/?
Skipping the cache for references obviously fixes this. The cache was
only being stored on refs to overloaded objects, which don’t use the
cache. The only case in which is was being used was when the over-
loaded object was blessed into a non-overloaded class, and then it
was incorrect.
Father Chrysostomos [Mon, 25 Nov 2013 02:12:04 +0000 (18:12 -0800)]
Make (??{$tied_ovrld}) see the right $1
I can return $1 from a regexp code block and it refers to the last
match *within* the block:
"aab" =~ /(a)((??{"b" =~ m|(.)|; $1}))/;
print "[$1 $2]\n";
Output:
[a b]
Even via a tied variable’s FETCH method:
sub ReEvalTieTest::TIESCALAR {bless[], "ReEvalTieTest"}
sub ReEvalTieTest::FETCH { "$1" }
tie my $t, "ReEvalTieTest";
"aab" =~ /(a)((??{"b" =~ m|(.)|; $t}))/;
print "[$1 $2]\n";
Output:
[a b]
But not if I assign a reference to an overloaded object to the tied
variable first:
sub ReEvalTieTest::TIESCALAR {bless[], "ReEvalTieTest"}
sub ReEvalTieTest::STORE{}
sub ReEvalTieTest::FETCH { "$1" }
tie my $t, "ReEvalTieTest";
{ package o; use overload '""'=>sub { "abc" } }
$t = bless [], "o";
"aab" =~ /(a)((??{"b" =~ m|(.)|; $t}))/;
print "[$1 $2]\n";
Output:
[a a]
$1 now refers to the outer pattern, not the inner pattern.
The code that handles the return value of code blocks was not check-
ing get-magic before overloading.
This commit fixes it to do that.
Craig A. Berry [Mon, 25 Nov 2013 00:40:32 +0000 (18:40 -0600)]
Improve prefix removal from PPF translations.
When doing a logical name translation of a process-permanent file
(SYS$INPUT, SYS$OUTPUT, SYS$ERROR, or SYS$COMMAND), we need to
remove the special 0x001b prefix from the translation string
regardless of whether we are combining a search list into a
longer equivalence string or just doing a simple, index-free
lookup.
Since we now have two places needing the same logic, move that
logic into a static inline function.
Craig A. Berry [Mon, 25 Nov 2013 00:27:00 +0000 (18:27 -0600)]
Fix VMS-specific wraparound error in S_mayberelocate.
In trimming the trailing slash from a Unix path spec, we haven't
(since 5.003 or so) been ensuring that we weren't stepping off
the beginning of the string. No, it's not normal to have '/' as
a library path, but if it happens we shouldn't allow a zero or
negative (actually wraparound since unsigned) value for the path
length.
Father Chrysostomos [Sun, 24 Nov 2013 23:58:02 +0000 (15:58 -0800)]
Don’t skip pat_re_eval.t under miniperl
re.pm no longer loads the compiled C code under miniperl, and this
test does not use any features that re.xs provides; so the skip
is unnecessary.
Father Chrysostomos [Sun, 24 Nov 2013 23:55:18 +0000 (15:55 -0800)]
Fix bug with (??{$overload}) regexp caching
When a scalar is returned from (??{...}) inside a regexp, it get com-
piled into a regexp if it is not one already. Then the regexp is sup-
posed to be cached on that scalar (in magic), so that the same scalar
returned again will not require another compilation.
This has never worked correctly with references, because the value was
being cached against the returned scalar itself, whereas the *refer-
ent* of a returned reference was being checked for qr magic.
Commit
e4bfbed39b disabled caching for all scalars except references
to overloaded objects. This is the result of copy the return value
to a new mortal scalar. The actual returned scalar then remains
untouched.
So the only case in which the cache value was used was incorrect:
namely, when the regexp was cached against a reference to an over-
loaded object, and a later code block returned a reference to that
reference:
$\="\n";
{ package o; use overload '""'=>sub { "abc" } }
$x = bless [],"o";
$y = \$x;
($y_addr = "$y") =~ y/()//d; # REF(0x7fcb9c02ef08) -> REF0x7fcb9c02ef08
print "$x$y";
print "abc$y_addr" =~ /$x$y/;
print "abc$y_addr" =~ /(??{$x})(??{$y})/; # does not match; should
print "abcabc" =~ /(??{$x})(??{$y})/; # matches!
print "__END__";
__END__
Output:
abcREF(0x7ff37182ef68)
0x7ff37182ef68
1
__END__
Should be:
abcREF(0x7ff37182ef68)
0x7ff37182ef68
1
__END__
This commit corrects the logic that checks for cached qr magic, effec-
tively disabling the cache altogether.
A forthcoming commit will reënable it (if all goes as planned).
Father Chrysostomos [Sun, 24 Nov 2013 05:31:24 +0000 (21:31 -0800)]
->$#*
David Mitchell [Sun, 24 Nov 2013 19:58:26 +0000 (19:58 +0000)]
fix Gconvert 'ignoring return value' warnings
On some systems, Gconvert() is #deffed to gcvt(), and on linux,
that function has a mandatory return value, so you get lots of
'ignoring return value' warnings. So define a V_Gconvert()
macro that does Gconvert() in a void context. Ideally this macro
would be part of the original definition of Gconvert() in config.sh,
but since Gconvert() is only used in sv.c, it was easier to
to just define V_Gconvert() locally there.
David Mitchell [Sun, 24 Nov 2013 19:44:41 +0000 (19:44 +0000)]
fix 'ignoring return value' compiler warnings
Various system functions like write() are marked with the
__warn_unused_result__ attribute, which causes an 'ignoring return value'
warning to be emitted, even if the function call result is cast to (void).
The generic solution seems to be
int rc = write(...);
PERL_UNUSED_VAR(rc);
David Mitchell [Sun, 24 Nov 2013 14:44:40 +0000 (14:44 +0000)]
XS::APItest: remove unused var
(see Message-ID: <
20131121221646.GB21945@fysh.org>)
Yves Orton [Sun, 24 Nov 2013 16:57:33 +0000 (17:57 +0100)]
better diagnostics of RExC_seen in regcomp.c
Yves Orton [Sun, 24 Nov 2013 15:24:16 +0000 (16:24 +0100)]
Avoid pointer churn in study_chunk recursion bitmap allocation
Since we can only recurse into a given paren (or the entire pattern)
once, we know that the maximum recursion depth is the number of parens
in the pattern (plus one for "whole pattern"). This means we can
preallocate one large bitmap, and then use different chunks of it
for each level. That avoids SAVEFREEPV costs for each bitmap, which
are likely short anyway. (One could imagine an optimization where a
flag somewhere lets us use the RExC_study_chunk_recursed pointer
as a bitmap, so we dont have to allocate all when we have less than
32 parens.)
This removes the "recursed" argument from study_chunk() and replaces
it with a "recursive_depth" argument which counts how deep we
are in the bitmap "stack".
Father Chrysostomos [Sun, 24 Nov 2013 06:37:30 +0000 (22:37 -0800)]
regexec.c: Remove redundant S_regcp_restore call
made redundant by
e4bfbed3.
Father Chrysostomos [Sun, 24 Nov 2013 06:36:26 +0000 (22:36 -0800)]
Test line number for (??{$str}) regexp warnings
If the (??{}) does not occur on the same line as the match operator
(e.g., if we have /foo$qr/ and $qr has (??{}) in it), we need to
make sure warnings that occur when the return value of (??{}) is
compiled use the same line number as the /.../, since conceptually
it is part of matching, not part of returning.
I tried breaking this and making the line number wrong, but all
tests passed, showing that it is untested. Most regcomp tests are in
t/re/reg_mesg.t, but that file does not have infrastructure for check-
ing line numbers.
Yves Orton [Sun, 24 Nov 2013 12:07:20 +0000 (13:07 +0100)]
First steps to resolving RT #120618, better fix for RT #120600
Commit
099ec7dcf9e085a650e6d9010c12ad9649209bf4 tried to fix RT #120618,
however it resulted in RT #120600:
[perl #120618] Bleadperl v5.19.6-15-g099ec7d breaks ABIGAIL/Regexp-Common-
2013031301.tar.gz
Which includes breakage to:
MAUKE/Function-Parameters-1.0401.tar.gz
ABIGAIL/Regexp-Common-
2013031301.tar.gz
DCONWAY/Regexp-Grammars-1.033.tar.gz
AMBS/Text/Text-RewriteRules-0.25.tar.gz
To put it bluntly I didn't like the fix in
099ec7dcf9 in and it doesn't
entirely surprise me that it broke extreme modules like these.
This is a much better fix, and includes better debug output for frames
and recursion.
Both of the old strategies were flawed. The new strategy is much more
sound. Every time we recurse we create a new recursed bitmap, if
necessary copying the existing bitmap (thus treated a NULL "recursed"
pointer as an all zero bitmap). Instead of turning off the flag when
we exit, we simply "throw away" that bitmap, restoring the state of
the parent. Thus what occured in a child does not contaminate the
parent.
All of this is a bit confusing as there are two levels of recursion
at work here. First there is recursion, and pseudo-recursion in
study_chunk(), which is distinct from recursive patterns, even tho
the implementation of recursive patterns uses pseudo-recursion in
study-chunk. Anyway, to make the new bitmap pattern work I had to
extend the frame mechanism, and add diagnostics to it, which are
visible via -Mre=Debug,ALL.
I haven't tested that this fixes the modules, I just know that it
is conceptually a much better and cleaner fix.
James E Keenan [Sun, 24 Nov 2013 04:37:50 +0000 (05:37 +0100)]
Require Test::More v0.88 to use done_testing in Spec.t.
Reported in https://rt.cpan.org/Ticket/Display.html?id=87574.
Father Chrysostomos [Sun, 24 Nov 2013 00:39:38 +0000 (16:39 -0800)]
Increase $XS::Typemap::VERSION to 0.13
Father Chrysostomos [Sun, 24 Nov 2013 00:38:30 +0000 (16:38 -0800)]
Squash COWs in the char* typemap
Some XS modules expect to be able to modify strings passed in as char
pointers. Copy-on-write breaks that ability. So this commit makes
the T_PV typemap uncow mutable COWs when passing them.
const char* is now mapped to the new T_ROPV entry, to avoiding unnec-
essarily slowing it down.
Steffen Müller writes in <
52912E9C.3030403@cpan.org> that the typemap
is not dual-lifed, so it is not necessary to make this 5.16-compati-
ble. However, I had already written the patch, and I think it is good
to keep it possible to drop this typemap into a CPAN distribution.
Any self-respecting C compiler should be able to optimise away the
extra SvIsCOW(t_pv_tmp_sv) == 1 check, so there is no slowdown as a
result of compatibility.
Father Chrysostomos [Sat, 23 Nov 2013 12:43:37 +0000 (04:43 -0800)]
Increase $PerlIO::via::VERSION to 0.14
Father Chrysostomos [Sat, 23 Nov 2013 04:34:17 +0000 (20:34 -0800)]
Push a new stack in sv_recode_to_utf8
That prevents this from happening under STRESS_REALLOC:
$ ./perl -Ilib -Mencoding=johab -e '(chr(0x7f) eq "\x7f")'
Use of the encoding pragma is deprecated at -e line 0.
perl(3939) malloc: *** error for object 0x7fac20c03968: incorrect checksum for freed object - object was probably modified after being freed.
*** set a breakpoint in malloc_error_break to debug
Abort trap: 6
(That is an excerpt from t/uni/chr.t.)
It may also fix other instances of encoding.pm crashing, which I had
almost vowed not to do. Oh well.
Constant folding is generally expected not to reallocate the stack,
because it should never need to extend it, just reduce the number of
items on it.
sv_recode_to_utf8 breaks that assumption.
Nicholas Clark [Fri, 4 Oct 2013 13:33:49 +0000 (15:33 +0200)]
No need to wrap calls to Perl_load_module() in ENTER/LEAVE
As of commit
53a7735b62aee146 (May 2007) Perl_vload_module() wraps its call
to Perl_utilize() with ENTER/LEAVE, so there's no longer a need for callers
of Perl_load_module() to also wrap with ENTER/LEAVE.
Nicholas Clark [Fri, 4 Oct 2013 13:15:56 +0000 (15:15 +0200)]
Perl_load_module() no longer moves the current stack, so no need to save it.
Nicholas Clark [Fri, 4 Oct 2013 12:54:00 +0000 (14:54 +0200)]
S_process_special_blocks() should use a new stack for BEGIN blocks.
This avoids the stack moving underneath anything that directly or indirectly
calls Perl_load_module().
[Committer’s note:
This fixes bug #119993.
Furthermore, under STRESS_REALLOC, t/io/layers.t was crashing like this:
$ ./perl -Ilib -e ' open(UTF, "<:raw:encoding(utf8)", 'tmp75851B') or die $!; ref #blahblahblahblahblahblahblahblahblah'
Segmentation fault: 11
(The comment seems to be necessary to make it crash.)
It was happening because open() was causing a module to be loaded
while the arguments to open() were still on the stack.
]
Nicholas Clark [Fri, 4 Oct 2013 11:28:58 +0000 (13:28 +0200)]
Remove redundant SPAGAIN & PUTBACK after PUSHSTACKi().
PUSHSTACKi() calls SWITCHSTACK(), which sets PL_stack_sp and sp like this:
sp = PL_stack_sp = PL_stack_base + AvFILLp(t)
Hence after PUSHSTACKi() both are identical, so use of SPAGAIN or PUTBACK
to assign one to the other is redundant.
The use of SPAGAIN in encoding.xs and via.xs was added with commit
24f59afc531955e5 (April 2002) which added the use of PUSHSTACKi(). It feels
like cargo-cult.
The use of PUTBACK in Perl_amagic_call() predates the introduction of nested
stacks and PUSHSTACKi() in commit
e336de0d01f30cc4 (April 1998). It dates from
perl 5.000, but it's not clear that it was ever needed, as the code in
question looked like this, and nothing could have moved the stack between
the dSP and PUTBACK:
dSP;
BINOP myop;
SV* res;
Zero(&myop, 1, BINOP);
myop.op_last = (OP *) &myop;
myop.op_next = Nullop;
myop.op_flags = OPf_KNOW|OPf_STACKED;
ENTER;
SAVESPTR(op);
op = (OP *) &myop;
PUTBACK;
The PUTBACK and SPAGAIN in Perl_require_pv() were added by commit
d3acc0f7e5197310 (June 1998) which also added the PUSHSTACKi(). They have
both been redundant since they were added.
Father Chrysostomos [Thu, 21 Nov 2013 04:39:56 +0000 (20:39 -0800)]
Extend STRESS_REALLOC to move the stack with every EXTEND
This allows us easily to catch cases where the stack could move to a
new memory address while code still holds pointers to the old loca-
tion. Indeed, this causes test failures.
Father Chrysostomos [Thu, 21 Nov 2013 04:38:27 +0000 (20:38 -0800)]
Get perl to build under STRESS_REALLOC once more
It had been broken since v5.17.6-144-ga3444cc.
That commit added, inter alia, this comment to scope.h:
+ * Of course, doing the size check *after* pushing means we must always
+ * ensure there are SS_MAXPUSH free slots on the savestack
But STRESS_REALLOC makes the initial savestack size just 1, and
SS_MAXPUSH is 4. So ‘./miniperl -e0’ failed an assertion.
François Perrad [Sat, 23 Nov 2013 00:49:11 +0000 (01:49 +0100)]
Skip dist/ExtUtils-Install/t/InstallWithMM.t when cross-compiling.
The toolchain is not installed on the target when cross-compiling.
So, this test must be skipped, see patch below.
(same problem as RT#119769 and RT#120398)
For: RT #120615
Chris 'BinGOs' Williams [Fri, 22 Nov 2013 14:37:33 +0000 (14:37 +0000)]
Module-CoreList on CPAN is 3.01
Father Chrysostomos [Thu, 21 Nov 2013 22:43:26 +0000 (14:43 -0800)]
Remove unused var from APItest.xs
This was added at the same time as the containing function in
27fcb6ee.
It was probably due to copy and paste.
Yves Orton [Fri, 22 Nov 2013 00:08:39 +0000 (01:08 +0100)]
Fix RT #120600: Variable length lookbehind is not variable
Inside of study_chunk() we have to guard against infinite
recursion with recursive subpatterns. The existing logic
sort of worked, but didn't address all cases properly.
qr/
(?<W>a)
(?<BB>
(?=(?&W))(?<=(?&W))
)
(?&BB)
/x;
The pattern in the test would fail when the optimizer
was expanding (&BB). When it recursed, it creates a bitmap
for the recursion it performs, it then jumps back to
the BB node and then eventually does the first (&W) call.
At this point the bit for (&W) would be set in the bitmask.
When the recursion for the (&W) exited (fake exit through
the study frame logic) the bit was not /unset/. When the parser
then entered the (&W) again it was treated as a nested and
potentially infinite length pattern.
The fake-recursion in study-chunk made it little less obvious
what was going on in the debug output.
By reorganizing the code and adding logic to unset the bitmap
when exiting this bug was fixed. Unfortunately this also revealed
another little issue with patterns like this:
qr/x|(?0)/
qr/(x|(?1))/
which forced the creation of a new bitmask for each branch.
Effectively study_chunk treats each branch as an independent
pattern, so when we are expanding (?1) via the 'x' branch
we dont want that to prevent us from detecting the infinite recursion
in the (?1) branch. If you were to think of trips through study_chunk
as paths, and [] as recursive processing you would get something like:
BRANCH 'x' END
BRANCH (?0) [ 'x' END ]
BRANCH (?0) [ (?0) [ 'x' END ] ]
...
When we want something like:
BRANCH 'x' END
BRANCH (?0) [ 'x' END ]
BRANCH (?0) [ (?0) INFINITE_RECURSION ]
So when we deal with a branch we need to make a new recursion bitmask.
David Mitchell [Thu, 21 Nov 2013 17:11:40 +0000 (17:11 +0000)]
APItest.xs: fix various compiler warnings
David Mitchell [Thu, 21 Nov 2013 17:10:04 +0000 (17:10 +0000)]
toLOWER_LC(), toUPPER_LC(): fix signedness
The are documented to return UV, but in one definition they return
tolower()/toupper(), which on Linux return a signed value. So
cast away the compiler warnings.
David Mitchell [Thu, 21 Nov 2013 16:21:38 +0000 (16:21 +0000)]
Storable: silence compiler 'unused func' warnings
Two static functions are only used within asserts, so only define them
if asserts are enabled
David Mitchell [Thu, 21 Nov 2013 16:15:24 +0000 (16:15 +0000)]
Storable: silence some unused var warnings
David Mitchell [Thu, 21 Nov 2013 15:53:41 +0000 (15:53 +0000)]
Storable: crash on ref to blessed tied array
When Storable was retrieving a tied array, if that array needed blessing
into a class, the code was passing the name of the class, rather than the
HV of the stash, to sv_bless(), causing a crash.
(Discovered due to a gcc "var set but not used" warning).
I also updated a few source code comments with s/SX_FOO/SX_TIED_FOO/.
David Mitchell [Thu, 21 Nov 2013 11:15:43 +0000 (11:15 +0000)]
Storable: add SEEN0 macro
to shut up a compiler warning.
The SEEN(y,stash,i) macro expands to something like
...;
if (stash)
foo_NN(stash);
where foo_NN is a function that expects a non-null arg.
SEEN() is sometimes called as SEEN(sv,0,0) which of course expands to
if (0)
foo_NN(0);
which under gcc at least, emits the 'non-null' warning before the entire
block of code is optimised away.
So add a SEEN0() macro which handles the stash=0 case.
Father Chrysostomos [Thu, 21 Nov 2013 13:54:26 +0000 (05:54 -0800)]
regen pod issues
Chris 'BinGOs' Williams [Thu, 21 Nov 2013 12:34:20 +0000 (12:34 +0000)]
Update Win32 to CPAN version 0.48
[DELTA]
0.48 [2013-11-20]
- Typo fixes by David Steinbrunner.
- Fix required perl version 5.6 -> 5.006.
- Don't call note() in t/GetOSName.t when it has not been
imported from Test::More.
- Convert t/GetOSName.t to Unix line endings like the rest of
this repo.
Chris 'BinGOs' Williams [Wed, 20 Nov 2013 21:52:25 +0000 (21:52 +0000)]
New perldelta for v5.19.7
Chris 'BinGOs' Williams [Wed, 20 Nov 2013 21:29:47 +0000 (21:29 +0000)]
Module-CoreList prepared for v5.19.7
Chris 'BinGOs' Williams [Wed, 20 Nov 2013 21:18:14 +0000 (21:18 +0000)]
Bump the perl version in various places for v5.19.7
Chris 'BinGOs' Williams [Wed, 20 Nov 2013 20:59:13 +0000 (20:59 +0000)]
Epigraph for v5.19.6
Chris 'BinGOs' Williams [Wed, 20 Nov 2013 20:51:29 +0000 (20:51 +0000)]
Merge branch 'bingos/perl-5.19.6' into blead
Father Chrysostomos [Wed, 20 Nov 2013 14:03:09 +0000 (06:03 -0800)]
t/op/sub.t: Suppress warnings properly
We enable lexical warnings further up in the file, so $^W won’t do
anything to suppress the warnings from the glob assignment, only
those from XSLoader.
Chris 'BinGOs' Williams [Wed, 20 Nov 2013 14:53:31 +0000 (14:53 +0000)]
Add new release to perlhist
Chris 'BinGOs' Williams [Wed, 20 Nov 2013 14:35:59 +0000 (14:35 +0000)]
Finalise perldelta
Chris 'BinGOs' Williams [Wed, 20 Nov 2013 14:32:12 +0000 (14:32 +0000)]
Update Module-CoreList for v5.19.6
Chris 'BinGOs' Williams [Wed, 20 Nov 2013 12:48:25 +0000 (12:48 +0000)]
Release engineering work on perldelta
Daniel Dragan [Tue, 19 Nov 2013 21:25:51 +0000 (16:25 -0500)]
add Intel C++ Compiler for Win32 support
-most fixes involve code detecting Perl on VC, and changing it to ICC
is another kind of VC, but ICC's version isn't this "other kind of VC"'s
version number, call the partner VC to find out the "VC version number"
of ICC
not yet done
-no Intel C specific optimization flags
-long doubles and C99
-ccversion behavior might not be ideal/rethink
Tony Cook [Wed, 20 Nov 2013 04:11:15 +0000 (15:11 +1100)]
[perl #120043] fix some warnings
with an update for perldiag
Tony Cook [Wed, 20 Nov 2013 04:09:44 +0000 (15:09 +1100)]
update perldiag for the change in conversion specifiers
Lukas Mai [Sat, 28 Sep 2013 22:12:44 +0000 (00:12 +0200)]
fix a few warnings (format strings, unused variable)
During compilation gcc complains about the following:
perl.c:4970: warning: format '%u' expects argument of type 'unsigned int', but argument 2 has type 'U32' [-Wformat=]
perl.c:5075: warning: format '%u' expects argument of type 'unsigned int', but argument 2 has type 'I32' [-Wformat=]
mg.c:1972: warning: format '%ld' expects argument of type 'long int', but argument 2 has type 'ssize_t' [-Wformat=]
pp_ctl.c:2610: warning: unused variable 'mark' [-Wunused-variable]
regexec.c:2275: warning: format '%ld' expects argument of type 'long int', but argument 3 has type 'int' [-Wformat=]
This patch fixes all of them.
Tony: warning: unused variable 'mark' was fixed in
481c819b
Daniel Dragan [Wed, 13 Nov 2013 04:07:16 +0000 (23:07 -0500)]
remove PL_patchlevel from S_minus_v
|SvPVX(vstringify(PL_patchlevel))| is the same string as
|"v" PERL_VERSION_STRING|. No need to go through the overhead of using a
version object. Instead of creating a SV, then further manipulating it.
Create and manipulate it at the same time with Perl_newSVpvf_nocontext or
newSVpvn. "num_len >= level_len " will be folded away by the compiler,
previously, since both lengths came from SVs, they were not const
technically. A very smart compiler might see strncmp/strnEQ takes all
const arguments, and will optimize that away also. VC 2003 didnt do that.
Change SvREFCNT_dec to SvREFCNT_dec_NN for obvious reasons.
There should not be any user visible changes to -v with this patch.
switches.t contains a regexp for -v already so no further tests were added.
This patch is part of #116296.
Daniel Dragan [Tue, 19 Nov 2013 01:10:04 +0000 (20:10 -0500)]
regcomp.c extern -> EXTERN_C
Otherwise re wont build on Win32 VC6 C++ mode.
Daniel Dragan [Tue, 19 Nov 2013 04:26:05 +0000 (23:26 -0500)]
ioctl on perlhost platforms take a char*, not void*
As of commit
0cb9638729 IOCtl from perlhost is prototyped to take a char *.
In the later commit
2986a63f7e5 the netware commit is introduced that adds
a void* cast without explination, but today PerlLIOIOCtl is prototyped as
char* in nwperlhost.h (nwperlhost.h didnt exist at
2986a63f7e5 ). In
commit
6e22d04617 Win32 starts to use the void * cast from netware.
Using a void * cast breaks a VC 2003 C++ mode build of IO.xs because of
different types. Switch to a char * cast that matches the vtable prototype.
Daniel Dragan [Tue, 19 Nov 2013 20:37:58 +0000 (15:37 -0500)]
better perldelta description for #120091/#118059
Father Chrysostomos [Tue, 19 Nov 2013 05:53:43 +0000 (21:53 -0800)]
Move <-- HERE arrow for ‘Switch condition not recognized’
$ ./perl -Ilib -e '/(?(1(?#...)))/'
Switch condition not recognized in regex; marked by <-- HERE in m/(?(1( <-- HERE ?#...)))/ at -e line 1.
$ ./perl -Ilib -e '/(?(1x(?#...)))/'
Switch condition not recognized in regex; marked by <-- HERE in m/(?(1x(?#...) <-- HERE ))/ at -e line 1.
With the first one-liner, the arrow in the error message is pointing
to the first offending character.
With the second one-liner, the arrow points to the comment following
the offending character.
The logic for positioning the character is a little odd. The idea is
supposed to be something like:
if current_character++ is not ')'
croak with the arrow right before current_character
But nextchar() is used instead of ++, and nextchar() skips trailing
whitespace and comments after incrementing the current parse position.
We already have code right here to revert back to the previous parse
position and then increment it by one character, for the sake of UTF8.
Indeed, it behaves differently if you add a non-ASCII character under
‘use utf8’:
$ ./perl -Ilib -e 'use utf8; /é(?(1x(?#...)))/'
Switch condition not recognized in regex; marked by <-- HERE in m/?(?(1x <-- HERE (?#...)))/ at -e line 1.
So what this commit does is extend that backtrack logic to happen all
the time, not just with UTF8.
Father Chrysostomos [Tue, 19 Nov 2013 05:30:45 +0000 (21:30 -0800)]
perldiag: Update descr for ‘Switch condition not recognized’
Originally, the message ‘Switch (?(number%c not recognized’ only
applied to /(?(1junk))/. perl-5.6.0-657-gb45f050 changed it to read
‘Switch condition not recognized’.
perl-5.8.0-8771-g0a4db38 added (?(<...>)), (?('...')), (?(DEFINE)) and
(?(R...)). All of these can trigger that messages if there is junk
before the first closing parenthesis (e.g., /(?(<name>junk))/, causing
a mismatch between the cases where the error occurs and the descrip-
tion in perldiag:
(F) If the argument to the (?(...)if-clause|else-clause) con-
struct is a number, it can be only a number. The <-- HERE shows
whereabouts in the regular expression the problem was discovered.
See perlre.
(which itself was already confusingly worded).
Whether these should be changed to use the more standard ‘Unknown
switch condition’ message I don’t want to deal with right now.
In any case, the description is only sometimes relevant, so this com-
mit just copies the description from ‘Unknown switch condition’.
Father Chrysostomos [Tue, 19 Nov 2013 14:26:19 +0000 (14:26 +0000)]
perldelta for
7583957163
Signed-off-by: Chris 'BinGOs' Williams <chris@bingosnet.co.uk>
Chris 'BinGOs' Williams [Tue, 19 Nov 2013 13:29:25 +0000 (13:29 +0000)]
Update Module-Build to CPAN version 0.4202
[DELTA]
0.4202 - Tue Nov 19 12:48:19 CET 2013
[BUG FIXES]
- Don't merge prereqs from meta to mymeta [Leon Timmermans]
Steve Hay [Tue, 19 Nov 2013 12:21:56 +0000 (12:21 +0000)]
Tony Cook [Tue, 19 Nov 2013 05:45:13 +0000 (16:45 +1100)]
S_already_defined no longer uses its gv parameter, remove it
Tony Cook [Tue, 19 Nov 2013 05:01:29 +0000 (16:01 +1100)]
Matthew Horsfall (alh) [Tue, 8 Oct 2013 16:56:08 +0000 (12:56 -0400)]
Optimise 'if ($a || $b)' and 'unless ($a && $b)' early exit
An OP_AND/OP_OR in void context provides a short circuit
through ->op_other that can be used if AND/OR ops contained
within it jump out early. Use that short circuit.
Previously:
$ ./perl -Ilib -MO=Concise -e 'if ($aa || $bb) {}'
8 <@> leave[1 ref] vKP/REFC ->(end)
1 <0> enter ->2
2 <;> nextstate(main 3 -e:1) v:{ ->3
- <1> null vK/1 ->8
6 <|> and(other->7) vK/1 ->8
- <1> null sK/1 ->6
4 <|> or(other->5) sK/1 ->6 <-- Not optimised
- <1> ex-rv2sv sK/1 ->4
3 <$> gvsv(*aa) s ->4
- <1> ex-rv2sv sK/1 ->-
5 <$> gvsv(*bb) s ->6
- <@> scope vK ->-
7 <0> stub v ->8
Now:
$ ./perl -Ilib -MO=Concise -e 'if ($aa || $bb) {}'
8 <@> leave[1 ref] vKP/REFC ->(end)
1 <0> enter ->2
2 <;> nextstate(main 3 -e:1) v:{ ->3
- <1> null vK/1 ->8
6 <|> and(other->7) vK/1 ->8
- <1> null sK/1 ->6
4 <|> or(other->5) sK/1 ->7 <-- Short circuited
- <1> ex-rv2sv sK/1 ->4
3 <$> gvsv(*aa) s ->4
- <1> ex-rv2sv sK/1 ->-
5 <$> gvsv(*bb) s ->6
- <@> scope vK ->-
7 <0> stub v ->8
Chris 'BinGOs' Williams [Tue, 19 Nov 2013 00:13:41 +0000 (00:13 +0000)]
Update Module-Build to CPAN version 0.4201
[DELTA]
0.4201 - Mon Nov 18 23:23:25 CET 2013
[BUG FIXES]
- Prefer META.json over META.yml [Leon Timmermans]
Victor Efimov [Tue, 19 Nov 2013 00:18:26 +0000 (01:18 +0100)]
Check symlink status before setting File::Find::fullname to undef.
Problem reported by James Avera in RT #120388. Patches supplied by Victor
Efimov, then adapted to new testing functions in ext/File-Find/t/find.t.
Tony Cook [Mon, 18 Nov 2013 22:50:25 +0000 (09:50 +1100)]
[perl #120543] work around a C++ library bug in VC 2003
VC 2003 makes overloaded versions of ldexp() available when including
<math.h> which should only be visible when including <cmath>.
The cast ensures the ldexp(double, int) signature is used.
Chris 'BinGOs' Williams [Mon, 18 Nov 2013 19:16:26 +0000 (19:16 +0000)]
Update HTTP-Tiny to CPAN version 0.038
[DELTA]
0.038 2013-11-18 12:56:26 America/New_York
[FIXED]
- Fixed a bug where authentication parameters in the URL would override
an existing Authorization header
David Mitchell [Mon, 18 Nov 2013 16:48:48 +0000 (16:48 +0000)]
XS::Typemap: silence compiler warning.
xsubpp will give us a RETVAL var whether we use it not.
David Mitchell [Mon, 18 Nov 2013 15:41:45 +0000 (15:41 +0000)]
threads: silence some compiler warnings.
From 5.8.9, the MGVTBL struct has a 'svt_local' member
Declare some vars volatile within a function that uses jongjmp
Mark the unused return value from PerlLIO_write() as void(), even
though it won't shut up gcc.
David Mitchell [Mon, 18 Nov 2013 15:24:04 +0000 (15:24 +0000)]
POSIX: silence some compiler warnings
David Mitchell [Mon, 18 Nov 2013 15:07:23 +0000 (15:07 +0000)]
SDBM_File: fix 'set but not used' warning
the NEXTKEY() method has a key arg, but sdbm_nextkey() doesn't.
So don't bother mapping the key SV arg to a datum_key type.
David Mitchell [Mon, 18 Nov 2013 14:52:57 +0000 (14:52 +0000)]
PerlIO::via: fix compiler warning
In
GV *gv = newGVgen(HvNAME_get(s->stash))
HvNAME_get() can return a null value (don't know whether it ever will in
these circumstances), while newGVgen() expects a non-null arg.
So calculate HvNAME_get() first, and bail if it's null.
David Mitchell [Mon, 18 Nov 2013 14:37:22 +0000 (14:37 +0000)]
PerlIO::scalar: silence some compiler warnings
Father Chrysostomos [Mon, 18 Nov 2013 14:19:33 +0000 (06:19 -0800)]
perlhacktips: Two spaces after dots
It was not consistent throughout.
Father Chrysostomos [Mon, 18 Nov 2013 14:12:03 +0000 (06:12 -0800)]
perlhacktips: Fix pod formatting
Matthew Horsfall (alh) [Mon, 30 Sep 2013 17:23:22 +0000 (13:23 -0400)]
Add more examples of perl/gdb usage.
Also add doc about gdb's ptype, and make examples more clear.
Father Chrysostomos [Mon, 18 Nov 2013 14:01:56 +0000 (06:01 -0800)]
Fix ‘panic: memory wrap’ in reg_scan_name
reg_scan_name was not checking for end-of-string. If the character it
read were not a word character, it would then increment the current
position (RExC_parse), so that the <-- HERE marker in the error mes-
sage would point to the bad character.
If we try to split a regexp like /(?</ into two pieces when the cur-
rent position is off the end like this:
( ? < \0
^
then the first ‘half’ of the regexp, before the <-- HERE marker is
"(?<\0" (including the trailing null), and the second ‘half’ is of
negative length. Negative string lengths are what cause ‘panic: mem-
ory wrap’.
$ ./perl -Ilib -e '/(?</'
panic: memory wrap at -e line 1.
This commit takes advantage of the fact that, ever since
1f4f6bf1,
RExC_parse == name_start has never been true after a call to
reg_scan_name. This is how reg_scan_name now signals EOS.
Father Chrysostomos [Mon, 18 Nov 2013 13:57:50 +0000 (05:57 -0800)]
perldiag: Clarify memory wrap
Father Chrysostomos [Mon, 18 Nov 2013 13:45:19 +0000 (05:45 -0800)]
Require closing paren for (?&...
$ ./perl -Ilib -le 'print "aaz" =~ /(?<a>a)(?&a-z/'
a
(?&name) was actually allowing any non-word character to terminate it.
Chris 'BinGOs' Williams [Mon, 18 Nov 2013 15:13:01 +0000 (15:13 +0000)]
Update IPC-Cmd to CPAN version 0.90
[DELTA]
0.90 Mon Nov 18 15:08:15 GMT 2013
Misc:
* skip some problematic tests when PERL_CORE
Tony Cook [Mon, 18 Nov 2013 06:01:07 +0000 (17:01 +1100)]
Tony Cook [Mon, 18 Nov 2013 05:53:46 +0000 (16:53 +1100)]
Tony Cook [Mon, 18 Nov 2013 05:44:40 +0000 (16:44 +1100)]
[perl #120535] Add UTF8 flag to B::HV->ARRAY keys
Tony Cook [Mon, 18 Nov 2013 04:20:16 +0000 (15:20 +1100)]
un-TODO the test for 120535, Reini's patch fixes it
Reini Urban [Wed, 13 Nov 2013 19:18:09 +0000 (13:18 -0600)]
Add UTF8 flag to keys returned by B::HV->ARRAY
hv_iternextsv() ignores the HEK flags, but we do care about the UTF8 flag
at least when returning hash keys from B::HV->ARRAY
Tony Cook [Mon, 18 Nov 2013 04:16:31 +0000 (15:16 +1100)]
TODO test for 120535
Tony Cook [Mon, 18 Nov 2013 00:00:17 +0000 (11:00 +1100)]
fix expected failure text for new croak.t test
Father Chrysostomos [Sun, 17 Nov 2013 21:09:26 +0000 (13:09 -0800)]
[Merge] perldiag stuff
I noticed that some entries in perldiag had (F ...) with warnings
categories. Those categories apply only to warnings, not to
fatal errors.
So I looked to see why diag.t was not already catching it, since I
thought I had programmed it to.
It turned out that it was skipping any function calls that lacked
aTHX_, which included yyerror and anything with _nocontext.
So I fixed that and got pages and pages of failures, unsurprisingly.
I went through, fixing them, and inevitably tweaking other things.
In one case, I even changed the message output, removing an extraneous
dot before ‘at file line 24’.
Father Chrysostomos [Sun, 17 Nov 2013 19:45:33 +0000 (11:45 -0800)]
perldiag: Don’t let <-- HERE be wrapped
The meaning is much clearer if the <--
HERE marker doesn’t wrap like that.
Father Chrysostomos [Sun, 17 Nov 2013 14:44:05 +0000 (06:44 -0800)]
perldiag: Remove categories from fatal errors
These are *warnings* categories, so they don’t apply here.
Father Chrysostomos [Sun, 17 Nov 2013 14:42:45 +0000 (06:42 -0800)]
diag.t: Fix copy-and-paste error in os2 exception
Father Chrysostomos [Sun, 17 Nov 2013 14:40:14 +0000 (06:40 -0800)]
diag.t: Don’t check ‘calls’ in column 0
because they may be function declarations instead. It was getting
confused by win32_croak_not_implemented, which does not have ");"
in it before the first string.