platform/upstream/perl.git
12 years ago[perl #92376] Change - to : in time template
Father Chrysostomos [Thu, 25 Aug 2011 21:46:55 +0000 (14:46 -0700)]
[perl #92376] Change - to : in time template

12 years ago&CORE::foo() for @ and $@ prototypes, except unlink
Father Chrysostomos [Thu, 25 Aug 2011 21:33:03 +0000 (14:33 -0700)]
&CORE::foo() for @ and $@ prototypes, except unlink

This commit allows the CORE subroutines for functions with @
and $@ prototypes to be called through references and via amper-
sand syntax.

unlink is not included in this commit, as it requires special casing
due to its use of implicit $_.

Since these functions require a pushmark, and since it has to come
between two things that pp_coreargs does, it’s easiest to flag the
coreargs op (with the OPpCOREARGS_PUSHMARK flag added in the previous
commit) and call pp_pushmark directly from pp_coreargs.

12 years agoAdd OPpCOREARGS_PUSHMARK flag
Father Chrysostomos [Mon, 22 Aug 2011 00:27:58 +0000 (17:27 -0700)]
Add OPpCOREARGS_PUSHMARK flag

This will be used to tell pp_coreargs when it needs to call
pp_pushmark.

For those functions that need a pushmark, it has to come between
two things that pp_coreargs does; so the easiest way is to use
this flag.

12 years ago&CORE::caller()
Father Chrysostomos [Sun, 21 Aug 2011 18:59:44 +0000 (11:59 -0700)]
&CORE::caller()

This commit allows &CORE::caller to be called through references and
via ampersand syntax.  pp_caller is modified to take into account
two things:
1) pp_coreargs pushes a null on to the stack, since it has no other
   way to tell caller whether it has an argument.
2) The value coming from pp_coreargs (when not null) is off by
   one.  The OPpOFFYBONE flag was added in commit 93f0bc4935 for
   this purpose.

pp_coreargs is also modified, since it assumed till now that an
optional first argument was an implicit $_.

12 years ago&CORE::bless()
Father Chrysostomos [Sun, 21 Aug 2011 17:57:34 +0000 (10:57 -0700)]
&CORE::bless()

This commit allows &CORE::bless to be called through references and
via ampersand syntax.  pp_bless is modified to take into account the
nulls pushed on to the stack in pp_coreargs, since pp_coreargs has no
other way to tell bless how many arguments it’s actually getting.

12 years ago&CORE::binmode()
Father Chrysostomos [Thu, 25 Aug 2011 19:43:54 +0000 (12:43 -0700)]
&CORE::binmode()

This commit allows &CORE::binmode to be called through references and
via ampersand syntax.

Usually, an op that has optional arguments has the number of arguments
indicated with flags on the op itself:

12 years ago[perl #93320] localising @DB::args leads to coredump
Father Chrysostomos [Thu, 25 Aug 2011 19:38:15 +0000 (12:38 -0700)]
[perl #93320] localising @DB::args leads to coredump

This script, from the RT ticket, crashes:

#!/usr/bin/perl
sub cl{
    package DB;
    @DB::args = ();
    return caller(shift);
}

sub f{
    local @DB::args;
    my @z = cl($_) for (1..3);
}

f(1,2,3); f(1,2,3);
__END__

PL_dbargs is not refcounted, and it’s not set until pp_caller first
tries to write to it.  If that happens when @DB::args is localised,
then the array will be freed on scope exit, leaving PL_dbargs pointing
to a freed SV.

This crash can be reproduced more simply this way:

sub {
  package DB;
  ()=caller(0);
  undef *DB::args;
  ()=caller(0);
}->();

So, basically, pp_caller has to re-fetch PL_dbargs from the %DB::
stash each time it sets it.  It cannot rely on the cached value.

(So now I’m wondering whether we even need PL_dbargs.)

12 years agoAllow ampersand calls for CORE subs with $*$$**$ protos
Father Chrysostomos [Thu, 25 Aug 2011 16:50:02 +0000 (09:50 -0700)]
Allow ampersand calls for CORE subs with $*$$**$ protos

This enables ampersand calls and calls through references for CORE
subs that have * and $ in their prototypes and a fixed number of
arguments.

Usually, the *-prototyped ops have their child ops wrapped in rv2gv’s
(*{}) implicitly.  The rv2gv op is sometimes flagged as an autoviv-
ificatory op, such as the first argument to accept() or open().
S_is_handle_constructor contains the list of ops that turn on
that flag.

This commit makes the coreargs op use a couple of flags to serve the
same purpose.  pp_coreargs itself calls S_rv2gv (split out from
pp_rv2gv recently for precisely this purpose) with arguments based on
its own flags.

Currently the autovivified glob gets a name like main::_GEN_0 instead
of main::$a.  I think we can live with that.

12 years agoAdd private coreargs flags for vivifying GVs
Father Chrysostomos [Sat, 20 Aug 2011 06:04:04 +0000 (23:04 -0700)]
Add private coreargs flags for vivifying GVs

12 years agoMove most of pp_rv2gv into a static function
Father Chrysostomos [Sat, 20 Aug 2011 01:11:23 +0000 (18:11 -0700)]
Move most of pp_rv2gv into a static function

This allows the glob-deref logic to be use by other functions in pp.c,
like pp_coreargs.

12 years agoAdd Frederic Briere to AUTHORS
Father Chrysostomos [Thu, 25 Aug 2011 16:36:29 +0000 (09:36 -0700)]
Add Frederic Briere to AUTHORS

12 years agoAttribute::Handlers: "my" should be "till"
Frederic Briere [Thu, 25 Aug 2011 16:35:26 +0000 (09:35 -0700)]
Attribute::Handlers: "my" should be "till"

12 years agoAttribute::Handlers: correct spelling
Father Chrysostomos [Thu, 25 Aug 2011 16:33:48 +0000 (09:33 -0700)]
Attribute::Handlers: correct spelling

12 years agoDumper.xs: Suppress compiler warning
Father Chrysostomos [Thu, 25 Aug 2011 16:25:21 +0000 (09:25 -0700)]
Dumper.xs: Suppress compiler warning

12 years agocoresubs.t: Minor clean-up
Father Chrysostomos [Thu, 25 Aug 2011 15:43:22 +0000 (08:43 -0700)]
coresubs.t: Minor clean-up

This fixes some infelicities in the new tests I added to this
file recently.

12 years agoInvert the list of &-able functions in gv.c
Father Chrysostomos [Fri, 19 Aug 2011 17:57:41 +0000 (10:57 -0700)]
Invert the list of &-able functions in gv.c

The list of those that do not support &CORE::foo() syntax is now
shorter than the list of those that do.  In subsequent commits
it will get even shorter.

12 years agoMake sure coresubs.t tests all &-able funcs
Father Chrysostomos [Thu, 25 Aug 2011 15:34:15 +0000 (08:34 -0700)]
Make sure coresubs.t tests all &-able funcs

12 years agoreplace old bookmarks.cpan link with www.perl.org and learn.perl.org
Leo Lapworth [Thu, 25 Aug 2011 10:08:23 +0000 (11:08 +0100)]
replace old bookmarks.cpan link with perl.org and learn.perl.org

12 years agoMerge the refactored makedef.pl into blead.
Nicholas Clark [Thu, 25 Aug 2011 10:06:53 +0000 (12:06 +0200)]
Merge the refactored makedef.pl into blead.

This eliminates global.sym

12 years agoNote the demise of global.sym in perldelta.
Nicholas Clark [Thu, 25 Aug 2011 10:04:23 +0000 (12:04 +0200)]
Note the demise of global.sym in perldelta.

12 years agoIn embed.pl, inline walk_table() into its only caller.
Nicholas Clark [Sun, 21 Aug 2011 15:50:26 +0000 (17:50 +0200)]
In embed.pl, inline walk_table() into its only caller.

12 years agoEliminate global.sym, as makedef.pl can generate it internally.
Nicholas Clark [Sun, 21 Aug 2011 15:37:41 +0000 (17:37 +0200)]
Eliminate global.sym, as makedef.pl can generate it internally.

global.sym was a file listing the exported symbols, generated by regen/embed.pl
from embed.fnc and regen/opcodes, which was only used by makedef.pl

Move the code that generates global.sym from regen/embed.pl to makedef.pl,
and thereby eliminate the need to ship a 907 line generated file.

12 years agoAdd regen/embed_lib.pl, for the code that processes embed.fnc and regen/opcodes
Nicholas Clark [Sun, 21 Aug 2011 14:48:51 +0000 (16:48 +0200)]
Add regen/embed_lib.pl, for the code that processes embed.fnc and regen/opcodes

Move setup_embed() and the helper functions add_level() and current_group()
to it from regen/embed.pl

12 years agoIn embed.pl, move processing embed.fnc and regen/opcodes into a function.
Nicholas Clark [Sun, 21 Aug 2011 14:27:15 +0000 (16:27 +0200)]
In embed.pl, move processing embed.fnc and regen/opcodes into a function.

12 years agoIn embed.pl, refactor the handling of varargs *_nocontext wrappers.
Nicholas Clark [Sun, 21 Aug 2011 13:47:56 +0000 (15:47 +0200)]
In embed.pl, refactor the handling of varargs *_nocontext wrappers.

This is what commit 125218eb5a6d12e7 should have been. :-)

12 years agoIn makedef.pl, move handling of $ARGS{TARG_DIR} to the open statements.
Nicholas Clark [Sun, 21 Aug 2011 12:58:21 +0000 (14:58 +0200)]
In makedef.pl, move handling of $ARGS{TARG_DIR} to the open statements.

This simplifies the code, and eliminates 5 lexicals used solely to hold
filename constants.

12 years agoIn makedef.pl, defaulting $ARGS{TARG_DIR} to '' simplifies the code.
Nicholas Clark [Sun, 21 Aug 2011 12:30:14 +0000 (14:30 +0200)]
In makedef.pl, defaulting $ARGS{TARG_DIR} to '' simplifies the code.

12 years agoTest the TARG_DIR argument to makedef.pl too.
Nicholas Clark [Sun, 21 Aug 2011 12:06:33 +0000 (14:06 +0200)]
Test the TARG_DIR argument to makedef.pl too.

12 years agoIn makedef.pl, no need to store 'config.h' in a variable.
Nicholas Clark [Sun, 21 Aug 2011 11:40:33 +0000 (13:40 +0200)]
In makedef.pl, no need to store 'config.h' in a variable.

Unlike the other files opened by makedef.pl, config.h is always opened in the
current directory, so the filename doesn't modifying if $ARGS{TARG_DIR} is set.

12 years agoIn embed.pl, simplify the code that parses regen/opcodes.
Nicholas Clark [Sun, 21 Aug 2011 11:29:26 +0000 (13:29 +0200)]
In embed.pl, simplify the code that parses regen/opcodes.

As @embed is sorted later, the order that we add entries to it doesn't matter.
Hence add them immediately, avoiding the need to iterate over the "seen" hash.

12 years agoembed.pl was relying on embed.fnc starting with a pre-processor directive.
Nicholas Clark [Sun, 21 Aug 2011 11:09:46 +0000 (13:09 +0200)]
embed.pl was relying on embed.fnc starting with a pre-processor directive.

Fix this subtle bug, and add comments.

12 years agoExtUtils::ParseXS: Accept overridden input typemaps
Steffen Mueller [Thu, 25 Aug 2011 06:19:40 +0000 (08:19 +0200)]
ExtUtils::ParseXS: Accept overridden input typemaps

This restores the ability to have code like this:

ret_type*
foo(bar, baz)
    int bar
    ThereIsNoTypemapForThisType* baz = somefunc($arg);
  CODE:
  ...

Looks strange and indeed, it is. But it's documented in perlxs
to work, so we can't get away with breaking it. The heuristics
for determining whether to allow this use case is checking for
ST\( or \$arg being found in the initialization. That should take
care of all valid use of this feature and still die horribly in
cases where this is used by mistake (instead of a PREINIT block, etc).

12 years agoExtUtils::ParseXS: Explicitly require current version of submodules
Steffen Mueller [Sun, 21 Aug 2011 20:07:50 +0000 (22:07 +0200)]
ExtUtils::ParseXS: Explicitly require current version of submodules

Since there have been certain problems with parts of ExtUtils::ParseXS
being shadowed by older installations of the module, this commit adds
an explicit $VERSION to all submodules and requires them to have the
same version as the main module. This doesn't actually fix any problem,
but makes them more apparent as early as possible instead of failing
with obscure compile errors when bad C is generated from the original
XS.

12 years agoperldelat update
Father Chrysostomos [Thu, 25 Aug 2011 07:23:48 +0000 (00:23 -0700)]
perldelat update

12 years agoperldelta: Move an entry under Testing
Father Chrysostomos [Thu, 25 Aug 2011 06:55:46 +0000 (23:55 -0700)]
perldelta: Move an entry under Testing

12 years agoEnable ampersand calls to CORE subs with $$$ prototypes
Father Chrysostomos [Fri, 19 Aug 2011 15:27:14 +0000 (08:27 -0700)]
Enable ampersand calls to CORE subs with $$$ prototypes

This applies to functions that just take plain scalar arguments, all
of which are mandatory.  Functions that take optional arguments are
not supported yet. truncate() is not supported yet, either (its $$
prototype is not entirely veracious).

This commit enables those functions to be called via &CORE::foo() syn-
tax or through references.

You can now encrypt a string like this: "string"->CORE::crypt($salt).

Each function’s op tree is like this:

$ ./perl -Ilib -MO=Concise,CORE::atan2 -e 'BEGIN{\&CORE::atan2}'
CORE::atan2:
3  <1> leavesub[1 ref] K/REFC,1 ->(end)
2     <@> atan2[t1] sK ->3
-        <0> ex-pushmark s ->1
1        <$> coreargs(IV 100) s ->2
-e syntax OK

This commit adds code to ck_fun to skip the argument check if
coresubs is present.  Otherwise we get a ‘Not enough arguments for
atan2’ error.

12 years agoSimplify the CORE::__FOO__ op-generation code
Father Chrysostomos [Fri, 19 Aug 2011 05:19:25 +0000 (22:19 -0700)]
Simplify the CORE::__FOO__ op-generation code

It just happens that the (caller)[...] offsets for file and line are
the same as the keyword numbers.  KEY___PACKAGE__ is 3 and (caller)[0]
returns the package, so keyword_number % 3 can be used for the offset
instead of an unwieldy switch block.

12 years agoMove coresub op-creation from gv.c to op.c
Father Chrysostomos [Fri, 19 Aug 2011 05:09:17 +0000 (22:09 -0700)]
Move coresub op-creation from gv.c to op.c

For functions that take handles as arguments, this code will need to
call static functions in op.c, like is_handle_constructor.

While we could make is_handle_constructor into a non-static function
and call it from gv.c, that seems backwards, as it would result in a
lot of op-manipulation code in the middle of gv.c.

So this commit creates a new function in op.c, called coresub_op,
which is only called from gv.c, from the &CORE::sub code.

12 years agoAllow ampersand calls to CORE subs with (_) proto
Father Chrysostomos [Thu, 25 Aug 2011 06:31:28 +0000 (23:31 -0700)]
Allow ampersand calls to CORE subs with (_) proto

This commit adds all subs with a (_) prototype to the list of those
that can be called with ampersand syntax or through references.  These
have bodies like this:

$ ./perl -Ilib -MO=Concise,CORE::abs -e 'BEGIN{\&CORE::abs}'
CORE::abs:
3  <1> leavesub[1 ref] K/REFC,1 ->(end)
2     <1> abs[t1] sK/1 ->3
1        <$> coreargs(IV 111) s ->2
-e syntax OK

coreargs fetches the caller’s $_ if there are no arguments passed.

12 years agoAdd find_rundefsv2 function
Father Chrysostomos [Thu, 18 Aug 2011 22:55:59 +0000 (15:55 -0700)]
Add find_rundefsv2 function

Subs in the CORE package with a (_) prototype will use this.

This accepts a CV and a sequence number, so that one can
use it to find the $_ in the caller’s scope.  It only uses
the topmost call of a subroutine that is being called recur-
sively, so it’s not really a general-purpose function.  But
it suffices for &CORE::abs and friends.

12 years agoTest CORE::break’s prototype (just that this time)
Father Chrysostomos [Thu, 25 Aug 2011 05:39:28 +0000 (22:39 -0700)]
Test CORE::break’s prototype (just that this time)

12 years agoMove making inplace sort and reverse away from the peephole optimiser to scalarvoid.
Gerard Goossen [Tue, 16 Aug 2011 07:22:14 +0000 (09:22 +0200)]
Move making inplace sort and reverse away from the peephole optimiser to scalarvoid.

Why: The in place assignment is not just an optimisation but has
significant different behaviour and thus doesn't belong in the
peephole optimiser.  Also the optree changes are unified and simpler.

12 years agoRevert "Test CORE::break’s prototype"
Father Chrysostomos [Thu, 25 Aug 2011 06:15:17 +0000 (23:15 -0700)]
Revert "Test CORE::break’s prototype"

This reverts commit e52d58aa5bea245b66786b4c9029e849a2be69d3.

I don’t quite know how I managed it, but I really screw up
this time!  Two completely unrelated commits ended up getting
merged into one, so, to avoid confusion down the road, I’m
reverting it, only to reapply it shortly....

12 years ago&CORE::break
Father Chrysostomos [Thu, 25 Aug 2011 05:48:26 +0000 (22:48 -0700)]
&CORE::break

This is another nullary function that I forgot to give a body
to make it callable via &break syntax.

12 years agoTest CORE::break’s prototype
Father Chrysostomos [Thu, 25 Aug 2011 05:39:28 +0000 (22:39 -0700)]
Test CORE::break’s prototype

12 years ago[perl #71154] undef &$coderef consistency
Father Chrysostomos [Thu, 25 Aug 2011 05:16:07 +0000 (22:16 -0700)]
[perl #71154] undef &$coderef consistency

$ perl -le' undef &{$x=sub{}}; $x->()'
Not a CODE reference at -e line 1.

undeffing an anonymous subroutine used to turn the ANON flag off,
causing it to bypass the condition apparently written for this situa-
tion in pp_entersub.

This commit stops cv_undef from turning off that flag, so now we get:

$ ./perl -le' undef &{$x=sub{}}; $x->()'
Undefined subroutine called at -e line 1.

12 years agoTrim dead code in do_kv.
Eric Brine [Thu, 25 Aug 2011 03:10:43 +0000 (20:10 -0700)]
Trim dead code in do_kv.

A small piece of code in do_kv has three bugs:

- TARG could have been returned as an lvalue, so its refcount
  could be greater than 1, resulting in data getting clobbered.
  (See RT#20933 for previously fixed occurrence of this bug).

- LvTARG is refcounted, so it's buggy to just NULL it.

- TARG is returned without being initialised.

The first two bugs disappeared recently when we stopped putting
the lvalues in TARG for that op. The third remains.

However, it seems that code is never called. It can only be
called by putting NULL (not undef) on the Perl stack. I don't
see how that's possible here. The test suite never reaches that
code, so it seems it's just dead code.

12 years agoRemove nvi (site no loger works) and put vim above Vile
Leo Lapworth [Wed, 24 Aug 2011 13:26:55 +0000 (14:26 +0100)]
Remove nvi (site no loger works) and put vim above Vile

12 years agoRemove Elvis editor as link broken
Leo Lapworth [Wed, 24 Aug 2011 13:24:21 +0000 (14:24 +0100)]
Remove Elvis editor as link broken

12 years agoFix broken link
Leo Lapworth [Wed, 24 Aug 2011 13:22:49 +0000 (14:22 +0100)]
Fix broken link

12 years agoRemove a2ps as link does not work and even gnu.org uses the same link
Leo Lapworth [Wed, 24 Aug 2011 13:18:21 +0000 (14:18 +0100)]
Remove a2ps as link does not work and even gnu.org uses the same link

12 years agoMake $class->method work when $class is tied
Father Chrysostomos [Thu, 25 Aug 2011 01:04:26 +0000 (18:04 -0700)]
Make $class->method work when $class is tied

This little script:

sub TIESCALAR{bless[]}
sub FETCH{warn "fetching"; "main"}
sub bolgy { warn 'bolgy' }
tie my $a, "";
$a->bolgy;

Gives these outputs with various versions of perl:

$ pbpaste|perl5.6.2
fetching at - line 2.
fetching at - line 2.
bolgy at - line 3.

$ pbpaste|perl5.8.8
fetching at - line 2.
fetching at - line 2.
fetching at - line 2.
Can't call method "bolgy" without a package or object reference at - line 5.

$ pbpaste|perl5.8.9
fetching at - line 2.
fetching at - line 2.
fetching at - line 2.
fetching at - line 2.
bolgy at - line 3.

$ pbpaste|perl5.10.0
fetching at - line 2.
fetching at - line 2.
fetching at - line 2.
fetching at - line 2.
Can't call method "bolgy" without a package or object reference at - line 5.

$ pbpaste|perl5.10.1 # also 5.12.x
fetching at - line 2.
fetching at - line 2.
fetching at - line 2.
fetching at - line 2.
bolgy at - line 3.

$ pbpaste|perl5.14.0
fetching at - line 2.
fetching at - line 2.
fetching at - line 2.
fetching at - line 2.
fetching at - line 2.
fetching at - line 2.
Can't locate object method "bolgy" via package "main" (perhaps you forgot to load "main"?) at - line 5.

It’s worse than ever in 5.14.

What’s happening is that S_method_common is hanging on to the pointer
returned by SvPV, while continuing to call get-magic again and again.
 So the pointer becomes invalid.  I think it’s only by accident that
it worked in some versions.

This commit stops S_method_common from calling get-magic so many
times, solving both problems.

I’m afraid this conflicts with ongoing work to make method lookup
UTF8-clean, but I wanted to make a patch that could be backported.

12 years agogmagic.t: Correct two test names
Father Chrysostomos [Wed, 24 Aug 2011 21:33:31 +0000 (14:33 -0700)]
gmagic.t: Correct two test names

12 years agoUn-todo gmagic.t tests that now pass
Father Chrysostomos [Wed, 24 Aug 2011 21:28:45 +0000 (14:28 -0700)]
Un-todo gmagic.t tests that now pass

12 years ago[perl #97088] Prevent double get-magic in various cases
Gerard Goossen [Wed, 24 Aug 2011 21:26:51 +0000 (14:26 -0700)]
[perl #97088] Prevent double get-magic in various cases

This patch prevents get-magic from executing twice during autovivifi-
cation when the op doing the autovivification is not directly nested
inside the dereferencing op.

This can happen in cases like this:

    ${ (), $a } = 1;

Previously (as of 5.13.something), the outer op was marked with the
OPpDEREFed flag, which indicated that get-magic had already been
called by the vivifying op (calling get-magic during vivification is
inevitable):

$ perl5.14.0 -MO=Concise -e '${ $a } = 1'
8  <@> leave[1 ref] vKP/REFC ->(end)
1     <0> enter ->2
2     <;> nextstate(main 2 -e:1) v:{ ->3
7     <2> sassign vKS/2 ->8
3        <$> const[IV 1] s ->4
6        <1> rv2sv sKRM*/DREFed,1 ->7          <-- right here
-           <@> scope sK ->6
-              <0> ex-nextstate v ->4
5              <1> rv2sv sKM/DREFSV,1 ->6
4                 <#> gv[*a] s ->5
-e syntax OK

But in the ${()...} example above, there is a list op in the way that
prevents the flag from being set inside the peephole optimizer.  It’s
not even possible to set it correctly in all cases, as in this exam-
ple, which would need it both set and not set depending on which
branch of the ternary operator is executed:

    ${ $x ? delete $a[0] : $a[0] } = 1

Instead of setting the OPpDEREFed flag, we now make a non-magic copy
of the SV in vivify_ref (the first time get-magic is executed).

12 years agoAdd tests for autovivication combined with get-magic, some of which are TODO.
Gerard Goossen [Wed, 24 Aug 2011 11:39:55 +0000 (13:39 +0200)]
Add tests for autovivication combined with get-magic, some of which are TODO.

12 years agoAdd missing files from Archive::Extract 0.56
Father Chrysostomos [Wed, 24 Aug 2011 18:10:22 +0000 (11:10 -0700)]
Add missing files from Archive::Extract 0.56

12 years agoFor microperl, prefix generateuudmap and the 3 generated headers with u.
Nicholas Clark [Tue, 23 Aug 2011 12:10:58 +0000 (14:10 +0200)]
For microperl, prefix generateuudmap and the 3 generated headers with u.

Without this, the main Makefile and Makefile.micro interfere with each other,
as they both generate the same 5 files, and both think that they can delete
them with their respective clean targets.

12 years agoGroup 3 headers as $(generated_headers) in microperl's Makefile.
Nicholas Clark [Tue, 23 Aug 2011 11:47:59 +0000 (13:47 +0200)]
Group 3 headers as $(generated_headers) in microperl's Makefile.

Commit 9387abf86b0530ac missed this.

12 years agoCall get-magic once for defined ${...}
Father Chrysostomos [Wed, 24 Aug 2011 01:15:48 +0000 (18:15 -0700)]
Call get-magic once for defined ${...}

This example:

sub TIESCALAR { bless[]}
sub FETCH { warn "fetching"; "\cTAINT" }
tie my $a, "";
defined $$a;

prints ‘fetching’ three times in 5.8.8, five times (!) in 5.10-12,
four times in 5.14, and three times in blead as of ed996e63f6.  Now it
only happens once.

It was commit 7a5fd60d4c that increased the number of fetches in 5.10,
but I haven’t checked which commits reduced it in 5.14.

12 years agoSVTYPEMASK must be cast to (svtype) when comparing to SvTYPE()
Chip Salzenberg [Tue, 23 Aug 2011 23:51:28 +0000 (16:51 -0700)]
SVTYPEMASK must be cast to (svtype) when comparing to SvTYPE()

12 years agoStop readline($foo) from autovivifying
Father Chrysostomos [Tue, 23 Aug 2011 21:54:34 +0000 (14:54 -0700)]
Stop readline($foo) from autovivifying

Currently <$foo> does not autovivify, but readline($foo) does, due to
the way pp_readline calls pp_rv2gv directly, with PL_op still holding
a pp_readline op, whose flags may have completely different meanings.

readline uses the OPf_SPECIAL flag to distinguish <$foo> from readline
($foo).  rv2gv uses it to determine whether to autovivify; hence the
discrepancy.

12 years agoclose($undef) should not croak_no_modify
Father Chrysostomos [Tue, 23 Aug 2011 21:36:46 +0000 (14:36 -0700)]
close($undef) should not croak_no_modify

Commit ac53db4c3f7e fixed bug #31767 (open $1 not dying), but put the
SvREADONLY check in the wrong spot, causing this bug:

$ perl -lwe 'no warnings "once"; close $x; close $+'
Name "main::x" used only once: possible typo at -e line 1.
Use of uninitialized value $x in ref-to-glob cast at -e line 1.
Modification of a read-only value attempted at -e line 1.

It shouldn’t be dying if I’m not trying to modifying it.

12 years agoCall get-magic once for implicit rv2gv in close(), etc.
Father Chrysostomos [Tue, 23 Aug 2011 21:10:49 +0000 (14:10 -0700)]
Call get-magic once for implicit rv2gv in close(), etc.

This commit stops an implicit rv2gv from calling get-magic twice.  As
a side-effect, it also squelches the duplicate warning emitted by
‘close undef’ (bug #97482).

is_gv_magical_sv is modified not to call get-magic on the sv passed to
it.  It is not in the public API, and the only two callers (rv2gv and
softrefxv) have already called get-magic before calling it.

12 years agoUpdate Archive-Extract to CPAN version 0.56
Chris 'BinGOs' Williams [Tue, 23 Aug 2011 19:03:52 +0000 (20:03 +0100)]
Update Archive-Extract to CPAN version 0.56

  [DELTA]

  Changes for 0.56    Tue Aug 23 15:55:52 2011
  ============================================
  * Amend the MSWin32 fixes for 'unzip' to
    work with Cygwin-based tools too.

12 years agoUpgrade Pod::Simple from version 3.18 to 3.19
Florian Ragwitz [Tue, 23 Aug 2011 16:35:58 +0000 (18:35 +0200)]
Upgrade Pod::Simple from version 3.18 to 3.19

12 years agoSo much for ‘correcting’ a test!
Father Chrysostomos [Tue, 23 Aug 2011 16:43:29 +0000 (09:43 -0700)]
So much for ‘correcting’ a test!

I forgot to change it back to test a built-in symbol.

12 years agoreaddir.t: Remove erroneous comments; correct test
Father Chrysostomos [Tue, 23 Aug 2011 16:32:41 +0000 (09:32 -0700)]
readdir.t: Remove erroneous comments; correct test

In commit 99fc7eca4 I wrote some erroneous comments and modified a
test such that it no longer tested what I was supposed to test.

I did not realise that the bug only affected globs for built-in varia-
bles, specifically those that pop into existence when looked at:

$ perl5.10.1 -e '$x = "y"; readdir $x'
Bad symbol for dirhandle at -e line 1.
$ perl5.10.1 -e '$x = "."; readdir $x'
Bus error

In commit 99fc7eca4, I actually removed the ultimate cause of the bug,
restoring the 5.8.x behaviour of not dying with ‘Bad symbol’, because
there *is* a symbol, even if it’s not a valid handle.

This commit removes the erroneous comments and makes the test less
sensitive to output, since it’s just supposed to be testing that no
crash happens.

12 years agoRemove null checks from pp_rv2gv
Father Chrysostomos [Tue, 23 Aug 2011 16:21:41 +0000 (09:21 -0700)]
Remove null checks from pp_rv2gv

sv can no longer be null at these points, as of commit 99fc7eca4,
which fixed buggy code that 7a5fd60d4 added (which resulted in
various interesting bugs and workarounds over the past few years.)

12 years agoRun regen/uconfig_h.pl as part of the regen and regen_headers targets.
Nicholas Clark [Tue, 23 Aug 2011 14:08:55 +0000 (16:08 +0200)]
Run regen/uconfig_h.pl as part of the regen and regen_headers targets.

regen/uconfig_h.pl can't be run (by default) by regen.pl, as regen.pl needs
to be cross-platform, whilst regen/uconfig_h.pl relies on having a Bourne
Shell. However, if one has managed to extract Makefile from Makefile.SH,
that's clear proof that one has a working Bourne Shell available :-)

12 years agoAdd t/porting/globvar.t, to sanity test globvar.sym on a *nix platform.
Nicholas Clark [Fri, 19 Aug 2011 10:15:38 +0000 (12:15 +0200)]
Add t/porting/globvar.t, to sanity test globvar.sym on a *nix platform.

This adds to makedef.pl a new platform, "test".

Hopefully this change will catch most problems that previously had resulted
in build failures on Win32.

12 years agoHandle PL_sh_path better in globvar.sym and makedef.pl
Nicholas Clark [Fri, 19 Aug 2011 10:12:16 +0000 (12:12 +0200)]
Handle PL_sh_path better in globvar.sym and makedef.pl

PL_sh_path needs some form of special case because it is conditionally
defined either in perlvar.h or perl.h, but globvar.sym mentions all symbols
unconditionally, and undef -DPERL_GLOBAL_STRUCT perlvar.h is parsed as an
unconditional skip list.

12 years agoGroup 3 headers as $(generated_headers) in the *nix, VMS and Win32 makefiles.
Nicholas Clark [Fri, 19 Aug 2011 19:04:50 +0000 (21:04 +0200)]
Group 3 headers as $(generated_headers) in the *nix, VMS and Win32 makefiles.

uudmap.h bitcount.h mg_data.h are all generated by generate_uudmap, and all
need to be deleted as part of the clean targets, so it makes sense to
reference all 3 together using a single makefile macro.

12 years agoperlfunc: List all prototypes for lstat
Father Chrysostomos [Tue, 23 Aug 2011 07:25:57 +0000 (00:25 -0700)]
perlfunc: List all prototypes for lstat

12 years agoStrip S<> formatting codes from diagnostics output
Matthew Horsfall (alh) [Tue, 23 Aug 2011 01:26:26 +0000 (21:26 -0400)]
Strip S<> formatting codes from diagnostics output

Update spacing

Don't break S<20 questions> across lines, update test to be accurate

12 years ago[perl #95530] BigRat int(-1/2) == 0
Father Chrysostomos [Mon, 22 Aug 2011 20:43:59 +0000 (13:43 -0700)]
[perl #95530] BigRat int(-1/2) == 0

Math::BigRat was trying to copy the sign of a BigRat object into a
BigInt object when converting to an integer, but without taking into
account that the number might be rounded toward zero.  This resulted
in a 0 BigInt with a negative sign, which is not actually a valid
BigInt object, as it does not support negative zero.

12 years agoSync Module-CoreList version in Maintainers.pl with version on CPAN
Chris 'BinGOs' Williams [Mon, 22 Aug 2011 19:47:29 +0000 (20:47 +0100)]
Sync Module-CoreList version in Maintainers.pl with version on CPAN

12 years agoOnly list non-static undocumented funcs in perlintern
Father Chrysostomos [Mon, 22 Aug 2011 16:42:32 +0000 (09:42 -0700)]
Only list non-static undocumented funcs in perlintern

12 years agoRevise perlintern’s descr of undocumented funcs
Father Chrysostomos [Mon, 22 Aug 2011 16:33:00 +0000 (09:33 -0700)]
Revise perlintern’s descr of undocumented funcs

12 years agoperlfaq: remove 1 link; correct another
Father Chrysostomos [Mon, 22 Aug 2011 15:38:27 +0000 (08:38 -0700)]
perlfaq: remove 1 link; correct another

A link from the document to itself is not useful.
C<perldoc> should be L<perldoc>.

12 years agoAdd quick note to perlfaq main page about searching the perlfaq
Matthew Horsfall [Mon, 1 Aug 2011 00:18:57 +0000 (20:18 -0400)]
Add quick note to perlfaq main page about searching the perlfaq

12 years agoUpdate Archive-Extract to CPAN version 0.54
Chris 'BinGOs' Williams [Mon, 22 Aug 2011 12:45:56 +0000 (13:45 +0100)]
Update Archive-Extract to CPAN version 0.54

  [DELTA]

  Changes for 0.54    Mon Aug 22 11:52:18 2011
  ============================================
  * Resolve issues on MSWin32 when 'unzip' is
    found in PATH

12 years agoRemove user-defined casing feature
Karl Williamson [Sun, 21 Aug 2011 17:49:28 +0000 (11:49 -0600)]
Remove user-defined casing feature

This feature was deprecated in 5.14 and scheduled to remove in 5.16.  A
CPAN module was written to provide better functionality without the
significant drawbacks of this implementation.

12 years agoskip a test that requires Cwd under miniperl
Tony Cook [Mon, 22 Aug 2011 14:16:42 +0000 (00:16 +1000)]
skip a test that requires Cwd under miniperl

12 years agoskip the defined *+ and *- tests on miniperl
Tony Cook [Mon, 22 Aug 2011 13:44:19 +0000 (23:44 +1000)]
skip the defined *+ and *- tests on miniperl

using either attempts to load Tie::Hash::NamedCapture which may not be
available in miniperl.

12 years agoFix Configure's csym test for gcc's link time optimisation
H.Merijn Brand [Mon, 22 Aug 2011 13:41:26 +0000 (15:41 +0200)]
Fix Configure's csym test for gcc's link time optimisation

This introduces a volatile into the test program so gcc cannot optimise
out the symbol itself as being unused.

12 years agoboot_Win32CORE needs to be XS_EXTERNAL() following commit ab1478f7146843f7.
Nicholas Clark [Mon, 22 Aug 2011 04:38:32 +0000 (06:38 +0200)]
boot_Win32CORE needs to be XS_EXTERNAL() following commit ab1478f7146843f7.

Win32CORE.c is shipped as a C file, not built by ExtUtils::ParseXS, so needs
to be manually updated to reflect the change of default in XSUB.h

12 years agoAdd tests for defined(*builtin)
Father Chrysostomos [Mon, 22 Aug 2011 05:51:56 +0000 (22:51 -0700)]
Add tests for defined(*builtin)

This commit tests that GVs containing built-in variables that are usu-
ally created lazily pop into existence when looked at, as the fact
they didn’t exist is something we want to hide.

12 years agoMake rv2gv return autovivified magic GVs
Father Chrysostomos [Mon, 22 Aug 2011 05:14:55 +0000 (22:14 -0700)]
Make rv2gv return autovivified magic GVs

There is special code in pp_rv2gv to deal with the case of built-in
variables that are created on the fly.  It basically pretends that
they have always existed, even in rvalue context.

Normally, defined(*{"foo"}) will not actually create the *foo glob,
but will simply return false.  defined(*{">"}), however is supposed
to return true because of the $> variable; its popping into existing
when looked at being an implementation detail.  That is the whole pur-
pose of is_gv_magical_sv in gv.c.

Prior to this commit, however, defined(*{">"}) would autovivify the
GV, but then return *false*!

It was simply a matter of faulty logic in this part of pp_rv2gv:

SV * const temp = MUTABLE_SV(gv_fetchsv(sv, 0, SVt_PVGV));
if (!temp
    && (!is_gv_magical_sv(sv,0)
|| !(sv = MUTABLE_SV(gv_fetchsv(sv, GV_ADD,
SVt_PVGV))))) {
    RETSETUNDEF;
}
sv = temp;

The autovivification happens in the second gv_fetchsv call.  But after
the new GV is assigned to sv and the condition proves false, we reach
the sv = temp assignment which clobbers it.

12 years agoMake defined(${'$'}) return true
Father Chrysostomos [Mon, 22 Aug 2011 03:43:21 +0000 (20:43 -0700)]
Make defined(${'$'}) return true

Commit 0e219455 made $$ into a magical variable that is not created
on startup.

Usually perl pretends that built-in vars created on the fly have
always existed.  But commit 0e219455 did not add $$ to the list of
such variables in is_gv_magical_sv.  So defined ${'$'} started return-
ing false.

12 years agoRemove obsolete paragraph from perlintern/is_gv_magical_sv
Father Chrysostomos [Mon, 22 Aug 2011 03:21:11 +0000 (20:21 -0700)]
Remove obsolete paragraph from perlintern/is_gv_magical_sv

This paragraph, added in 2004 by commit b9b0e72c, was made obsolete in
2008 by commit 9d8f40c4.

12 years agoAdd tests for unlink
Father Chrysostomos [Mon, 22 Aug 2011 03:09:44 +0000 (20:09 -0700)]
Add tests for unlink

12 years agoMake unlink with implicit $_ work once more
Father Chrysostomos [Mon, 22 Aug 2011 02:58:43 +0000 (19:58 -0700)]
Make unlink with implicit $_ work once more

I broke this with commit ea5703f4.  unlink is the only op that has the
OA_DEFGV flag and no scalar or file arguments.

Commit ea5703f4 changed the OA_DEFGV logic in ck_fun to generate a
new $_ op for the first optional parameter, instead of just the first
parameter, to avoid special-casing unpack.  But lists are not marked
with OA_OPTIONAL.  So this commit changes it to check for list parame-
ters as well.

12 years agoMention the 5.14 and 5.15 tracks.
Abigail [Sun, 21 Aug 2011 21:57:37 +0000 (23:57 +0200)]
Mention the 5.14 and 5.15 tracks.

This was done for other previous tracks as well.

12 years agoChangelog/version bump for ExtUtils::ParseXS
Steffen Mueller [Sun, 21 Aug 2011 11:35:43 +0000 (13:35 +0200)]
Changelog/version bump for ExtUtils::ParseXS

Upgrade version in Maintainers.pl.

12 years agoMake sure to strip trailing semicolons from inputmap
Steffen Mueller [Sun, 21 Aug 2011 11:35:14 +0000 (13:35 +0200)]
Make sure to strip trailing semicolons from inputmap

If we don't get that right, there may be additional semicolons in
the output C code. Those will be interpreted as empty statements
which is a problem for strict/old compilers which require strict
separation of declarations and other code.

Reported by Torsten Schoenfeld, diagnosed by Thorsten and Jan Dubois.

12 years agoFix C++ build following commit ab1478f7146843f7.
Nicholas Clark [Sun, 21 Aug 2011 12:55:28 +0000 (14:55 +0200)]
Fix C++ build following commit ab1478f7146843f7.

For C++, ab1478f7146843f7 inadvertently defined XS_INTERNAL as
    extern "C" static ...
which C++ compilers rightfully choke on.

12 years agoBump $ExtUtils::ParseXS::VERSION following commit 948e998797279292.
Nicholas Clark [Sun, 21 Aug 2011 12:37:22 +0000 (14:37 +0200)]
Bump $ExtUtils::ParseXS::VERSION following commit 948e998797279292.

12 years agoadd the 5.15.2 epigraph
Ricardo Signes [Sun, 21 Aug 2011 11:43:21 +0000 (07:43 -0400)]
add the 5.15.2 epigraph

12 years agoMake the use of XS_EXTERNAL fall back to XS
Steffen Mueller [Thu, 18 Aug 2011 11:20:35 +0000 (13:20 +0200)]
Make the use of XS_EXTERNAL fall back to XS

If XSUB.h/perl doesn't define the new XS_EXTERNAL macro that we
use for emitting non-static XSUBs for the boot functions, we have
XS_EXTERNAL just fall back to the standard XS macro.