This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perl5.git
11 years agoFixup indentation
Jan Dubois [Wed, 18 Jul 2012 22:47:44 +0000 (15:47 -0700)]
Fixup indentation

11 years agoAdding support for Visual C's __declspec(noreturn) function declarations to perl
Daniel Dragan [Mon, 16 Jul 2012 20:02:45 +0000 (16:02 -0400)]
Adding support for Visual C's __declspec(noreturn) function declarations to perl

This will reduce the machine code size on Visual C Perl, by removing C stack
clean up opcodes and possible jmp opcodes after croak() and similar
functions.  Perl's existing __attribute__noreturn__ macro (and therefore
GCC's __attribute__((noreturn)) ) is fundamentally incompatible with MS's
implementation for noreturn functions. win32.h already has _MSC_VER
aware code blocks, so adding more isn't a problem.

11 years agoperldelta updates
Tony Cook [Wed, 18 Jul 2012 11:34:30 +0000 (21:34 +1000)]
perldelta updates

11 years agosync() on a read-only file handle doesn't work on cygwin either
Tony Cook [Tue, 17 Jul 2012 05:48:02 +0000 (15:48 +1000)]
sync() on a read-only file handle doesn't work on cygwin either

Cygwin fsync() is implemented in terms of the Win32 FlushFileBuffers()
API which requires GENERIC_WRITE access.

11 years agoperldelta description of magic flags patch
Chip Salzenberg [Sun, 15 Jul 2012 23:20:14 +0000 (16:20 -0700)]
perldelta description of magic flags patch

11 years agomark blead-only modifications of Compress::Raw::{Bzip2,Zlib} with version bump
Chip Salzenberg [Sun, 15 Jul 2012 23:19:57 +0000 (16:19 -0700)]
mark blead-only modifications of Compress::Raw::{Bzip2,Zlib} with version bump

11 years agoMagic flags harmonization.
Chip Salzenberg [Fri, 22 Jun 2012 22:18:18 +0000 (15:18 -0700)]
Magic flags harmonization.

In restore_magic(), which is called after any magic processing, all of
the public OK flags have been shifted into the private OK flags.  Thus
the lack of an appropriate public OK flags was used to trigger both get
magic and required conversions.  This scheme did not cover ROK, however,
so all properly written code had to make sure mg_get was called the right
number of times anyway.  Meanwhile the private OK flags gained a second
purpose of marking converted but non-authoritative values (e.g. the IV
conversion of an NV), and the inadequate flag shift mechanic broke this
in some cases.

This patch removes the shift mechanic for magic flags, thus exposing (and
fixing) some improper usage of magic SVs in which mg_get() was not called
correctly.  It also has the side effect of making magic get functions
specifically set their SVs to undef if that is desired, as the new behavior
of empty get functions is to leave the value unchanged.  This is a feature,
as now get magic that does not modify its value, e.g. tainting, does not
have to be special cased.

The changes to cpan/ here are only temporary, for development only, to
keep blead working until upstream applies them (or something like them).

Thanks to Rik and Father C for review input.

11 years agoperldelta updates
Father Chrysostomos [Sun, 15 Jul 2012 02:13:18 +0000 (19:13 -0700)]
perldelta updates

11 years agodump.c: Dump op->op_s(labbed|avefree)
Father Chrysostomos [Sun, 15 Jul 2012 02:00:48 +0000 (19:00 -0700)]
dump.c: Dump op->op_s(labbed|avefree)

11 years agoRemove op_latefree(d)
Father Chrysostomos [Sun, 15 Jul 2012 02:00:17 +0000 (19:00 -0700)]
Remove op_latefree(d)

This was an early attempt to fix leaking of ops after syntax errors,
disabled because it was deemed to fragile.  The new slab allocator
(8be227a) has solved this problem another way, so latefree(d) no
longer serves any purpose.

11 years agoperly.y: Remove use of latefree from package foo {}
Father Chrysostomos [Sun, 15 Jul 2012 01:45:41 +0000 (18:45 -0700)]
perly.y: Remove use of latefree from package foo {}

It is not necessary for the op containing the sv containing the name
of the package to last until the end of the block.  Perl_package can
free the op immediately, as the only information it needs from it it
copies to the sv in PL_curstname.  The version number can be treated
the same way.

11 years agoop.c: ck_grep does not need to call listkids
Father Chrysostomos [Sat, 14 Jul 2012 21:16:42 +0000 (14:16 -0700)]
op.c: ck_grep does not need to call listkids

It calls ck_fun, which applies list context to all the arguments,
since grepstart and mapstart have an L in regen/opcodes.

11 years agoop.c: ck_fun does not need to call LINKLIST
Father Chrysostomos [Sat, 14 Jul 2012 21:10:44 +0000 (14:10 -0700)]
op.c: ck_fun does not need to call LINKLIST

The branch in question is only reached when it is called from ck_grep,
which itself calls LINKLIST on exactly the same op.

11 years agoop.c:ck_grep: Remove unnecessary op_next assignments
Father Chrysostomos [Sat, 14 Jul 2012 20:28:57 +0000 (13:28 -0700)]
op.c:ck_grep: Remove unnecessary op_next assignments

ck_grep is a tangled mess and I am trying to simplify it, but at each
step it is not at all obvious what is happening.

grep/map with a block starts out like this:

    grepstart
      pushmark
      null
        scope/leave
          block contents...
      arg1
      arg2
      ...

The if (o->op_flags & OPf_STACKED) at the top of ck_grep runs for
blocks.  The firstkid var refers to the null above, and gets its
op_next set (this code was in ck_sort until recently [ck_grep used to
call ck_sort], and this particular op_next assignment was specific to
grep and map).

Later, the thing is fed through ck_fun, whose OA_CVREF case transforms
the tree into this:

    grepstart
      pushmark
      null             ← new op
        null           ← original null
          scope/leave
            block contents...
      arg1
      arg2
      ...

Then cUNOPx(cLISTOP->op_first->op_sibling)->op_first gets its op_next
set.  By that point, that expression refers to the original null op,
so setting its op_next pointer to begin with seems pointless.

But it is not actually pointless.  Removing that statement breaks
things.  It turns out, as usual, that everything is more complicated
than it seems.  Setting kid->op_next = (OP*)gwop in the block-specific
if statement after setting the first null op’s op_next pointer results
in op_next pointers like this (the newly-created grepwhile doesn’t
link to the grepstart yet at this point):

  [grepwhile]
    grepstart
      pushmark
      null              -> block contents
        scope/leave     -> grepwhile
          block contents...
      arg1
      arg2
      ...

So ck_fun’s OA_CVREF handling, when it calls LINKLIST, sees that the
original null op already has its op_next set and does nothing.  With-
out it set, it copies it from the first kid, resulting in this (when
LINKLIST copies the op_next pointer out, it makes the kid it was cop-
ied from point to its sibling or its parent):

  [grepwhile]
    grepstart
      pushmark
      null
        null              -> grepwhile
          scope/leave     -> null (prev line)
            block contents...
      arg1
      arg2
      ...

That nonsensical arrangement of op_next pointers basically prevents
the block from running, because the grepwhile’s other pointer, copied
from the first null’s kid, ends up pointing to the grepwhile itself.

If we also remove the kid->op_next = (OP*)gwop assignment from the
if(OPf_STACKED) block, then we end up with this after ck_fun:

  [grepwhile]
    grepstart
      pushmark
      null
        null              -> first op in block
          scope/leave     -> null (prev line)
            block contents...
      arg1
      arg2
      ...

Then the op_next poiner from the first null’s kid is copied to
grepwhile’s op_other pointer, and everything works.

This also means we can remove the now-redundant LINKLIST call from the
if(OPfSTACKED) block, since ck_fun’s OA_CVREF handling also does that.
So now every vestige of the original call to ck_sort is gone.

This also means we no longer have to repeat NewOp(1101, gwop...).

11 years agoop.c: ck_grep does not need to check num of args
Father Chrysostomos [Sat, 14 Jul 2012 19:28:15 +0000 (12:28 -0700)]
op.c: ck_grep does not need to check num of args

It calls ck_fun first, which does the same check, so it is
unnecessary.

11 years agopp_hot.c: Mention that pp_grepstart calls pp_pushmark
Father Chrysostomos [Sat, 14 Jul 2012 19:28:08 +0000 (12:28 -0700)]
pp_hot.c: Mention that pp_grepstart calls pp_pushmark

11 years agoSimplify ck_grep
Father Chrysostomos [Sat, 14 Jul 2012 13:58:29 +0000 (06:58 -0700)]
Simplify ck_grep

Back in perl 5.000, ck_grep would call ck_sort (which was still the
case until 354dd559d99 just recently) and the latter would traverse
its way through the op_next pointers to find an op that tried to
escape the block, setting its op_next pointer to null.  Then ck_grep
would traverse op_next pointers itself to find the place where ck_sort
stopped.  That caused problems for grep which were fixed in 748a93069b
(perl 5.001).  It was fixed by setting op_next to 0 on the first op,
so that the loop in ck_grep would not do anything.  But that loop was
left there.  This commit removes it.

There are also a couple of things I missed when disentangling
ck_grep and ck_sort in commit /354dd559d9.  I accidentally put
if (o->op_flags & OPf_STACKED) inside if (o->op_flags & OPf_STACKED).
And the OPf_SPECIAL flag was only being set for sort’s use, so ck_grep
doesn’t need to copy that.

11 years agoop.c: Further simplify ck_sort
Father Chrysostomos [Sat, 14 Jul 2012 13:41:30 +0000 (06:41 -0700)]
op.c: Further simplify ck_sort

This code currently chases op_next pointers in the sort block to make
sure there is none that can point outside.  To avoid getting stuck in
loops, it has to check for those explicitly.

Instead of nulling out any op_next pointer that points to the leave
op, we can simply turn the leave into a null op (which we already do)
and have the leave op’s op_next pointer point to nothing.

That produces the same result in the end:  Execution of the sort block
is prevented from running rampant and escaping out of it, but exits
the runloop instead, returning control to pp_sort.

11 years agoUpgrade Socket to 2.002
Tony Cook [Sun, 8 Jul 2012 01:12:51 +0000 (11:12 +1000)]
Upgrade Socket to 2.002

11 years agoop.c: Consistent tweak; podchecker complaints
Father Chrysostomos [Sat, 14 Jul 2012 07:51:09 +0000 (00:51 -0700)]
op.c: Consistent tweak; podchecker complaints

11 years agoUpdate perlop's bignum modules list.
Shlomi Fish [Fri, 13 Jul 2012 19:27:24 +0000 (22:27 +0300)]
Update perlop's bignum modules list.

Removed some out-of-date modules and add Math::GMPq, Math::GMPz and
Math:GMPf.

11 years agoop.c: Missing line break
Father Chrysostomos [Sat, 14 Jul 2012 07:36:06 +0000 (00:36 -0700)]
op.c: Missing line break

11 years agoDisentangle ck_sort and grep
Father Chrysostomos [Sat, 14 Jul 2012 07:35:13 +0000 (00:35 -0700)]
Disentangle ck_sort and grep

Originally, sort and grep/map used the same code for handling the
block’s ops.

But that didn’t quite work, so exceptions were added over time.  Now
the thing is a complex sprawling mess.  By folding the grep-specific
code into ck_grep, things are greatly simplified.

11 years ago[perl #113710] Make __SUB__ work in sort block
Father Chrysostomos [Sat, 14 Jul 2012 07:07:03 +0000 (00:07 -0700)]
[perl #113710] Make __SUB__ work in sort block

When the peephole optimiser encounters a __SUB__, it looks to see
whether the current sub is clonable.  If it is not, it inlines the
__SUB__ as a const op.

This works most of the time.  A forward declaration will cause the sub
definition to reuse the existing stub.  When that happens, the sub
visible during compilation in PL_compcv is not the sub that the
op tree will finally be attached to.  But the peephole optimiser
is called after that, with PL_compcv set to the other CV (what
was a stub).

ck_sort was calling the peephole optimiser on the sort block ahead of
time.  So this caused __SUB__ to point to the wrong subroutine.

By removing the CALL_PEEP call from ck_sort and adding logic to the
peephole optimiser itself to traverse the sort block (it is not in the
usual op_next chain), this bug is eliminated.

I modified the DEFER macro to work as a single statement.  You don’t
want to know how much time I spent debugging the bus errors that were
occurring because if(foo) DEFER; didn’t do what I though.

It turns out that grepstart and mapstart, which also use ck_sort,
had their blocks go through the peephole optimiser twice, because
grepwhile already has special-casing in the peephole optimiser.

This also has the side-effect of making map and grep slightly more
efficient, in that they no longer execute a scope op (which is just
pp_null).  By temporarily disconnecting the subtree before running the
optimiser, ck_sort was hiding a possible optimisation (skipping the
scope op).

11 years agofix RT#114068 optimizer handles MEOL in middle of pattern improperly
Yves Orton [Wed, 11 Jul 2012 07:03:09 +0000 (09:03 +0200)]
fix RT#114068 optimizer handles MEOL in middle of pattern improperly

It seems that under certain circumstances the optimiser handles the
MEOL operator (what $ turns into under /m), improperly including
things that follow. This results in compilation like this:

    Compiling REx "( [^z] $ [^z]+ )"
    Final program:
        1: OPEN1 (3)
        3:   ANYOF[\x00-y{-\xff][{unicode}0100-INFINITY] (14)
       14:   MEOL (15)
       15:   PLUS (27)
       16:     ANYOF[\x00-y{-\xff][{unicode}0100-INFINITY] (0)
       27: CLOSE1 (29)
       29: END (0)
    anchored ""$ at 2 stclass ANYOF[\x00-y{-\xff][{unicode}0100-INFINITY]

Where the '""$ at 2' is sign of the bug. The problem is that the optimiser
does not "commit" the string when it encounters an MEOL, which means that
text that follows it is included. This has probably always been wrong as
$ is a multichar pattern (it matches before an \n or including an \n). This
failure to commit then interacts with the implementation for PLUS leading to
an incorrect offset. By adding a SCAN_COMMIT() as part of the optimisers
handling of EOL constructs this problem is avoided. Note that most uses of
$ were ok due to other reasons.

11 years ago[perl #113576] Restore err msg for &{+undef}
Father Chrysostomos [Sat, 14 Jul 2012 01:16:43 +0000 (18:16 -0700)]
[perl #113576] Restore err msg for &{+undef}

This ‘Can't use an undefined value as a subroutine reference’ message
used to occur for &{+undef}, until commit 15ff848f77796 in 1997.

Then it started happening only for magic variables.

Non-magical variables would treat it the same as "", possibly dying
with ‘Undefined subroutine main:: called’, and possibly calling the
subroutine with that name.

Magical variables (&{$tied_undef}) started behaving the same way
(treating undef as "") with commit 7c75014e, in 2010.

This commit restores that message.

11 years ago[perl #113470] Constant folding for pack
Father Chrysostomos [Sat, 14 Jul 2012 01:10:38 +0000 (18:10 -0700)]
[perl #113470] Constant folding for pack

This takes the pessimistic approach of skipping it for any first argu-
ment that is not a plain non-magical PV, just in case there is a 'p'
or 'P' in the stringified form.

Otherwise it scans the PV for 'p' or 'P' and skips the folding if either
is present.

Then it falls through to the usual op-filtering logic.

I nearly made ‘pack;’ crash, so I added a test to bproto.t.

11 years ago[perl #113020] INSTALL: Clarify CPAN::autobundle
Father Chrysostomos [Sat, 14 Jul 2012 00:00:53 +0000 (17:00 -0700)]
[perl #113020] INSTALL: Clarify CPAN::autobundle

11 years agosilence override warning
Robin Barker [Tue, 10 Jul 2012 23:32:36 +0000 (00:32 +0100)]
silence override warning

The test is trying to test the behaviour being warned about,
so the code is right but the warning can be suppressed.

11 years agomro/basic.t: Squelch warning
Father Chrysostomos [Fri, 13 Jul 2012 16:37:23 +0000 (09:37 -0700)]
mro/basic.t: Squelch warning

11 years agosilence warning about use of --libpods
Robin Barker [Tue, 10 Jul 2012 23:31:05 +0000 (00:31 +0100)]
silence warning about use of --libpods

--lipods warns, and I don't think it is needed in this test,
so I have removed it

11 years agosilence compiler warning - casting void* to IV
Robin Barker [Tue, 10 Jul 2012 23:29:56 +0000 (00:29 +0100)]
silence compiler warning - casting void* to IV

This warns when void* and IV have different sizes
There is already a macro to do this conversion cleanly: PTR2IV

11 years agomg_vtable.pl: Mention all generated files
Father Chrysostomos [Fri, 13 Jul 2012 06:15:29 +0000 (23:15 -0700)]
mg_vtable.pl: Mention all generated files

11 years agoFix @{*ISA} autovivification
Father Chrysostomos [Fri, 13 Jul 2012 00:50:51 +0000 (17:50 -0700)]
Fix @{*ISA} autovivification

It was not attaching magic to the array, preventing subsequent changes
to the array from updating isa caches.

11 years agoFix *ISA = *glob_without_array
Father Chrysostomos [Fri, 13 Jul 2012 00:35:37 +0000 (17:35 -0700)]
Fix *ISA = *glob_without_array

I broke this in 5.14 with commit 6624142a.

In trying to make *ISA = *Other::ISA work, I added logic to make
@Other::ISA’s existing magic now point to *ISA’s stash.  I skipped
that logic if *Other::ISA did not contain an array.  But in so
doing, I inadvertently skipped the call to mro_isa_changed_in at the
same time.

11 years agoop.c: Make slabs sizes powers of two
Father Chrysostomos [Thu, 12 Jul 2012 21:34:03 +0000 (14:34 -0700)]
op.c: Make slabs sizes powers of two

It wasn’t exactly doubling the size of the previous slab, but making
it two less than that.  I’m assuming that malloc implementations round
things up to powers of two, and trying to take advantage of that, so
we don’t have wasted gaps at the ends of slabs.

11 years agoperldelta update
Father Chrysostomos [Thu, 12 Jul 2012 21:20:31 +0000 (14:20 -0700)]
perldelta update

11 years agoperlhacktips: PERL_DEBUG_READONLY_OPS update
Father Chrysostomos [Thu, 12 Jul 2012 19:52:07 +0000 (12:52 -0700)]
perlhacktips: PERL_DEBUG_READONLY_OPS update

I don’t know when this changed, but I *can* build F<perl> with
PERL_DEBUG_READONLY_OPS, and I could before I rewrote it to use the
new slab allocator.  So that particular note in perlhacktips may have
been wrong for quite some time.  I assume it had to do with redefini-
tion sub warnings that try to set the line number of the current cop
(which is still a problem).

11 years agotodo.pod: Clean up entries related to op slabs
Father Chrysostomos [Thu, 12 Jul 2012 19:40:32 +0000 (12:40 -0700)]
todo.pod: Clean up entries related to op slabs

Note about storing the current pad with the ops:  If each slab belongs
to a CV (which is the case), then we would only ever walk the slab to
free its ops when the CV itself is freed.  When that happens, the pad
is about to freed anyway, so freeing pad entries for each op is unnec-
essary, and has probably always been so.  Note that cv_undef actually
sets PL_comppad and PL_curpad to null before freeing ops, to avoid
having to have them point at the right pad, and probably also to avoid
the unnecessary overhead of tracking which pad entries are available
for reuse.

11 years agoEliminate PL_OP_SLAB_ALLOC
Father Chrysostomos [Thu, 12 Jul 2012 19:24:06 +0000 (12:24 -0700)]
Eliminate PL_OP_SLAB_ALLOC

This commit eliminates the old slab allocator.  It had bugs in it, in
that ops would not be cleaned up properly after syntax errors.  So why
not fix it?  Well, the new slab allocator *is* the old one fixed.

Now that this is gone, we don’t have to worry as much about ops leak-
ing when errors occur, because it won’t happen any more.

Recent commits eliminated the only reason to hang on to it:
 PERL_DEBUG_READONLY_OPS required it.

11 years agoop.c:pmruntime: Remove redundant cv_forget_slab
Father Chrysostomos [Thu, 12 Jul 2012 19:06:29 +0000 (12:06 -0700)]
op.c:pmruntime: Remove redundant cv_forget_slab

This comes after newATTRSUB, which itself causes the CV to forget its
slab, except after a parse error, in which case the slab will be
cleaned up shortly anyway when the CV is freed.

11 years agoPERL_DEBUG_READONLY_OPS with the new allocator
Father Chrysostomos [Tue, 10 Jul 2012 07:26:12 +0000 (00:26 -0700)]
PERL_DEBUG_READONLY_OPS with the new allocator

I want to eliminate the old slab allocator (PL_OP_SLAB_ALLOC),
but this useful debugging tool needs to be rewritten for the new
one first.

This is slightly better than under PL_OP_SLAB_ALLOC, in that CVs cre-
ated after the main CV starts running will get read-only ops, too.  It
is when a CV finishes compiling and relinquishes ownership of the slab
that the slab is made read-only, because at that point it should not
be used again for allocation.

BEGIN blocks are exempt, as they are processed before the Slab_to_ro
call in newATTRSUB.  The Slab_to_ro call must come at the very end,
after LEAVE_SCOPE, because otherwise the ops freed via the stack (the
SAVEFREEOP calls near the top of newATTRSUB) will make the slab writa-
ble again.  At that point, the BEGIN block has already been run and
its slab freed.  Maybe slabs belonging to BEGIN blocks can be made
read-only later.

Under PERL_DEBUG_READONLY_OPS, op slabs have two extra fields to
record the size and readonliness of each slab.  (Only the first slab
in a CV’s slab chain uses the readonly flag, since it is conceptually
simpler to treat them all as one unit.)  Without recording this infor-
mation manually, things become unbearably slow, the tests taking hours
and hours instead of minutes.

11 years agoEnsure wildcard expansion is enabled for perlglob.exe on Windows
Steve Hay [Thu, 12 Jul 2012 17:07:17 +0000 (18:07 +0100)]
Ensure wildcard expansion is enabled for perlglob.exe on Windows

This is provided by linking in setargv.obj for Visual C++, which the
makefiles already do, but for MinGW(-w64)/gcc we must explicitly ensure
that wildcard expansion is enabled rather than relying on the C-runtime
defaults of the particular compiler suite in question.

This currently only seems to be necessary for the automated build of the
MinGW-w64 cross-compiler (other builds have it enabled by default anyway),
but there's no harm in making sure for others too.

11 years agoUpdate autodie to CPAN version 2.12
Chris 'BinGOs' Williams [Fri, 6 Jul 2012 21:27:14 +0000 (22:27 +0100)]
Update autodie to CPAN version 2.12

  [DELTA]

  2.12  Tue Jun 26 14:55:04 PDT 2012
        * BUGFIX: autodie now plays nicely with the 'open' pragma
        (RT #54777, thanks to Schwern).

        * BUILD: Updated to Module::Install 1.06

        * BUILD: Makefile.PL is less redundant.

        * TEST: t/pod-coverage.t no longer thinks LEXICAL_TAG is
          a user-visible subroutine.

11 years agoUpdate File-Fetch to CPAN version 0.36
Chris 'BinGOs' Williams [Fri, 6 Jul 2012 21:17:46 +0000 (22:17 +0100)]
Update File-Fetch to CPAN version 0.36

  [DELTA]

  Changes for 0.36        Thu Jun 28 13:41:31 2012
  =================================================
  * Added 'file_default' option for URLs that do
    not have a file component (Andrew Kirkpatrick)

11 years agoAdd IP probe for ip_mreq
H.Merijn Brand [Wed, 11 Jul 2012 15:20:30 +0000 (17:20 +0200)]
Add IP probe for ip_mreq

Backport 2f1eb816b5cba6977b1a8159

11 years agoAdd AIX7 APAR requirement to get Time::Piece tests to pass.
Darin McBride [Wed, 11 Jul 2012 13:27:08 +0000 (07:27 -0600)]
Add AIX7 APAR requirement to get Time::Piece tests to pass.

Signed-off-by: H.Merijn Brand <h.m.brand@xs4all.nl>
11 years agoCast following 22831cc58.
Craig A. Berry [Wed, 11 Jul 2012 12:10:26 +0000 (07:10 -0500)]
Cast following 22831cc58.

C++ insists on casting the return values of the malloc family.

11 years agoAIX isn't a new platform, move its note to the right place
Tony Cook [Wed, 11 Jul 2012 12:12:25 +0000 (22:12 +1000)]
AIX isn't a new platform, move its note to the right place

11 years agouse right type for offset in sysread() or syswrite()
Chip Salzenberg [Wed, 11 Jul 2012 07:05:19 +0000 (00:05 -0700)]
use right type for offset in sysread() or syswrite()

11 years agoremove silly redundant SvGMAGICAL() test for $\
Chip Salzenberg [Wed, 11 Jul 2012 07:03:37 +0000 (00:03 -0700)]
remove silly redundant SvGMAGICAL() test for $\
  that was introduced by some guy named Chip in 1997 (e3c19b7bc9)

11 years agoensure shmread() calls get and set magic once
Chip Salzenberg [Wed, 11 Jul 2012 06:19:02 +0000 (23:19 -0700)]
ensure shmread() calls get and set magic once

11 years agohold pid in Pid_t, not I32, for kill()
Chip Salzenberg [Wed, 11 Jul 2012 05:35:45 +0000 (22:35 -0700)]
hold pid in Pid_t, not I32, for kill()

11 years agoRefactor t/op/join.t to use test.pl instead of making TAP by hand.
Colin Kuskie [Tue, 10 Jul 2012 00:42:18 +0000 (17:42 -0700)]
Refactor t/op/join.t to use test.pl instead of making TAP by hand.

Added a utility sub to the test for the byte vs character tests.

11 years agoExpand $^O at build time when generating Config::_V()
Nicholas Clark [Tue, 19 Jun 2012 14:50:47 +0000 (16:50 +0200)]
Expand $^O at build time when generating Config::_V()

Config::_V() is how perl -V is implemented internally, and is called called
directly from the interpreter's switch passing routine. Hence the value of
$^O at runtime will always be the same as the value of $^O at build time,
so conditionals dependent on the value of $^O will always take the same
execution path. So only generate the relevant code, and hence avoid shipping
VMS and Cygwin specific code except on those platforms. (But add a sanity
test in Config::_V() to ensure that the runtime $^O has the correct value -
ie that the Perl code and the perl binary correspond.)

11 years agoIn configpm, switch to using sprintf for part of generating Config_heavy.pl
Nicholas Clark [Tue, 19 Jun 2012 14:18:39 +0000 (16:18 +0200)]
In configpm, switch to using sprintf for part of generating Config_heavy.pl

This will make subsequent changes easier.

11 years agoRefactor t/lib/commonsense.t to use t/test.pl instead of making TAP by hand. Add...
Colin Kuskie [Sun, 8 Jul 2012 22:42:03 +0000 (15:42 -0700)]
Refactor t/lib/commonsense.t to use t/test.pl instead of making TAP by hand. Add a BAIL_OUT method to test.pl for lib/commonsense.t to use.

11 years agoImprove support for building on Windows with mingw-w64.sf.net binaries
Steve Hay [Mon, 9 Jul 2012 08:16:21 +0000 (09:16 +0100)]
Improve support for building on Windows with mingw-w64.sf.net binaries

The cross-compiler has headers and libraries in a sub-directory called
x86_64-w64-mingw32\, which is also copied to mingw\ in the automated
builds but not in other builds (e.g. rubenvb's build), so rely on the
folder which is always present.

The DLLs required for op\taint.t to work are nomrally found in \bin\, but
for the cross-compiler are found in the same folder as the libraries since
they are 64-bit DLLs, whereas the compiler binaries themselves are 32-bit.

With these fixes we now support the following MinGW/gcc compilers:

Native 32-bit compilers (WIN64=undef GCCCROSS=undef): mingw.org, rubenvb's
build of mingw-w64.sf.net, Mark Dootson's build of the same (used in
Strawberry Perl).

Native 64-bit compilers (WIN64=define GCCCROSS=undef): rubenvb's build of
mingw-w64.sf.net, Mark Dootson's build of the same (used in Strawberry
Perl).

32-bit cross-compilers producing 64-bit binaries (WIN64=define
GCCCROSS=define): rubenvb's build of mingw-w64.sf.net, the automated build
of the same.

There is currently no automated build of a native 64-bit compiler on
mingw-w64.sf.net, and their automated build of a native 32-bit compiler is
not currently supported since it uses an anomalous naming convention
compared to the other options above.

See http://www.nntp.perl.org/group/perl.perl5.porters/2012/07/msg189461.html
for discussion.

11 years agohandy.: Add some tests for its API
Karl Williamson [Sun, 8 Jul 2012 17:40:55 +0000 (11:40 -0600)]
handy.: Add some tests for its API

11 years agohandy.h: Fix broken is_ASCII_utf8()
Karl Williamson [Sun, 8 Jul 2012 17:37:24 +0000 (11:37 -0600)]
handy.h: Fix broken is_ASCII_utf8()

Tests to follow in a future commit.

11 years agoCorrect err msg when calling stub w/no autoload fb
Father Chrysostomos [Sun, 8 Jul 2012 06:39:07 +0000 (23:39 -0700)]
Correct err msg when calling stub w/no autoload fb

If an AUTOLOAD subroutine loads a sub by assigning to the glob, there
may be code elsewhere that has a reference to a stub, that is now
assigned over.  To cope with this situation, calls to undefined sub-
routines will fall back to whatever sub is in the subroutine’s owner
typeglob.  This has been the case since Perl 5.000.

But the error message that occurs if the typeglob happens to have no
sub in it is wrong:

$ perl -e '
   my $foosub = \&foo;
   undef *foo;
   &$foosub;
  '
Not a CODE reference at -e line 4.

as opposed to this:

$ perl -e '
   my $foosub = \&foo;
   &$foosub;
  '
Undefined subroutine &main::foo called at -e line 3.

They should both produce the same error message, because $foosub is a
code reference, albeit without a body.

11 years agoanonsub.t: Improve test for [perl #71154]
Father Chrysostomos [Sun, 8 Jul 2012 06:28:35 +0000 (23:28 -0700)]
anonsub.t: Improve test for [perl #71154]

When I authored commit 2c3743704, I thought I was just correcting the
error message at the time (from ‘Not a CODE reference’ to ‘Undefined
sub called’, since there is a sub), but it turns out I actually fixed
another bug at the same time.  Undefined anonymous subs were falling
back to supposedly-autoloaded __ANON__ subs.

Take this example, for instance:

    sub __ANON__ { warn 42 }
    $x = sub {};
    undef &$x;
    $x->();

This is the output I get:

$ pbpaste|perl5.14.0
42 at - line 1.
$ pbpaste|perl5.16.0
Undefined subroutine called at - line 4.

11 years agoLet rv2cv-hook CVs’ protos participate in method intuition
Father Chrysostomos [Sun, 8 Jul 2012 06:22:33 +0000 (23:22 -0700)]
Let rv2cv-hook CVs’ protos participate in method intuition

Commit 39c012bc2fc2f1cf wasn’t enough.  If a subroutine has a proto-
type beginning with * then its name is treated as a sub call, even
when followed by a package name:

    {package Foo}
    sub Foo {}
    foo Foo; # Foo->foo

    {package Bar}
    sub bar (*) {}
    bar Bar; # bar(Bar)

This was not applying to subs looked up via rv2cv hooks.

11 years agofix -Uusedl builds
Tony Cook [Sun, 8 Jul 2012 03:00:42 +0000 (13:00 +1000)]
fix -Uusedl builds

without the "static" linking produced a duplicate symbol error on
S_compile_runtime_code

11 years agoperldelta: fix typo noticed by rurban
Tony Cook [Sun, 8 Jul 2012 01:24:33 +0000 (11:24 +1000)]
perldelta: fix typo noticed by rurban

11 years ago[perl #113016] Parse CORE::foo::bar as a bareword
Father Chrysostomos [Sat, 7 Jul 2012 04:57:39 +0000 (21:57 -0700)]
[perl #113016] Parse CORE::foo::bar as a bareword

CORE::print::foo was being parsed as CORE::print followed by
::foo, making it impossible to call a global override directly as
CORE::GLOBAL::uc().

The logic in toke.c that does the CORE:: special-casing was faulty.
This commit fixes it, by checking for a package separator after the
potential keyword.

That d = s part of the KEY_CORE case in yylex was added in perl 5.001
(748a9306) but apparently wasn’t doing anything.  That means I get to
move it before s+=2, now that I have a use for it.

I added the tests a little above the ‘Add new tests HERE’ label in
parser.t, to avoid conflicting with other patches I’m working on.

11 years agorv2cv hooks should not create 2nd-class subs
Father Chrysostomos [Fri, 6 Jul 2012 21:19:21 +0000 (14:19 -0700)]
rv2cv hooks should not create 2nd-class subs

$ perl5.17.2 -Mblib -e 'sub foo{}; foo $bar; use Lexical::Sub baz => sub{}; baz $bar'
Can't call method "baz" on an undefined value at -e line 1.
$ perl5.17.2 -Mblib -e 'sub foo{}; foo bar; use Lexical::Sub baz => sub{}; baz bar'
Can't locate object method "baz" via package "bar" (perhaps you forgot to load "bar"?) at -e line 1.

So if you use Lexical::Sub, your sub doesn’t get to participate in
determining whether ‘foo $bar’ or ‘foo bar’ is a method call.

This is because Lexical::Sub uses an rv2cv hook to intercept sub
lookup.  And toke.c:S_intuit_method thinks there cannot be a CV with-
out a GV (which was the case when it was first written).

Commit f7461760 introduced this rv2cv hooking for bareword lookup, but
failed to update S_intuit_method accordingly.

11 years agotoke.c: Correct comment
Father Chrysostomos [Fri, 6 Jul 2012 12:35:01 +0000 (05:35 -0700)]
toke.c: Correct comment

11 years agoperldelta: note a few interesting changes
Tony Cook [Sat, 7 Jul 2012 03:05:29 +0000 (13:05 +1000)]
perldelta: note a few interesting changes

11 years agodocument the append parameter to sv_gets [perl #72244]
Jesse Luehrs [Fri, 6 Jul 2012 03:11:34 +0000 (22:11 -0500)]
document the append parameter to sv_gets [perl #72244]

11 years agoperldelta for 22831cc58b76.
Craig A. Berry [Fri, 6 Jul 2012 02:30:06 +0000 (21:30 -0500)]
perldelta for 22831cc58b76.

11 years agoUnquote spawned command verbs on VMS.
Craig A. Berry [Thu, 5 Jul 2012 23:22:46 +0000 (18:22 -0500)]
Unquote spawned command verbs on VMS.

Prior to the current change,

$ foo "A" "b" "c"

worked, but the following didn't:

$ "foo" "A" "b" "c"
%DCL-E-PARSEFAIL, error parsing DCL$PATH:"foo".*
-RMS-F-FNM, error in file name

even if foo was a valid command or path.  It's illegal in DCL to
quote the command verb even if it's often necessary to quote the
parameters to it.

But various things in the wild (such as Test::Harness::_filtered_inc),
find it convenient or necessary to quote the command verb, so the
easiest way to support that is to unquote it before DCL sees it, and
that's what this change does.

Also, spaces within the first quoted item are now escaped so that
an image path containing spaces doesn't run afoul of subsequent
tokenizing based on spaces.

11 years agodo-file should not force a bareword
Father Chrysostomos [Tue, 3 Jul 2012 01:11:23 +0000 (18:11 -0700)]
do-file should not force a bareword

A word following do is forced to be a bareword for do-sub’s sake.  But
if it is going to be interpreted as do-file after all, that does not
make sense.  ‘do subname;’ should call the sub and run the file whose
name it returns, instead of running the file named ‘subname’.

11 years agoLet do.t run from the top level
Father Chrysostomos [Mon, 2 Jul 2012 21:47:50 +0000 (14:47 -0700)]
Let do.t run from the top level

11 years agodo.t: Load test.pl at BEGIN time
Father Chrysostomos [Mon, 2 Jul 2012 21:47:34 +0000 (14:47 -0700)]
do.t: Load test.pl at BEGIN time

so that parentheses can be omitted.

11 years agoTest ‘Missing name in "my sub"’
Father Chrysostomos [Sun, 1 Jul 2012 00:17:39 +0000 (17:17 -0700)]
Test ‘Missing name in "my sub"’

11 years agoboth INT64_C and UINT64_C should be guarded [perl #76306]
Jesse Luehrs [Fri, 6 Jul 2012 00:40:10 +0000 (19:40 -0500)]
both INT64_C and UINT64_C should be guarded [perl #76306]

11 years agort #72232 - ignore wday/yday in mini_mktime as indirectly documented
Tony Cook [Wed, 17 Feb 2010 09:43:46 +0000 (20:43 +1100)]
rt #72232 - ignore wday/yday in mini_mktime as indirectly documented

11 years agoperlfunc: clarify 'our' again for vars.pm behavior
David Golden [Fri, 6 Jul 2012 00:14:15 +0000 (20:14 -0400)]
perlfunc: clarify 'our' again for vars.pm behavior

rjbs discovered that vars.pm docs lie and it works within
a package, even across file scopes

11 years agoperlfunc: clarify docs for 'package' [perl #113974]
David Golden [Fri, 6 Jul 2012 00:01:26 +0000 (20:01 -0400)]
perlfunc: clarify docs for 'package' [perl #113974]

This one word change clarifies that 'package' applies to
'lexically-scoped' variables rather than 'lexical' variables, which
people may misunderstand to mean only my/state declarations and thus be
confused by the nearby statements about it applying to 'our' as well.

No perldelta note was added as the change was trivial.

11 years agovars.pm: remove 'obsolete' description [perl #113974]
David Golden [Thu, 5 Jul 2012 23:58:28 +0000 (19:58 -0400)]
vars.pm: remove 'obsolete' description [perl #113974]

The phrase 'obsolete' in the abstract is not well defined
and may be inappropriate.  This commit removes it and clarifies
that use of vars.pm is discouraged when 'our' could be used
instead.

No perldelta note was added, as the change is trivial, despite
the version number bump.

11 years agocorrect the perlfunc explanation of use vars
Ricardo Signes [Fri, 6 Jul 2012 00:05:04 +0000 (20:05 -0400)]
correct the perlfunc explanation of use vars

11 years agoperlfunc: clarify docs for 'our' [perl #113974]
David Golden [Thu, 5 Jul 2012 23:39:59 +0000 (19:39 -0400)]
perlfunc: clarify docs for 'our' [perl #113974]

In response to the thread, this attempts to clarify the aliasing and
scope of 'our' (as well as 'use vars').

11 years ago[perl #112820] t/op/sprintf.t failure on FreeBSD 4.6
Nicholas Clark [Thu, 5 Jul 2012 21:16:29 +0000 (14:16 -0700)]
[perl #112820] t/op/sprintf.t failure on FreeBSD 4.6

t/op/sprintf.t fails one test on FreeBSD 4.6
*Everything* else passes. This is a pleasant surprise.

Patch adds a skip for FreeBSD 4, and should not skip on FreeBSD 5 and later.
Tested on FreeBSD 7 too. Due to the way versions don't map to real numbers,
4.6 > 4.11, whereas 4.6 <= 4.9 (and 4.9 <= 4.9, 4.10 <= 4.9 and 4.11 <= 4.9)
so the skip skips for all releases of FreeBSD 4.

11 years agoperldelta for 317f3b6
Jesse Luehrs [Thu, 5 Jul 2012 13:54:55 +0000 (08:54 -0500)]
perldelta for 317f3b6

11 years agoIncrease $B::Concise::VERSION to 0.91
Father Chrysostomos [Thu, 5 Jul 2012 01:25:33 +0000 (18:25 -0700)]
Increase $B::Concise::VERSION to 0.91

11 years ago[perl #78064] print(const || bare) and const folding
Father Chrysostomos [Thu, 5 Jul 2012 01:22:09 +0000 (18:22 -0700)]
[perl #78064] print(const || bare) and const folding

Constant folding should not be able to change the meaning of print
followed by || or && or ?: with barewords as operands.

The previous commit recorded which constant ops are the result of con-
stant folding (including collapsing of conditionals).

This commit uses that information (OpCONST_FOLDED) to fix this.

11 years agoRecord folded constants in the op tree
Father Chrysostomos [Tue, 1 May 2012 01:18:03 +0000 (18:18 -0700)]
Record folded constants in the op tree

11 years agoAdd Oleg Nesterov to AUTHORS
Father Chrysostomos [Wed, 4 Jul 2012 15:23:54 +0000 (08:23 -0700)]
Add Oleg Nesterov to AUTHORS

11 years ago[perl #113980] pp_syscall: "I32 retval" truncates the returned value
Oleg Nesterov [Wed, 4 Jul 2012 15:21:15 +0000 (08:21 -0700)]
[perl #113980] pp_syscall: "I32 retval" truncates the returned value

I noticed today that syscall(9, ...) (mmap) doesn't work for me.

The problem is obvious, pp_syscall() uses I32 for retval and the
"long" address doesn't fit into "int".

The one-liner below should fix the problem.

11 years agoUse ‘state’ in warning about sort {state $a}
Father Chrysostomos [Wed, 4 Jul 2012 13:11:27 +0000 (06:11 -0700)]
Use ‘state’ in warning about sort {state $a}

11 years agoop.c: Merge some code
Father Chrysostomos [Wed, 4 Jul 2012 05:21:45 +0000 (22:21 -0700)]
op.c: Merge some code

11 years agoperldelta: move several change notes to Selected Bug Fixes
Tony Cook [Wed, 4 Jul 2012 05:21:27 +0000 (15:21 +1000)]
perldelta: move several change notes to Selected Bug Fixes

They were in Configuration and Compilation

11 years ago[perl #86136] Downgrade sort {my $a} to a warning
Father Chrysostomos [Wed, 4 Jul 2012 04:34:59 +0000 (21:34 -0700)]
[perl #86136] Downgrade sort {my $a} to a warning

The code in toke.c for detecting lexical $a or $b used in a comparison
in a sort block was simply horrible.  If the last-used named list or
unary op (PL_last_lop_op) was sort, then it would scan for <=> or cmp
anywhere on the current line of code.  That meant that, although this
would die:

    my $a; sort { $a <=> $b } ()

This would do the wrong thing without complaint:

    my $a; sort { print; $a <=> $b } ()

And this would die, completely gratuitously:

    my $a; sort @t; $a + $cmp;

Since perl is only guessing that lexical $a or $b *might* have
been used accidentally, this should be a warning, and certainly
not an error.

Also, scanning the source code like that for <=> (even inside a
string!) can never work.  One would have to parse it and examine the
resulting op tree.

In fact, since we *are* parsing it anyway, we *can* examine
the op tree.

So that’s exactly what this commit does.  Based on the existing behav-
iour, but with far fewer false positives, it checks for a cmp or <=>
op as the last statement of a sort block and warns about any operand
that is a lexical $a or $b.

11 years agosv.c: Correct comment
Father Chrysostomos [Tue, 3 Jul 2012 21:50:30 +0000 (14:50 -0700)]
sv.c: Correct comment

S_varname is no longer static.

11 years agofix perlobj SUPER example [perl #113972]
Jesse Luehrs [Wed, 4 Jul 2012 01:28:24 +0000 (20:28 -0500)]
fix perlobj SUPER example [perl #113972]

11 years agoparser.h: Add comments explaining *bufptr
Father Chrysostomos [Tue, 3 Jul 2012 21:00:00 +0000 (14:00 -0700)]
parser.h: Add comments explaining *bufptr

11 years agoparser.h: Correct comment explaining last_lop_op
Father Chrysostomos [Tue, 3 Jul 2012 20:56:42 +0000 (13:56 -0700)]
parser.h: Correct comment explaining last_lop_op

11 years agosv.h: Improve docs of Sv[GS]ETMAGIC
Father Chrysostomos [Tue, 3 Jul 2012 20:55:47 +0000 (13:55 -0700)]
sv.h: Improve docs of Sv[GS]ETMAGIC

11 years agofix compile warnings in malloc.c [perl #75340]
Jesse Luehrs [Tue, 3 Jul 2012 18:06:50 +0000 (13:06 -0500)]
fix compile warnings in malloc.c [perl #75340]