This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perl5.git
11 years agoIn Perl_cv_forget_slab(), simplify the conditionally compiled code.
Nicholas Clark [Tue, 4 Sep 2012 09:54:06 +0000 (11:54 +0200)]
In Perl_cv_forget_slab(), simplify the conditionally compiled code.

This refactoring reduces the line count and makes it clear that the basic
logic is the same with or without -DPERL_DEBUG_READONLY_OPS. It make no
change to the generated assembler on a normal build.

11 years agoPerl_magic_setdbline() should clear and set read-only OP slabs.
Nicholas Clark [Mon, 3 Sep 2012 14:47:15 +0000 (16:47 +0200)]
Perl_magic_setdbline() should clear and set read-only OP slabs.

The debugger implements breakpoints by setting/clearing OPf_SPECIAL on
OP_DBSTATE ops. This means that it is writing to the optree at runtime,
and it falls foul of the enforced read-only OP slabs when debugging with
-DPERL_DEBUG_READONLY_OPS

Avoid this by removing static from Slab_to_rw(), and using it and Slab_to_ro()
in Perl_magic_setdbline() to temporarily make the slab re-write whilst
changing the breakpoint flag.

With this all tests pass with -DPERL_DEBUG_READONLY_OPS (on this system)

11 years agoIn op.c, change S_Slab_to_rw() from an OP * parameter to an OPSLAB *.
Nicholas Clark [Tue, 14 Aug 2012 12:24:34 +0000 (14:24 +0200)]
In op.c, change S_Slab_to_rw() from an OP * parameter to an OPSLAB *.

This makes it consistent with Perl_Slab_to_ro(), which takes an OPSLAB *.

11 years agoWith -DPERL_DEBUG_READONLY_OPS, changing a slab refcnt shouldn't make it r/w.
Nicholas Clark [Tue, 14 Aug 2012 12:10:30 +0000 (14:10 +0200)]
With -DPERL_DEBUG_READONLY_OPS, changing a slab refcnt shouldn't make it r/w.

Perl_op_refcnt_inc() and Perl_op_refcnt_dec() now both take care to leave the
slab in the same state as they found it. Previously both would
unconditionally make the slab read-write.

11 years agoUnder -DPERL_DEBUG_READONLY_OPS don't work around glibc 2.2.5 _moddi3 bugs.
Nicholas Clark [Wed, 8 Aug 2012 10:37:48 +0000 (12:37 +0200)]
Under -DPERL_DEBUG_READONLY_OPS don't work around glibc 2.2.5 _moddi3 bugs.

The work around involves a runtime check and substituting OP pointers based
on the result. The substitution fails if the optree is mapped read-only.

11 years agoMake dual-lived constant.pm work on 5.8 again
Sébastien Aperghis-Tramoni [Tue, 4 Sep 2012 05:42:26 +0000 (07:42 +0200)]
Make dual-lived constant.pm work on 5.8 again

Before releasing the version of constant.pm from bleadperl to the CPAN,
I tested it with the versions of Perl I have by hand, and it appears
that the current code fails to compile on 5.8:

  Bareword "_DOWNGRADE" not allowed while "strict subs" in use at
  lib/constant.pm line 142.

Added by bd8cb5529605f33aa9cf95d6c471386b3a0e015d

Removing the short-circuit return allows the code to compile and the
tests to pass on all stable Perl from 5.8.2 to 5.16.1.

11 years agoMake XSLoader's UPSTREAM as undef
Rafael Garcia-Suarez [Mon, 3 Sep 2012 15:39:41 +0000 (17:39 +0200)]
Make XSLoader's UPSTREAM as undef

The upstream is supposed to be "blead", but the CPAN version of
XSLoader 0.16 and the one that has shipped with perl 5.17.3 are
different (doc changes only). The problem (cmp_version.t failing)
should disappear after the next perl release.

11 years agoUpgrade to XSLoader 0.16
Sebastien Aperghis-Tramoni [Mon, 3 Sep 2012 14:36:06 +0000 (16:36 +0200)]
Upgrade to XSLoader 0.16

11 years agonewXS_len_flags() shouldn't change the line number on PL_curcop when warning.
Nicholas Clark [Mon, 13 Aug 2012 20:00:07 +0000 (22:00 +0200)]
newXS_len_flags() shouldn't change the line number on PL_curcop when warning.

This can actually generate incorrect line numbers in runtime warnings, when
XSUBs are redefined from calls made from BEGIN blocks, and the line number
from the opening brace of the begin block is mashed with the filename of the
current line. For compiletime warnings, PL_curcop == &PL_compiling, so the
line numbers will be correct whether taken from PL_compiling or PL_parser.

This code dates back to perl-5.000, when it was added to newXS(). It appears
to be a copy of code present in newSUB() since alpha 2.

11 years agoTest that the warning for "can be 0, test with defined" is for the start.
Nicholas Clark [Wed, 8 Aug 2012 20:59:19 +0000 (22:59 +0200)]
Test that the warning for "can be 0, test with defined" is for the start.

The Perl interpreter is careful to use the line number of the start of
the 'Value of %s can be "0"; test with defined()" warning, but there were no
tests for this.

11 years agoTest that the warning for "Found = in conditional" is for the start line.
Nicholas Clark [Wed, 8 Aug 2012 20:23:29 +0000 (22:23 +0200)]
Test that the warning for "Found = in conditional" is for the start line.

The Perl interpreter is careful to use the line number of the start of
the "Found = in conditional", but there were no tests for this.

11 years agoTest that the line number for a "sub redefined" warning is for the start.
Nicholas Clark [Wed, 8 Aug 2012 14:24:57 +0000 (16:24 +0200)]
Test that the line number for a "sub redefined" warning is for the start.

The Perl interpreter is careful to use the line number of the start of a
subroutine's redefinition for the warning, but there were no tests for this.

11 years agoAdd Karen Etheridge to AUTHORS.
Craig A. Berry [Sat, 1 Sep 2012 22:56:41 +0000 (17:56 -0500)]
Add Karen Etheridge to AUTHORS.

11 years agoRT#114312: prevent ls from colourizing output
Karen Etheridge [Sat, 1 Sep 2012 17:26:37 +0000 (10:26 -0700)]
RT#114312: prevent ls from colourizing output

ANSI colour codes in the `ls -l /dev` output was preventing some substitutions
from matching, causing a subsequent test to fail when 'stdout' or 'stderr' was
not properly removed from $DEV.

11 years agoperldelta for 94814ff57e and 5e56f3f11f
Steve Hay [Fri, 31 Aug 2012 20:25:29 +0000 (21:25 +0100)]
perldelta for 94814ff57e and 5e56f3f11f

11 years agoUpgrade DB_File to 1.827
Steve Hay [Fri, 31 Aug 2012 20:24:02 +0000 (21:24 +0100)]
Upgrade DB_File to 1.827

11 years agoFix skip_without_dynamic_extension to just skip
Jerry D. Hedden [Fri, 31 Aug 2012 20:36:00 +0000 (16:36 -0400)]
Fix skip_without_dynamic_extension to just skip

skip_without_dynamic_extension() mistakenly ends with skip_all()
instead of skip().

11 years agoRevert "toke.c: PL_in_eval purge"
Father Chrysostomos [Fri, 31 Aug 2012 16:52:53 +0000 (09:52 -0700)]
Revert "toke.c: PL_in_eval purge"

This reverts commit 5c49e90fd624f3ab1cdb1f1d8e4f0525d7881b99.

This change broke line numbers under mad when the last statement in the main program lacks a semicolon.

I was mistaken in thinking that PL_rsfp would always be true when
PL_in_eval is false.

But the use of PL_in_eval is still wrong.  Under a mad build, we get
this inconsistency in line numbers:

$ perl -e 'print "\n-e undef\n"' > foo
$ ./miniperl foo
Use of uninitialized value in -e at foo line 2.
$ ./miniperl -we 'require "foo"'
Use of uninitialized value in -e at foo line 3.
foo did not return a true value at -e line 1.

11 years agotest.pl:run_multiple_progs: Document cmdline switches
Father Chrysostomos [Fri, 31 Aug 2012 16:40:40 +0000 (09:40 -0700)]
test.pl:run_multiple_progs: Document cmdline switches

11 years agos/${foo#}//e should be an error
Father Chrysostomos [Fri, 31 Aug 2012 16:29:21 +0000 (09:29 -0700)]
s/${foo#}//e should be an error

See also the previous commit.

This one was caused by 9c74ccc.

Again, we can’t just check whether PL_lex_repl has the SvEVALED
flag set (which means we are in s///e), but must also check whether
PL_lex_repl == PL_linestr (which means we are in the replacement part
of s///e).

11 years agoCommit 6b00f562ed broke s/${\%x}{3}//e
Father Chrysostomos [Fri, 31 Aug 2012 16:27:25 +0000 (09:27 -0700)]
Commit 6b00f562ed broke s/${\%x}{3}//e

It was meant to check whether it was inside the replacement part of
s///e, but it only checked that it was inside s///e.  PL_lex_repl is
set on both sides, but is only equal to PL_linestr on the rhs.

11 years agoBump Locale-Codes from 3.22 to 3.23
Sullivan Beck [Tue, 28 Aug 2012 19:18:59 +0000 (15:18 -0400)]
Bump Locale-Codes from 3.22 to 3.23

11 years agoMake new File::Copy test case insensitive.
Craig A. Berry [Fri, 31 Aug 2012 16:21:58 +0000 (11:21 -0500)]
Make new File::Copy test case insensitive.

On VMS with default setttings, the filename is reported as copy.t,
not Copy.t, so make the regex allow that.

11 years agoFiles ending in .eg are also non-pod.
Craig A. Berry [Fri, 31 Aug 2012 12:47:07 +0000 (07:47 -0500)]
Files ending in .eg are also non-pod.

11 years ago[perl #114498] Document (0)[1,2] better
Aristotle Pagaltzis [Fri, 31 Aug 2012 15:45:37 +0000 (08:45 -0700)]
[perl #114498] Document (0)[1,2] better

11 years agocorrect -Dmad skip count for tests introduced in 2d85e411 and 4dc843bc
Tony Cook [Fri, 31 Aug 2012 12:41:47 +0000 (22:41 +1000)]
correct -Dmad skip count for tests introduced in 2d85e411 and 4dc843bc

11 years agoRemove the VM/ESA port.
Nicholas Clark [Thu, 30 Aug 2012 16:25:53 +0000 (18:25 +0200)]
Remove the VM/ESA port.

VM/ESA was a mainframe OS. IBM ended service on it in June 2003. It was
superseded by Z/VM.

11 years agoSilence ParseXS warning about abusing the CODE section
Steffen Mueller [Mon, 13 Aug 2012 08:29:39 +0000 (10:29 +0200)]
Silence ParseXS warning about abusing the CODE section

See RT #114198. DynaLoader was warning about somewhat dubious use of
RETVAL with a CODE section but without an OUTPUT section. This fixes
that problem, but I have obviously not been able to test on all affected
operating systems.

11 years ago[perl #112776] avoid warning on an initialized non-parameter
Tony Cook [Thu, 30 Aug 2012 14:43:19 +0000 (00:43 +1000)]
[perl #112776] avoid warning on an initialized non-parameter

A initialized non-parameter in the parameter block would warn
when $^W was set, and Module::Build sets $^W.

11 years ago[perl #112776] TODO test for warning
Tony Cook [Fri, 31 Aug 2012 10:07:58 +0000 (20:07 +1000)]
[perl #112776] TODO test for warning

11 years agoStop calling get-magic twice in sprintf "%.1s", $utf8
Father Chrysostomos [Fri, 31 Aug 2012 06:27:43 +0000 (23:27 -0700)]
Stop calling get-magic twice in sprintf "%.1s", $utf8

11 years agoStop calling get-magic twice in sprintf "%1s", $utf8
Father Chrysostomos [Fri, 31 Aug 2012 06:19:56 +0000 (23:19 -0700)]
Stop calling get-magic twice in sprintf "%1s", $utf8

11 years agoStop calling get-magic twice in pack "u", $utf8
Father Chrysostomos [Fri, 31 Aug 2012 06:06:14 +0000 (23:06 -0700)]
Stop calling get-magic twice in pack "u", $utf8

11 years agoStop calling get-magic twice when reading lvalue substr($utf8)
Father Chrysostomos [Fri, 31 Aug 2012 05:34:38 +0000 (22:34 -0700)]
Stop calling get-magic twice when reading lvalue substr($utf8)

11 years agoStop calling get-magic twice when reading lvalue substr($utf8)
Father Chrysostomos [Fri, 31 Aug 2012 05:30:26 +0000 (22:30 -0700)]
Stop calling get-magic twice when reading lvalue substr($utf8)

11 years agoStop calling get-magic twice for lvalue pos($utf8)
Father Chrysostomos [Fri, 31 Aug 2012 05:26:33 +0000 (22:26 -0700)]
Stop calling get-magic twice for lvalue pos($utf8)

11 years agoStop substr($utf8) from calling get-magic twice
Father Chrysostomos [Fri, 31 Aug 2012 05:08:43 +0000 (22:08 -0700)]
Stop substr($utf8) from calling get-magic twice

By calling get-magic twice, it could cause its string buffer to be
reallocated, resulting in incorrect and random return values.

11 years ago[perl #114410] Reset utf8 pos cache on get
Father Chrysostomos [Fri, 31 Aug 2012 01:01:27 +0000 (18:01 -0700)]
[perl #114410] Reset utf8 pos cache on get

If a scalar is gmagical, then the string buffer could change without
the utf8 pos cache being updated.

So it should respond to get-magic, not just set-magic.  Actually add-
ing get-magic to the utf8 magic vtable would cause all scalars with
this magic to be flagged gmagical.  Instead, in magic_get, we can call
magic_setutf8.

11 years agoutf8cache.t: Skip only the XS-dependent test
Father Chrysostomos [Thu, 30 Aug 2012 23:42:30 +0000 (16:42 -0700)]
utf8cache.t: Skip only the XS-dependent test

11 years agotest.pl: Add skip_without_dynamic_extension
Father Chrysostomos [Thu, 30 Aug 2012 23:40:48 +0000 (16:40 -0700)]
test.pl: Add skip_without_dynamic_extension

11 years agoBreak s//3}->{3/e
Father Chrysostomos [Thu, 30 Aug 2012 23:09:58 +0000 (16:09 -0700)]
Break s//3}->{3/e

This should never have worked:

%_=(_,"Just another ");
$_="Perl hacker,\n";
s//_}->{_/e;print

11 years agoFix two minor s//.../e parsing bugs
Father Chrysostomos [Thu, 30 Aug 2012 22:57:18 +0000 (15:57 -0700)]
Fix two minor s//.../e parsing bugs

It may be an odd place to allow comments, but s//"" # hello/e has\
always worked, *unless* there happens to be a null before the first #.

scan_subst in toke.c wraps the replacement text in do { ... } when the
/e flag is present.

It was adding a line break before the final } if the replacement text
contained #, because otherwise the } would be commented out.

But to find the # it was using strchr, which stops at the first null.
So eval "s//'\0'#/e" would fail.

It makes little sense to me to check whether the replacement contains
# before adding the line break.  It would be faster just to add the
line break without checking.

But then I discovered this bug:

s//"#" . <<END/e;
foo
END
__END__
Can't find string terminator "END" anywhere before EOF at - line 1.

So now I have two bugs to fix.

The easiest solution seems to be to omit the line break and make the
comment parser skip the } at the end of a s///e replacement.

11 years agotoke.c: PL_in_eval purge
Father Chrysostomos [Thu, 30 Aug 2012 20:34:14 +0000 (13:34 -0700)]
toke.c: PL_in_eval purge

Many uses of PL_in_eval in toke.c are redundant.

PL_in_eval indicates not that we are parsing a string eval, but that
we are being called from an eval, whether stringy on not.  Even if
PL_in_eval were only for string eval, it would still not indicate that
we are parsing a string eval, because of eval 'require'.

This commit removes redundant uses of it (making things theoretically
slightly faster).

11 years agotoke.c:scan_heredoc: comments, comments
Father Chrysostomos [Thu, 30 Aug 2012 05:35:27 +0000 (22:35 -0700)]
toke.c:scan_heredoc: comments, comments

11 years agotoke.c:scan_heredoc: Merge similar code
Father Chrysostomos [Thu, 30 Aug 2012 05:07:18 +0000 (22:07 -0700)]
toke.c:scan_heredoc: Merge similar code

The code for looking in outer lexing scopes was mostly identical to
the code for looking in PL_linestr.

11 years agotoke.c:scan_heredoc: Remove incorrect part of comment
Father Chrysostomos [Thu, 30 Aug 2012 03:43:05 +0000 (20:43 -0700)]
toke.c:scan_heredoc: Remove incorrect part of comment

I missed this in 60f40a3895 when I stopped abusing IVX and NVX.

11 years agotoke.c:scan_heredoc: Merge two adjacent #ifdefs
Father Chrysostomos [Thu, 30 Aug 2012 03:41:09 +0000 (20:41 -0700)]
toke.c:scan_heredoc: Merge two adjacent #ifdefs

11 years agotoke.c:scan_heredoc: Remove unnecessary assignment
Father Chrysostomos [Thu, 30 Aug 2012 03:39:55 +0000 (20:39 -0700)]
toke.c:scan_heredoc: Remove unnecessary assignment

Updating PL_bufend after lex_next_chunk is not necessary, as
lex_next_chunk itself does it.

11 years agotoke.c:scan_heredoc: less pointer fiddling; one less SV
Father Chrysostomos [Thu, 30 Aug 2012 03:37:44 +0000 (20:37 -0700)]
toke.c:scan_heredoc: less pointer fiddling; one less SV

The loop for reading lines of input to find the end of a here-doc has
always checked to see whether the cursor (s) was at the end of the
current buffer:

    while (s >= PL_bufend) { /* multiple line string? */

(Actually, when it was added in perl 3.000, it was in scanstr and
that loop was not specific to here-docs, but also applied to multi-
line strings.)

The code inside the loop ends up fiddling with s by setting it explic-
itly to the end of the buffer or the end of the here-doc marker, minus
one to make sure it does not coincide with the end of the buffer.

This doesn’t make any sense, and it makes the rest of this function
more complicated.

Because the loop used to be outside the else block, it was also
reached for a here-doc inside a string eval, but the code for that
ensured the condition for the while loop was never true.

Since the while loop set s to one less than it needed to be set to,
in order to break out of it, it had to have s++ just after the loop.
That s++ was reached also by the eval code, which, consequently, had
to adjust its value of s.

That adjustment actually took place farther up in the function, where
the herewas SV was assigned to.  (herewas contains the text after the
here-doc marker to the end of the line.)  The beginning of herewas
would point to the last character of the here-doc marker inside an
eval, so that subtracting SvCUR(herewas) from the buffer end would
result in an adjusted pointer.

herewas is currently not actually used, except for the length.  Until
recently, the text inside it would be copied back into PL_linestr to
recreate where the lexer needed to continue (because PL_linestr was
being clobbered).  That no longer happens.

So we can get rid of herewas altogether.  Since it is in an else
block, the stream-based parser does not need to fiddle pointers to
exit the loop.  It can just break explicitly.  So the s++ can also
go, requiring changes (and simplifications) to the eval code.  The
comment about it being a multiline string is irrelevant and can go,
too.  It dates from when that line was actually in scanstr and applied
to quoted strings containing line breaks.

11 years agotoke.c:S_scan_heredoc: put the croaking code in one spot
Father Chrysostomos [Thu, 30 Aug 2012 00:58:33 +0000 (17:58 -0700)]
toke.c:S_scan_heredoc: put the croaking code in one spot

11 years agoMake eval "s//<<END/e" slightly faster
Father Chrysostomos [Wed, 29 Aug 2012 20:10:01 +0000 (13:10 -0700)]
Make eval "s//<<END/e" slightly faster

The code that peeks into an outer linestr buffer to find the heredoc
body has to modify that buffer and remove the heredoc body from it.

It copies the text after the quote-like operator up to the end of the
line into a new SV, concatenates the text after the heredoc body into
a new SV, and then copies it back to linestr right after the quote-
like operator.

So, in this example:

eval "s//<<END/e; # jiggles\nfoo\nEND\ndie;"

It ends up copying this:

               "; # jiggles\ndie;\n;"

into this at the position shown:

eval "s//<<END/e; # jiggles\nfoo\nEND\ndie;\n;"
                ^

There is no need for two copies.  And there is no need to copy the
rest of the line where the heredoc marker is.

11 years agolex.t: Mangle obscenity (albeit euphemistic)
Father Chrysostomos [Wed, 29 Aug 2012 19:49:56 +0000 (12:49 -0700)]
lex.t: Mangle obscenity (albeit euphemistic)

It is harder to hack on perl with someone looking over one’s shoulder
when there are comments like this, even when it is euphemistic in its
use of voiced dental stops instead of the voiceless kind.

11 years agoFix here-doc body extraction in eval 's//<<END/'
Father Chrysostomos [Wed, 29 Aug 2012 19:47:32 +0000 (12:47 -0700)]
Fix here-doc body extraction in eval 's//<<END/'

Outside of string eval, this:

s//<<END/e; print "a
END
b\n";

prints this:

a
b

But when we have string eval involved,

eval 's//<<END/e; print "a
END
b\n"';

we get this:

a

b

Amazing!

The buggy code in question goes back to commit 0244c3a403.

Since PL_linestr only contains the contents of the replacement
("<<END"), it peeks into the outer lexing scope’s linestr buffer, mod-
ifying it in place to remove the here-doc body, by copying everything
after the here-doc back to the spot where the body begins.

It was off by one, however, and left an extra line break.

When the code in question is reached, the variables are set as follows:

bufptr = "; print \"a"...  (just after the s///)
s      = "\nb\\n\""        (newline after the heredoc terminator)

The herewas variable already contains everything after the quote-
like operator containing the <<heredoc marker to the end of the line
including the \n ("; print \"a\n").

But then we concatenate everything from s onwards.  So we end up with
the \n before the here-doc body and the \n from after the here-doc
terminator juxtaposed.

So after using s to extract the re-eval string, we increment s so it
points afer the final newline.

11 years agoFinish fixing here-docs in re-evals
Father Chrysostomos [Wed, 29 Aug 2012 19:35:49 +0000 (12:35 -0700)]
Finish fixing here-docs in re-evals

This commit fixes here-docs in single-line re-evals in files (as
opposed to evals) and here-docs in single-line quote-like operators
inside re-evals.

In both cases, the here-doc parser has to look into an outer
lexing scope to find the here-doc body.  And in both cases it
was stomping on PL_linestr (the current line buffer) while
PL_sublex_info.re_eval_start was pointing to an offset in that buffer.
(re_eval_start is used to construct the string to include in the
regexp’s stringification once the lexer reaches the end of the
re-eval.)

Fixing this entails moving re_eval_start and re_eval_str to
PL_parser->lex_shared, making the pre-localised values visible.
This is so that the code that peeks into an outer linestr buffer to
steal the here-doc body can set up re_eval_str in the right scope.
(re_eval_str is used to store the re-eval text when the here-
oc parser has no choice but to modify linestr; see also commit
db4442662555874019.)

It also entails making the stream-based parser (i.e., that reads from
an input stream) leave PL_linestr alone, instead of clobbering it and
then reconstructing part of it afterwards.

11 years agotoke.c:S_scan_heredoc: Put stream-based parser in else block
Father Chrysostomos [Wed, 29 Aug 2012 15:41:41 +0000 (08:41 -0700)]
toke.c:S_scan_heredoc: Put stream-based parser in else block

We currently have the code laid out like this:

    if (peek) {
        ... peek inside the parent linestr buffer
    }
    else if (eval) {
        ... grab the heredoc body from linestr ...
    }
    else
        start with an empty string for the heredoc body

    ... parse the body of the heredoc from the input stream ...

The final bit is inside a while loop whose condition is never true
after either of the first two branches of the if/else has executed.
But the code is very hard to read, and it is difficult to fix bugs, as
code cannot be added before the while loop, and the while loop condi-
tion cannot change, without affecting heredocs in string eval.

So put the final parser inside the else.  Future commits will
depend on this.

11 years agoAvoid uninit warning for qq|${\<<FOO}|
Father Chrysostomos [Wed, 29 Aug 2012 15:36:40 +0000 (08:36 -0700)]
Avoid uninit warning for qq|${\<<FOO}|

If a here-doc occurs inside a single-line quote-like operator inside
a file (as opposed to an eval), it produces an uninitialized warning.
The goto I added in commit 99bd9d90 wentto the wrong place.

11 years agotoke.c: S_scan_heredoc: prune dead code
Father Chrysostomos [Wed, 29 Aug 2012 05:37:10 +0000 (22:37 -0700)]
toke.c: S_scan_heredoc: prune dead code

This incorrect code (using a pointer after finding it to be null)
is the result of the refactoring in 60f40a3895.  It was trying to
account for a string eval with no line break in it.  But that can’t
happen as of 11076590 (if it could it would crash).

So remove it and add an assertion, along with a comment explaining the
assertion.

11 years agoRefactor t/op/die.t to re-use the same $SIG{__DIE__} handler where possible.
Nicholas Clark [Thu, 30 Aug 2012 13:34:33 +0000 (15:34 +0200)]
Refactor t/op/die.t to re-use the same $SIG{__DIE__} handler where possible.

Restore testing that the $SIG{__DIE__} handler is called for the case of
C<die bless [ 7 ], "Error";> which was removed by the previous refactoring.
Re-using the same $SIG{__DIE__} handler results in 4 more tests of isa_ok()
for an 'ARRAY' - this isn't going to hurt anyone.

11 years agoRefactor t/op/die.t to use test.pl instead of making TAP by hand.
Colin Kuskie [Wed, 18 Jul 2012 04:59:30 +0000 (21:59 -0700)]
Refactor t/op/die.t to use test.pl instead of making TAP by hand.

[With a few whitespace tweaks]

11 years agoFix Cygwin build warnings
Jerry D. Hedden [Wed, 29 Aug 2012 14:55:12 +0000 (10:55 -0400)]
Fix Cygwin build warnings

Fixes the following build warnings under Cygwin:

cygwin.c: In function 'do_spawn':
cygwin.c:132:5: warning: assignment from incompatible pointer type
cygwin.c: In function 'XS_Cygwin_posix_to_win_path':
cygwin.c:346:9: warning: 'err' may be used uninitialized in this function
cygwin.c: In function 'XS_Cygwin_win_to_posix_path':
cygwin.c:257:9: warning: 'err' may be used uninitialized in this function

11 years agoRemove a no-longer needed lexical from t/op/lop.t
Nicholas Clark [Wed, 29 Aug 2012 20:23:19 +0000 (22:23 +0200)]
Remove a no-longer needed lexical from t/op/lop.t

Jim Keenan spotted the commented out code referencing the variable $test.
Turns out that it is completely redundant, so its declaration can go too.

11 years agoDocument the last five tests of t/op/lop.t
Colin Kuskie [Sat, 11 Aug 2012 03:24:09 +0000 (20:24 -0700)]
Document the last five tests of t/op/lop.t

11 years agoUpdate t/op/lop.t to use test.pl instead of making TAP by hand.
Colin Kuskie [Sat, 28 Jul 2012 21:14:45 +0000 (14:14 -0700)]
Update t/op/lop.t to use test.pl instead of making TAP by hand.

11 years agoRefactor t/uni/case.pl to use test.pl instead of making TAP by hand.
Colin Kuskie [Thu, 19 Jul 2012 01:35:19 +0000 (18:35 -0700)]
Refactor t/uni/case.pl to use test.pl instead of making TAP by hand.

11 years agoRefactor t/porting/checkcase.t to use test.pl instead of making TAP by hand.
Colin Kuskie [Wed, 18 Jul 2012 05:21:21 +0000 (22:21 -0700)]
Refactor t/porting/checkcase.t to use test.pl instead of making TAP by hand.

11 years agoRefactor t/re/no_utf8_pt.t to use test.pl instead of making TAP by hand.
Colin Kuskie [Wed, 18 Jul 2012 05:07:54 +0000 (22:07 -0700)]
Refactor t/re/no_utf8_pt.t to use test.pl instead of making TAP by hand.

11 years agoAdd /\.gif\z/ files to the non-Pod exceptions in t/porting/podcheck.t
Nicholas Clark [Tue, 28 Aug 2012 19:22:51 +0000 (21:22 +0200)]
Add /\.gif\z/ files to the non-Pod exceptions in t/porting/podcheck.t

11 years agot/porting/podcheck.t now passes no_chdir to File::Find::find().
Nicholas Clark [Tue, 28 Aug 2012 19:09:24 +0000 (21:09 +0200)]
t/porting/podcheck.t now passes no_chdir to File::Find::find().

File::Find::find() can call warn::warnif(), which in turn attempts to lazy
load Carp, which doesn't work for a test using relative paths in @INC with
the current directory changed.

11 years agot/porting/dual-life.t now passes no_chdir to File::Find::find().
Nicholas Clark [Tue, 28 Aug 2012 15:23:10 +0000 (17:23 +0200)]
t/porting/dual-life.t now passes no_chdir to File::Find::find().

File::Find::find() can call warn::warnif(), which in turn attempts to lazy
load Carp, which doesn't work for a test using relative paths in @INC with
the current directory changed.

11 years agot/porting/exec-bit.t isn't using File::{Basename,Find,Spec::Functions}.
Nicholas Clark [Tue, 28 Aug 2012 15:14:37 +0000 (17:14 +0200)]
t/porting/exec-bit.t isn't using File::{Basename,Find,Spec::Functions}.

No point loading modules that it uses nothing from.

11 years agot/porting/checkcase.t now passes no_chdir to File::Find::find().
Nicholas Clark [Tue, 28 Aug 2012 15:05:18 +0000 (17:05 +0200)]
t/porting/checkcase.t now passes no_chdir to File::Find::find().

This avoids the test occasionally aborting due to File::Find::find() calling
warn::warnif(), which in turn attempts to lazy load Carp, which doesn't work
for a test using relative paths in @INC with the current directory changed.

11 years agoRefactor t/porting/filenames.t to shrink the code and the TAP generated.
Nicholas Clark [Tue, 28 Aug 2012 20:01:19 +0000 (22:01 +0200)]
Refactor t/porting/filenames.t to shrink the code and the TAP generated.

Fold the function validate_file_name() into its only caller. Put the tested
pathname into each test description to avoid a call to note() - this halves
the size of the TAP generated. Fold the chained tests into a chained
if/elsif/else sequence. Eliminate the use of File::Spec, as all platforms
can cope internally with F<../MANIFEST>.

11 years agoregexec.c: White-space only
Karl Williamson [Tue, 28 Aug 2012 21:37:22 +0000 (15:37 -0600)]
regexec.c: White-space only

This outdents a block whose enclosing braces have been removed, and
reflows things to correspond.

11 years agoAvoid duplicate table look ups.
Karl Williamson [Tue, 28 Aug 2012 21:29:42 +0000 (15:29 -0600)]
Avoid duplicate table look ups.

These two spots both are matching 'c+' where 'c' is some character
against a Unicode table.  Prior to this patch, if it matched a single
'c', it would fall into a while loop, where it matches that same 'c'
again.  Simply increment the pointer past the first match, and the while loop
will start looking for succeeding matches starting with the next
character in the input.

11 years agoRefactor \X regex handling to avoid a typical case table lookup
Karl Williamson [Tue, 28 Aug 2012 21:25:48 +0000 (15:25 -0600)]
Refactor \X regex handling to avoid a typical case table lookup

Prior to this commit 98.4% of Unicode code points that went through \X
had to be looked up to see if they begin a grapheme cluster; then looked
up again to find that they didn't require special handling.  This commit
refactors things so only one look-up is required for those 98.4%.  It
changes the table generated by mktables to accomplish this, and hence
the name of it, and references to it are changed to correspond.

11 years agoregexec.c: Remove no longer needed comments
Karl Williamson [Tue, 28 Aug 2012 03:50:03 +0000 (21:50 -0600)]
regexec.c: Remove no longer needed comments

These comments gave the derivation of the published Unicode algorithm
for determining what goes into \X to how it is actually implemented.

The new version of the Unicode text will be much more like what we've
implemented, so the derivation is no longer necessary; and is about to
be obsolete because of the Unicode document, and some changes to how we
process.

11 years agoperldelta for 43ddfa5614 and 39b80fd98d.
Steve Hay [Tue, 28 Aug 2012 17:32:14 +0000 (18:32 +0100)]
perldelta for 43ddfa5614 and 39b80fd98d.

11 years agoRevert File::Copy::copy() to fail when copying a file onto itself
Steve Hay [Tue, 28 Aug 2012 10:33:00 +0000 (11:33 +0100)]
Revert File::Copy::copy() to fail when copying a file onto itself

Copying a file onto itself was made a fatal error by 96a91e0163.
This was changed in 754f2cd0b9 from an undesirable croak() to return 1,
but the documentation was never changed from it being a fatal error.
It should probably have remained an error as per the documentation (but
updated not to say fatal) for consistency with cases of copying a file
onto itself via symbolic links or hard links.

11 years agoFix File::Copy test failure on Windows
Steve Hay [Mon, 27 Aug 2012 17:09:11 +0000 (18:09 +0100)]
Fix File::Copy test failure on Windows

Failure was introduced by 43ddfa5614 which looks for a warning message from
code that isn't run on Windows.

11 years agonote CPAN pod link target; regen pod issues
Father Chrysostomos [Tue, 28 Aug 2012 17:22:04 +0000 (10:22 -0700)]
note CPAN pod link target; regen pod issues

11 years agoperldtrace.pod: typo
Father Chrysostomos [Tue, 28 Aug 2012 17:18:12 +0000 (10:18 -0700)]
perldtrace.pod: typo

11 years agoperldtrace.pod: Remove a stray =item
Father Chrysostomos [Tue, 28 Aug 2012 17:15:08 +0000 (10:15 -0700)]
perldtrace.pod: Remove a stray =item

11 years agoAdd another address for Shawn Moore to checkAUTHORS.pl
Father Chrysostomos [Tue, 28 Aug 2012 17:11:00 +0000 (10:11 -0700)]
Add another address for Shawn Moore to checkAUTHORS.pl

11 years agoAdd t/run/dtrace.pl to MANIFEST
Father Chrysostomos [Tue, 28 Aug 2012 17:09:21 +0000 (10:09 -0700)]
Add t/run/dtrace.pl to MANIFEST

11 years ago"loading-file" and "loaded-file" DTrace probes
Shawn M Moore [Sun, 19 Aug 2012 15:12:27 +0000 (17:12 +0200)]
"loading-file" and "loaded-file" DTrace probes

11 years ago"op-entry" DTrace probe
Shawn M Moore [Fri, 24 Aug 2012 08:35:08 +0000 (10:35 +0200)]
"op-entry" DTrace probe

11 years agoop.c: Two more boolean %hash optimisations
Father Chrysostomos [Tue, 28 Aug 2012 08:22:13 +0000 (01:22 -0700)]
op.c: Two more boolean %hash optimisations

In commit c8fe3bdf72 I used the wrong flag for ?:, causing it to slow
down unless the ?: was in void context.

OP_NOT has been sensitive to void context all along, which was never
necessary.

These two should be just as fast.  The second should not be slower:

!%hash;
!!%hash;

11 years agoUse PL_parser->lex_shared instead of Sv[IN]VX(PL_linestr)
Father Chrysostomos [Tue, 28 Aug 2012 08:11:30 +0000 (01:11 -0700)]
Use PL_parser->lex_shared instead of Sv[IN]VX(PL_linestr)

Unfortunately, PL_parser->linestr and PL_parser->bufptr are both
part of the API, so we can’t just move them to PL_parser->lex_shared.
Instead, we have to copy them in sublex_push, to make them visible to
inner lexing scopes.

This allows the SvIVX(PL_linestr) and SvNVX(PL_linestr) hack to
be removed.

It should also speed things up slightly.  We are already allocating
PL_parser->lex_shared in sublex_push, so there should be no need to
upgrade PL_linestr to SvNVX as well.

I was pleasantly surprised to see how the here-doc code seemed to
shrink all by itself when modified to account.

PL_sublex_info.super_bufptr is also superseded by the addition of
->ls_bufptr to the LEXSHARED struct.  Its old values when localised
were not visible, being stashed away on the savestack, so it was
harder to use.

11 years agocaller.t: Fix ‘Caller’ test
Father Chrysostomos [Tue, 28 Aug 2012 07:51:27 +0000 (00:51 -0700)]
caller.t: Fix ‘Caller’ test

This string eval was always failing, leaving @c with its previous
value, which just happened to be what we were expecting.

11 years agoStop here-docs from gutting (caller $n)[6]
Father Chrysostomos [Tue, 28 Aug 2012 06:03:36 +0000 (23:03 -0700)]
Stop here-docs from gutting (caller $n)[6]

(caller $n)[6] returns the text of the eval.  Actually, it would
return, not the text of the eval, but the text with all the here-doc
bodies missing.

In this commit, I’m abusing the SvSCREAM flag to indicate that the
eval text stored in the context stack is refcounted.

11 years agoStop (caller $n)[6] from including final "\n;"
Father Chrysostomos [Tue, 28 Aug 2012 05:38:57 +0000 (22:38 -0700)]
Stop (caller $n)[6] from including final "\n;"

String eval appends "\n;" to the string before evaluating it.
(caller $n)[6], which returns the text of the eval, was giving the
modified string, rather than the original.

In fact, it was returning the actual string buffer that the parser
uses.  This commit changes it to create a new mortal SV from that
string buffer, but without the last two characters.

It unfortunately breaks this JAPH:

eval'BEGIN{${\(caller 2)[6]}=~y< !"$()+\-145=ACHMT^acfhinrsty{}>
<nlrhta"o Pe e,\nkrcrJ uthspeia">}say if+chr(1) -int"145"!=${^MATCH}'

11 years agoFix eval 'q;;'
Father Chrysostomos [Tue, 28 Aug 2012 01:26:11 +0000 (18:26 -0700)]
Fix eval 'q;;'

The parser expects a semicolon at the end of every statement, so the
lexer provides one.  It was not doing so for evals ending with a
semicolon, even if that semicolon was not a statement-terminating
semicolon.

11 years agoRevert "smoke-me diag"
Father Chrysostomos [Tue, 28 Aug 2012 01:19:24 +0000 (18:19 -0700)]
Revert "smoke-me diag"

This reverts commit 372a31d8f53707bcfa9c233ce02a93f778b7bb4b.

I missed this when I was merging that branch.  It should never have
made its way into blead.  It was to find out why the Windows smokes
were temporarily failing, by dumping Config_heavy.pl in the logs.
This was what led to 0ee364945bd.

11 years agoparser.h: Document copline with more detail
Father Chrysostomos [Tue, 28 Aug 2012 01:19:12 +0000 (18:19 -0700)]
parser.h: Document copline with more detail

It took me a while to figure this out, so here it is for
future readers.

11 years agoFix line numbers inside here-docs
Father Chrysostomos [Tue, 28 Aug 2012 01:16:34 +0000 (18:16 -0700)]
Fix line numbers inside here-docs

A previous commit put the number of lines in a here-doc in a separ-
ate parser field, which was added on to the line number at the next
CopLINE_inc (actually COPLINE_INC_WITH_HERELINES, now used through-
out toke.c).

Code interpolated inside the here-doc was picking up that value,
throwing line numbers off.

Before that, they were already off by one.

This commit fixes both.

I removed the CLINE from S_scan_heredoc and stopped using TERM (which
uses CLINE) for here-docs.  CLINE sets PL_copline, which is used to
pass a specific line number to newSTATEOP, which may or may not be the
same number as CopLINE(PL_curcop).  newSTATEOP grabs that number and
sets PL_copline to -1 (aka NOLINE).  I assume this was used to make
the statement containing the <<foo marker have the right line number.
But it didn’t fully work out, as subsequent statements on the same
line had the wrong number.  That I fixed a few commits ago when I
introduced herelines, making CopLINE(PL_curcop) have the right line
number for that line.  So the CLINE is not actually necessary anymore.
It was causing a problem also with the first statement inside the
heredoc (in ${...}), which would ‘steal’ the line number of the
<<foo marker.

This also means that <FH> and <.*> no longer do CLINE, but it is not
necessary, as they cannot span multiple lines.

11 years agoop.c: newSTATEOP: don’t check PL_parser after using it
Father Chrysostomos [Mon, 27 Aug 2012 21:56:52 +0000 (14:56 -0700)]
op.c: newSTATEOP: don’t check PL_parser after using it

If it is null, we would already have crashed when reaching this
statement.

11 years agoAdd PL_parser->lex_shared struct; move herelines into it
Father Chrysostomos [Mon, 27 Aug 2012 16:18:29 +0000 (09:18 -0700)]
Add PL_parser->lex_shared struct; move herelines into it

PL_parser->herelines needs to be visible to inner lexing scopes, which
also need to have their own copy of it, so that the here-doc parser
can modify the right herelines variable corresponding to the
PL_linestr from which it is stealing its body.  (A subsequent commit
will take take of that.)

11 years agoStop invalid y/// ranges from leaking
Father Chrysostomos [Mon, 27 Aug 2012 06:46:09 +0000 (23:46 -0700)]
Stop invalid y/// ranges from leaking

11 years agotoke.c: Merge KEY_tr and KEY_y
Father Chrysostomos [Mon, 27 Aug 2012 06:27:45 +0000 (23:27 -0700)]
toke.c: Merge KEY_tr and KEY_y

11 years agoStop unterminated here-docs from leaking memory
Father Chrysostomos [Mon, 27 Aug 2012 06:10:28 +0000 (23:10 -0700)]
Stop unterminated here-docs from leaking memory