This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perl5.git
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.

12 years agoPerldelta for static XSUBs
Steffen Mueller [Fri, 12 Aug 2011 17:13:09 +0000 (19:13 +0200)]
Perldelta for static XSUBs

12 years agoMake XSUBs static by default
Steffen Mueller [Fri, 12 Aug 2011 15:28:33 +0000 (17:28 +0200)]
Make XSUBs static by default

At the same time, do not include "STATIC" in XSPROTO and
get rid of the XSPROTO_INTERNAL and XSPROTO_EXTERNAL macros
because of that. This allows Devel::PPPort to continue doing
its evil typedef'ing magic using XSPROTO.

12 years agoExlicitly enable exporting of some XSUB symbols
Steffen Mueller [Fri, 12 Aug 2011 15:27:00 +0000 (17:27 +0200)]
Exlicitly enable exporting of some XSUB symbols

These are used in other compilation units. The declarations there
use the XS_EXTERNAL macro to indicate an non-static XSUB that is
taken from another object file.

12 years agoNew XS keyword: EXPORT_XSUB_SYMBOLS
Steffen Mueller [Fri, 12 Aug 2011 15:13:03 +0000 (17:13 +0200)]
New XS keyword: EXPORT_XSUB_SYMBOLS

This can be used to enable/disable the exporting of XSUB symbols.
Technically and at least as far as the documentation change is
concerned, this change goes together with the upcoming change
to XSUB.h to make not exporting the XSUB symbols the default.
It's harmless if a bit useless without that.

In the original plan for making XSUBs "static", there wouldn't have
been a public and easy way to make XSUBs exported from XS code
without resorting to manually redefining macros. But since even in
just the core set of modules, simple things break, I think it's best
to expose this bit of choice.

12 years agoRefactor unpack’s newDEFSVOP logic; correct prototype
Father Chrysostomos [Sun, 21 Aug 2011 08:37:42 +0000 (01:37 -0700)]
Refactor unpack’s newDEFSVOP logic; correct prototype

unpack is the only op that takes an implicit $_ for its second argu-
ment.  (For others it’s the first.)

Instead of special-casing unpack with its own ck_ routine, we can sim-
ply modify the logic in ck_fun to apply OA_DEFGV to the first optional
argument, not just the first argument.

Currently OA_DEFGV is not set in PL_opargs[OP_UNPACK], which means the
automatically-generated prototype is ($;$), instead of ($_).

This commit sets the flag on the op, changes it to use ck_fun
directly, and updates ck_fun and the prototype-generation code accord-
ingly.  I couldn’t put this in multiple commits, as the changes are
interdependent.

12 years agoCorrect test in defins.t
Father Chrysostomos [Sun, 21 Aug 2011 08:26:37 +0000 (01:26 -0700)]
Correct test in defins.t

defined(FILE) does not work.  This test ‘passed’ for me, even when
I broke it.

12 years agoTest unpack with no args
Father Chrysostomos [Sun, 21 Aug 2011 06:49:11 +0000 (23:49 -0700)]
Test unpack with no args

to make sure subsequent commits don’t break things.

12 years ago[perl #96000] Apply standard copyright license statement
Dominic Hargreaves [Sat, 20 Aug 2011 14:44:13 +0000 (15:44 +0100)]
[perl #96000] Apply standard copyright license statement

The original authors have agreed to alter the licensing of these
files, in order to remove a potentially problematic invariant
title clause:

From: Doug MacEachern <dougm@…..com>
To: Jon Orwant <orwant@….com>
Cc: Jesse Vincent <jesse@fsck.com>
Subject: Re: [fwd] [perl #96000] Restrictive licensing term on pod/perlembed.pod, pod/perlmodinstall.pod
Message-ID: <1dc71b53-12e2-45d3-af62-f6d169147921@ox.local>
In-Reply-To: <CAJs5hDaW+k6mf_NBj-6hPyr4rGvkEjhVtXyJ8ziLXyXimcvgHA@mail.gmail.com>

Any license changes to perlembed.pod are fine with me.

Or just revert to the original version of the document: "Look at perlmain.c, and do something like that." ;)

Best,
-Doug

----- Original Message -----
> From: "Jon Orwant" <orwant@….com>
> To: "Jesse Vincent" <jesse@fsck.com>
> Cc: dougm@….com
> Sent: Sunday, July 31, 2011 7:38:49 PM
> Subject: Re: [fwd] [perl #96000] Restrictive licensing term on pod/perlembed.pod, pod/perlmodinstall.pod
>
> Sure, happy to relicense.
>
>
> Jon
>
>
> On Sun, Jul 31, 2011 at 4:03 PM, Jesse Vincent < jesse@fsck.com >
> wrote:
>
>
> Hi Doug & Jon,
>
> I know it's been forever since you last touched the perl core-
>
> It looks like the Debian folks would like us to relax the licensing
> terms on docs that bear your copyrights.
>
> Would you be willing to relicense the contributions you made to the
> two
> documents listed below under the same terms as the rest of Perl?
>
> Thanks!
> Jesse
> --

12 years agoupdate TOC for perl5153delta
Ricardo Signes [Sun, 21 Aug 2011 00:38:03 +0000 (20:38 -0400)]
update TOC for perl5153delta

12 years agocreate perldelta.pod for 5.12.3
Ricardo Signes [Sun, 21 Aug 2011 00:29:58 +0000 (20:29 -0400)]
create perldelta.pod for 5.12.3

12 years agoadd new release to perlhist v5.15.2
Ricardo Signes [Sat, 20 Aug 2011 18:58:36 +0000 (14:58 -0400)]
add new release to perlhist

12 years agoremove boilerplate text from perldelta
Ricardo Signes [Sat, 20 Aug 2011 18:25:58 +0000 (14:25 -0400)]
remove boilerplate text from perldelta

12 years agoupdate perldelta for release;
Ricardo Signes [Sat, 20 Aug 2011 18:11:18 +0000 (14:11 -0400)]
update perldelta for release;

In particular, note the addition of the coreargs opcode in perldelta

We might have no need of this entry in the perl5160 delta, but for
those brave enough to read 5.15.2 delta, it may be of interest.

12 years agoWIP
Ricardo Signes [Sat, 20 Aug 2011 18:57:02 +0000 (14:57 -0400)]
WIP

12 years agoUpdate Module::CoreList for 5.x.y
Ricardo Signes [Sat, 20 Aug 2011 18:56:49 +0000 (14:56 -0400)]
Update Module::CoreList for 5.x.y

12 years agobump version to 5.12.2 using Porting/bump-perl-version
Ricardo Signes [Sat, 20 Aug 2011 18:14:51 +0000 (14:14 -0400)]
bump version to 5.12.2 using Porting/bump-perl-version

12 years ago&CORE::fork()
Father Chrysostomos [Sat, 20 Aug 2011 06:29:53 +0000 (23:29 -0700)]
&CORE::fork()

In commit 7fa5bd9b5, I not only forgot about getpwent (see commit
cc131e4, in which I mistakenly called it pwent), but fork as well.
Again, all this commit has to do is add it to the list of ‘ampable’
functions in gv.c.  The rest already works.

12 years agoAdd OPpASSIGN_CV_TO_GV to B::Concise
Father Chrysostomos [Fri, 19 Aug 2011 20:33:15 +0000 (13:33 -0700)]
Add OPpASSIGN_CV_TO_GV to B::Concise

12 years agoAdd OPpDONT_INIT_GV to B::Concise
Father Chrysostomos [Fri, 19 Aug 2011 20:13:24 +0000 (13:13 -0700)]
Add OPpDONT_INIT_GV to B::Concise

12 years agopp.c:pp_rv2gv: Skip amagic check when vivifying a glob
Father Chrysostomos [Fri, 19 Aug 2011 19:27:03 +0000 (12:27 -0700)]
pp.c:pp_rv2gv: Skip amagic check when vivifying a glob

Commit bb1bc619 eliminated the only case that ‘goto wasref’ is called
with something that might have overloading.  The only ‘goto wasref’
that remains is the autovivifying case, which cannot have any magic
(since the GV has just been created).  So the wasref label can be
moved below the amagic check.

Consider this a picoöptimisation.

12 years ago&CORE::pwent()
Father Chrysostomos [Fri, 19 Aug 2011 13:54:29 +0000 (06:54 -0700)]
&CORE::pwent()

In commit 7fa5bd9b5, I forgot about pwent.  All this commit has
to do is add it to the list of ‘ampable’ functions in gv.c.  The
rest already works.

12 years agoIgnore ExtUtils::Manifest's release tests in the core
Florian Ragwitz [Fri, 19 Aug 2011 12:22:08 +0000 (15:22 +0300)]
Ignore ExtUtils::Manifest's release tests in the core

12 years agoUpgrade ExtUtils::Manifest from version 1.59 to 1.60
Florian Ragwitz [Fri, 19 Aug 2011 12:08:40 +0000 (15:08 +0300)]
Upgrade ExtUtils::Manifest from version 1.59 to 1.60

12 years agoSwap the release suckers for 5.15.3 and 5.15.4
Florian Ragwitz [Fri, 19 Aug 2011 11:14:37 +0000 (14:14 +0300)]
Swap the release suckers for 5.15.3 and 5.15.4

Turns out I mixed things up and would've had to do two releases in one month,
which is probably not a good idea. Stevan was happy to do his release a month
earlier.

12 years agoperldelta for perl #97010
Father Chrysostomos [Thu, 18 Aug 2011 16:20:22 +0000 (09:20 -0700)]
perldelta for perl #97010

12 years ago[perl #97020] Carp (actually caller) leaking memory
Father Chrysostomos [Thu, 18 Aug 2011 15:50:02 +0000 (08:50 -0700)]
[perl #97020] Carp (actually caller) leaking memory

Commit eff7e72c3 (Detect incomplete caller overrides in Carp) used
this little trick for detecting a @DB::args that an overridden
caller() failed to set:

+  @args = \$i; # A sentinal, which no-one else has the address of

But there is a bug in caller().  The first time caller tries to write
to @DB::args, it calls Perl_init_dbargs first.  That function checks
whether @DB::args is AvREAL, in case someone has assigned to it, and
takes appropriate measures.  But caller doesn’t bother calling
Perl_init_dbargs more than once.  So manually-assigned items in
@DB::args would leak, starting with the *second* call to caller.

Commit eff7e72c3 triggered that bug, resulting in a regression in
Carp, in that it started leaking.  eff7e72c3 was backported to 5.12.2
with commit 97705941a4, so in both 5.12 and 5.14 Carp is affected.

This bug (the caller bug, not Carp’s triggering thereof) also affects
any caller overrides that set @DB::args themselves, if there are
alternate calls to the overridden caller and CORE::caller.

This commit fixes that by changing the if (!PL_dbargs) condition
in pp_caller to if (!PL_dbargs || AvREAL(PL_dbargs)).  I.e., if
@args is either uninitialised or AvREAL then call Perl_init_dbargs.
Perl_init_dbargs also has a bug in it, that this fixes: The array not
only needs AvREAL turned off, but also AvREIFY turned on, so that
assignments to it that occur after its initialisation turn AvREAL back
on again.  (In fact, Larry Wall added a comment suggesting this back
in perl 5.000.)

12 years agoUpdate perldiag/&CORE::%s cannot be called directly
Father Chrysostomos [Thu, 18 Aug 2011 15:51:28 +0000 (08:51 -0700)]
Update perldiag/&CORE::%s cannot be called directly

Something I missed in commit d47dcd9c7

12 years agoDocument &CORE::nullary() calls
Father Chrysostomos [Thu, 18 Aug 2011 05:25:39 +0000 (22:25 -0700)]
Document &CORE::nullary() calls

12 years ago&CORE::wantarray()
Father Chrysostomos [Thu, 18 Aug 2011 05:10:30 +0000 (22:10 -0700)]
&CORE::wantarray()

This commit allows &CORE::wantarray to be called via ampersand syntax
or through references.

It adds a new private flag for wantarray, OPpOFFBYONE, which caller\rwill use as well, telling wantarray (or caller) to look one call fur-
ther up the call stack.

12 years ago&CORE::foo() for nullary functions
Father Chrysostomos [Wed, 17 Aug 2011 19:32:33 +0000 (12:32 -0700)]
&CORE::foo() for nullary functions

This commit makes nullary subs in the CORE package callable with
ampersand syntax and through references--except for wantarray, which
is more complicated and will have its own commit.

It does this by creating an op tree like this:

$ ./perl -Ilib -MO=Concise,CORE::times -e 'BEGIN{\&CORE::times}'
CORE::times:
3  <1> leavesub[1 ref] K/REFC,1 ->(end)
-     <@> lineseq K ->3
1        <$> coreargs(IV 310) v ->2
2        <0> tms ->3
-e syntax OK

The coreargs op checks to make sure there are no arguments, for now.
The 310 is the op number for times (OP_TMS).

There is no nextstate op, because we want to inherit hints from
the caller.

The __FILE__, __LINE__ and __PACKAGE__ directives are implemented
like this:

$ ./perl -Ilib -MO=Concise,CORE::__FILE__ -e 'BEGIN{\&CORE::__FILE__}'
CORE::__FILE__:
7  <1> leavesub[1 ref] K/REFC,1 ->(end)
-     <@> lineseq K ->7
1        <$> coreargs(PV "__FILE__") v ->2
6        <2> lslice K/2 ->7
-           <1> ex-list lK ->4
2              <0> pushmark s ->3
3              <$> const(IV 1) s ->4
-           <1> ex-list lK ->6
4              <0> pushmark s ->5
5              <0> caller[t1] l ->6
-e syntax OK

The lslice op and its children are equivalent to (caller)[1].

12 years agoAdd coreargs op
Father Chrysostomos [Wed, 17 Aug 2011 01:02:33 +0000 (18:02 -0700)]
Add coreargs op

&CORE::foo subs will use this operator for sorting out @_.