platform/upstream/perl.git
12 years agoCorrect perldelta entry for fallback entry
Father Chrysostomos [Wed, 23 May 2012 20:42:09 +0000 (13:42 -0700)]
Correct perldelta entry for fallback entry

12 years agoperldelta for PL_amagic_generation removal
Father Chrysostomos [Wed, 23 May 2012 20:17:17 +0000 (13:17 -0700)]
perldelta for PL_amagic_generation removal

12 years agomktables: Handle typo in Unicode 6.1 data file
Karl Williamson [Wed, 23 May 2012 23:14:36 +0000 (17:14 -0600)]
mktables: Handle typo in Unicode 6.1 data file

Unicode has published a correction to their data files for version 6.1.
This patch applies that correction.

12 years agoRevert "Fix mktables bug due to the previous overload fix"
Karl Williamson [Wed, 23 May 2012 23:01:11 +0000 (17:01 -0600)]
Revert "Fix mktables bug due to the previous overload fix"

mktables had unknowingly been relying on a bug in the overloading code.
That bug was fixed by commit f041cf0f9c6469c41de8b73d5f7b426710c3ff8b.
Commit 5f9f83be9cdcd54449f7f40db078fe367d780475 is a minimal commit to
get mktables to pass its tests as a result of the fixed bug.  However,
it did not address the underlying problem, which doesn't show up in the
typical tests, but does occur when tracing is added or things go wrong
and mktables tries to output any of a number of messages, which fail
because there is no ".=" operator.  A previous commit added the proper
overloaded ".=", and so this one is no longer needed, and would be
confusing to someone who doesn't know the history.

12 years agomktables: Add sanity check
Karl Williamson [Thu, 19 Apr 2012 18:25:08 +0000 (12:25 -0600)]
mktables: Add sanity check

Since mktables works only on Unicode code points so far, a range outside
that space is probably erroneous.  Raise a warning

12 years agomktables: Add overloaded .=
Karl Williamson [Mon, 16 Apr 2012 17:32:43 +0000 (11:32 -0600)]
mktables: Add overloaded .=

This was automatically getting generated due to a bug in perl which
ignored fallback=>0, but that has been fixed by commit
f041cf0f9c6469c41de8b73d5f7b426710c3ff8b, so we have to have our own
operator.

12 years agomktables: Add error check
Karl Williamson [Mon, 16 Apr 2012 17:31:50 +0000 (11:31 -0600)]
mktables: Add error check

+= is not a commutative operator, and so the overloaded version should
not accept the parameters being swapped.

12 years agomktables: Add overloaded '+='
Karl Williamson [Mon, 16 Apr 2012 17:28:20 +0000 (11:28 -0600)]
mktables: Add overloaded '+='

This was automatically generated before, in spite of fallback => 0, but
that has now been fixed by commit
f041cf0f9c6469c41de8b73d5f7b426710c3ff8b.  However, that change caused
another overloaded += to be used with the parameters swapped, resulting
in the table generated for Gc=Cs (the surrogates) to be wrong.  This
creates the proper overload.

12 years agopodcheck.t: Try harder to avoid transitory failure
Karl Williamson [Tue, 27 Mar 2012 04:20:59 +0000 (22:20 -0600)]
podcheck.t: Try harder to avoid transitory failure

It may be that a file that looks like a pod is transitory.  podcheck.t
catches and handles some of these, but there are cases where it doesn't
catch these.  This commit adds code to try harder to detect such
instances and recover properly.

I know of two instances in the months since this code has been in
service where this has happened, so it's not a common occurrence, and
re-running it makes the failure go away.  Still, if it can be easily
avoided, do so.

12 years agopodcheck.t: Add label to 'next' stmts for clarity
Karl Williamson [Tue, 27 Mar 2012 04:18:01 +0000 (22:18 -0600)]
podcheck.t: Add label to 'next' stmts for clarity

12 years agoMerge branch 'rgs/overload' into blead
Rafael Garcia-Suarez [Wed, 23 May 2012 13:53:31 +0000 (15:53 +0200)]
Merge branch 'rgs/overload' into blead

12 years ago[perl #113050] Put fallback back under "()"
Father Chrysostomos [Wed, 23 May 2012 08:05:20 +0000 (01:05 -0700)]
[perl #113050] Put fallback back under "()"

Unfortunately, there is code all over CPAN that assumes fallback is
stored under the "()" stash entry.  And that code also assumes that
the overloadedness flag (the existence of the CV) is in the same spot.
So much for encapsulation.

This commit changes overloading itself to use a different key, "((",
while having it search for "()" first, and then "((" only if "()" is
not found, to preserve compatibility with encapsulation-breaking code.

So the "((" key will only be used by gv.c if there is no fallback
value specified at all.

12 years agoIncrease $ExtUtils::ParseXS::Utilities::VERSION to 3.17
Father Chrysostomos [Wed, 23 May 2012 06:54:39 +0000 (23:54 -0700)]
Increase $ExtUtils::ParseXS::Utilities::VERSION to 3.17

12 years agoIncrease $ExtUtils::ParseXS::VERSION to 3.17
Father Chrysostomos [Wed, 23 May 2012 05:46:27 +0000 (22:46 -0700)]
Increase $ExtUtils::ParseXS::VERSION to 3.17

12 years agoParseXS.pm: Only inc PL_amagic_generation before 5.9
Father Chrysostomos [Wed, 23 May 2012 05:46:05 +0000 (22:46 -0700)]
ParseXS.pm: Only inc PL_amagic_generation before 5.9

Originally, overload would not oven be checked for if
amagic_generation was 0, so it was necessary to do
PL_amagic_generation++, in case this was the first class to have over-
loading.  Ever since perl-5.8.0-87-g439cb1c, PL_amagic_generation++
has been unnecessary, since the boot code for version objects incre-
ments it.  Furthermore, newXS was already doing PL_sub_generation++
before that, and now does mro_method_changed_in.  The code for check-
ing the staleness of the overload tables has always checked
sub_generation (and, later, the stash-specific generation numbers).

12 years agoExcise PL_amagic_generation
Father Chrysostomos [Wed, 23 May 2012 05:22:32 +0000 (22:22 -0700)]
Excise PL_amagic_generation

The core is not using it any more.  Every CPAN module that increments
it also does newXS, which triggers mro_method_changed_in, which is
sufficient; so nothing will break.

So, to keep those modules compiling, PL_amagic_generation is now an
alias to PL_na outside the core.

12 years agoop.c: One less func call for newXS
Father Chrysostomos [Wed, 23 May 2012 03:46:52 +0000 (20:46 -0700)]
op.c: One less func call for newXS

newXS calls newXS_flags, which calls newXS_len_flags.  This commit
makes newXS call the underlying function directly.

12 years agoperlfunc: long lines
Father Chrysostomos [Wed, 23 May 2012 03:41:12 +0000 (20:41 -0700)]
perlfunc: long lines

12 years agoAdd Igor Zaytsev to AUTHORS
Father Chrysostomos [Wed, 23 May 2012 03:10:47 +0000 (20:10 -0700)]
Add Igor Zaytsev to AUTHORS

12 years ago[perl #111918] Fix thawing seen objects in STORABLE_attach hook
Igor Zaytsev [Wed, 23 May 2012 01:02:02 +0000 (18:02 -0700)]
[perl #111918] Fix thawing seen objects in STORABLE_attach hook

Before any thaw hook is called Storable creates a new blessed object that
is stored in a seen cache and then is provided to the hook. That is fine
for STORABLE_thaw which fills in this object and returns it. STORABLE_attach
on the other hand can create entirely new object by itself, so one
memoized before should be thrown out to be replaced by that new object.

12 years agoMake CV * typemap entry support overloading
Steffen Mueller [Tue, 22 May 2012 21:04:06 +0000 (23:04 +0200)]
Make CV * typemap entry support overloading

See RT #96872.

12 years agoPurported equivalency isn't.
Eric Brine [Tue, 22 May 2012 19:29:48 +0000 (15:29 -0400)]
Purported equivalency isn't.

12 years agoreplace B::COP::stashflags by B::COP::stashlen
Reini Urban [Tue, 22 May 2012 15:57:03 +0000 (10:57 -0500)]
replace B::COP::stashflags by B::COP::stashlen

6379d4a9a (between 5.15.9 and 5.16.0) broke B::COP::stashflags which was added
in 5.15.4.

12 years agoFix mktables bug due to the previous overload fix
Rafael Garcia-Suarez [Tue, 22 May 2012 15:23:20 +0000 (17:23 +0200)]
Fix mktables bug due to the previous overload fix

Due to the previous patch, perl can't generate the operator for .= in
package Property anymore (because fallback is '0' in that package), so
we need to work around that; this patch implements the least intrusive
workaround possible.

12 years agorefactor macro to avoid compiler warning in regcomp.c
Robin Barker (via RT) [Thu, 1 Mar 2012 15:20:33 +0000 (07:20 -0800)]
refactor macro to avoid compiler warning in regcomp.c

The compiler warning in regcomp.c (as noted in recent comment)
can be avoided by refactoring DO_POSIX_LATIN1_ONLY_KNOWN
to separate the case where sourcelist==l1_sourcelist

The committer changed the name of the new macro so he could understand
it better, and added a couple comments

12 years agoperlebcdic: make verbatim line fit in 79 cols
Karl Williamson [Mon, 21 May 2012 03:45:15 +0000 (21:45 -0600)]
perlebcdic: make verbatim line fit in 79 cols

12 years agoregen/mk_invlists.pl: Fail if inversion list not found
Karl Williamson [Sun, 20 May 2012 22:22:44 +0000 (16:22 -0600)]
regen/mk_invlists.pl: Fail if inversion list not found

This is instead of silently returning nothing.

12 years agoperlebcdic: Narrow table to fit in 79 columns
Karl Williamson [Sun, 20 May 2012 21:52:13 +0000 (15:52 -0600)]
perlebcdic: Narrow table to fit in 79 columns

This uses the abbreviations for control characters available officially
in Unicode 6.1, instead of the much longer names, thus enabling this
table to be narrowed.  With some space changes, it will fit in 79
columns.  The differences look large, but most go away under 'diff -b'.

The recipes are changed to correspond.

12 years agoperlebcdic: Add a few commas for clarity
Karl Williamson [Sun, 20 May 2012 21:50:25 +0000 (15:50 -0600)]
perlebcdic: Add a few commas for clarity

12 years agoperlebcdic: remove trailing white space
Karl Williamson [Sun, 20 May 2012 21:47:32 +0000 (15:47 -0600)]
perlebcdic: remove trailing white space

12 years agoregcomp.c: #define shorter synonym
Karl Williamson [Sun, 20 May 2012 14:55:08 +0000 (08:55 -0600)]
regcomp.c: #define shorter synonym

The longer name is used to discourage XS writers from using this public
defined value, but is unwieldy.  It is clearer to create a shorter
synonym for it.

12 years agohandy.h: New defn of isOCTAL_A() to free up bit
Karl Williamson [Sun, 20 May 2012 13:55:51 +0000 (07:55 -0600)]
handy.h: New defn of isOCTAL_A() to free up bit

The new definition is likely slightly faster, as it replaces an array
lookup with a mask.

Comments are also added, listing the other possible candidates for this
treatment, though the speed differential is unclear as they would also
add an extra test.

A U32 is used to store the information about the various properties for
a character.  This frees up one bit of that for future other use.

12 years agoutf8.c: Add nomix-ASCII option to to_fold functions
Karl Williamson [Sun, 6 May 2012 15:28:01 +0000 (09:28 -0600)]
utf8.c: Add nomix-ASCII option to to_fold functions

Under /iaa regex matching, folds that cross the ASCII/non-ASCII
boundary are prohibited.  This changes _to_uni_fold_flags() and
_to_utf8_fold_flags() functions to take a new flag which, when set,
tells them to not accept such folds.

This allows us to later move the intelligence for handling this
situation to these centralized functions.

12 years agoutf8.c: Add assertion
Karl Williamson [Sun, 6 May 2012 15:12:19 +0000 (09:12 -0600)]
utf8.c: Add assertion

12 years agoregexec.c: Use foldcase instead of lower/upper
Karl Williamson [Sun, 29 Apr 2012 15:33:19 +0000 (09:33 -0600)]
regexec.c: Use foldcase instead of lower/upper

The way Perl deals with folds of ASCII-range characters, is to have an
array that maps to the opposite case character.  For example, fold[a] is
A, and fold[A] is a.  To see if a character matches a pattern character
case-insensitively, you compare it against the pattern character itself,
and if that fails, against the fold[pattern character].

Unfortunately that breaks down outside of ASCII, where the folds are not
necessarily one-to-one.  This code is a vestige of that original
paradim, and I'm converting it to use the more modern.  The apparent
reason it doesn't fail in fold_grind.t is that it is for CURLY nodes,
and CURLY is not currently set on EXACTish nodes unless the node
contains a single UTF-8 invariant character.   Effectively, that means
a character in the ASCII range.

I think parts of this could be simplified further, but I don't
understand the whole context of this code to undertake that.

12 years agoutf8.c: Re-order if branches for speed
Karl Williamson [Sun, 29 Apr 2012 15:26:36 +0000 (09:26 -0600)]
utf8.c: Re-order if branches for speed

Probably the C optimizer does this anyway, but do the uncomplicated test
before the (mutually exclusive) complicated test (though the
complications are hidden in a macro).  The new first test is a
pre-requisite for the new 2nd test anyway.

12 years agoregcomp.c: Wrap long comment to 80 columns
Karl Williamson [Sun, 29 Apr 2012 15:26:06 +0000 (09:26 -0600)]
regcomp.c: Wrap long comment to 80 columns

12 years agopp_pack.c: Use macro instead of its expansion
Karl Williamson [Sun, 29 Apr 2012 01:49:06 +0000 (19:49 -0600)]
pp_pack.c: Use macro instead of its expansion

There is a macro that means this code; use it.

12 years agoregexec.c: Don't allow malformations under EBCDIC
Karl Williamson [Sun, 29 Apr 2012 01:36:53 +0000 (19:36 -0600)]
regexec.c: Don't allow malformations under EBCDIC

Previously, only under EBCDIC, malformed input was allowed here if
warnings are off.  This code probably needs to be rewritten, to do
proper folding, but I am not up to that right now.

12 years agoutf8.c: Add comment
Karl Williamson [Sun, 29 Apr 2012 01:29:04 +0000 (19:29 -0600)]
utf8.c: Add comment

12 years agoutf8n_to_uvuni(): Add a few compiler hints
Karl Williamson [Sun, 29 Apr 2012 01:25:40 +0000 (19:25 -0600)]
utf8n_to_uvuni(): Add a few compiler hints

Tell the compiler that malformed input is not likely, so it can optimize
accordingly.

12 years agopodcheck.t: Allow checking old perldelta
Karl Williamson [Sun, 29 Apr 2012 01:20:24 +0000 (19:20 -0600)]
podcheck.t: Allow checking old perldelta

The test was wrong, causing it to croak when an old perldelta file was
passed explicitly to podcheck.

12 years agoutf8.c: Skip extraneous function call
Karl Williamson [Sun, 29 Apr 2012 00:49:52 +0000 (18:49 -0600)]
utf8.c: Skip extraneous function call

This eliminates an intermediate function call by calling the base level
one directly.

12 years agoutf8.c: Remove unnecessary validation
Karl Williamson [Sun, 29 Apr 2012 00:48:52 +0000 (18:48 -0600)]
utf8.c: Remove unnecessary validation

These two functions are to be called only on strings known to be valid,
so we can skip the validation.

12 years agoutf8.c: Extra branch to avoid others in the typical case
Karl Williamson [Sun, 29 Apr 2012 00:40:40 +0000 (18:40 -0600)]
utf8.c: Extra branch to avoid others in the typical case

This test eliminates all code points less than U+D800 from having to be
checked more than once, at the expense of an extra test for code points
that are larger

12 years agoutf8.h, pp.c: Add UTF8_IS_REPLACEMENT macro, and use it
Karl Williamson [Sun, 29 Apr 2012 00:38:24 +0000 (18:38 -0600)]
utf8.h, pp.c: Add UTF8_IS_REPLACEMENT macro, and use it

This should speed things up slightly, as it looks directly at the UTF-8
source, instead of having to decode it first.

12 years agoutf8.h: Simplify expressions
Karl Williamson [Sun, 29 Apr 2012 00:30:27 +0000 (18:30 -0600)]
utf8.h: Simplify expressions

These expressions, while valid, are overly complicated in order to make
it easy to separate out problematic code points in the future, such as
surrogates.  But we made a decision in 5.12 to not go in that direction,
but to accept such problematic code points in general.  I  haven't
heard any cause to regret that decision; if we ever want to go back, the
blame log will easily allow us to.

12 years agoutf8.h: Comment improvementes, white-space
Karl Williamson [Sun, 29 Apr 2012 00:26:22 +0000 (18:26 -0600)]
utf8.h: Comment improvementes, white-space

12 years agoembed.fnc: Change formal param name to match docs
Karl Williamson [Fri, 23 Mar 2012 02:00:26 +0000 (20:00 -0600)]
embed.fnc: Change formal param name to match docs

This is purely so that perlapi will be accurate in this regard.

12 years agodoio.c: Add some comments
Karl Williamson [Wed, 21 Mar 2012 14:41:44 +0000 (08:41 -0600)]
doio.c: Add some comments

12 years agoperlfunc: Add reference to simple folding docs
Karl Williamson [Wed, 28 Mar 2012 16:53:42 +0000 (10:53 -0600)]
perlfunc: Add reference to simple folding docs

12 years agoExperimentally add VT to \s definition
Karl Williamson [Thu, 29 Mar 2012 01:28:04 +0000 (19:28 -0600)]
Experimentally add VT to \s definition

This commit is the minimal necessary to get \s to match the vertical
tab.  It is being done early in the 5.17 series in order to see what
repercussions there might be from doing this.

It may well be that we decide that this change will require a 'use
feature' to activate.  In any event there is significant documentation
of the behavior without the VT that this patch does not address at all.

Tom Christiansen asked Larry Wall why \s did not include VT, and
reported that Larry replied that he did not remember, but had no
objections to adding it.

12 years agomk_PL_charclass.pl: Don't use \w, \s
Karl Williamson [Thu, 29 Mar 2012 01:23:19 +0000 (19:23 -0600)]
mk_PL_charclass.pl: Don't use \w, \s

Now that these are partially compiled into the Perl core, we have a
chicken and egg problem if one changes.  Instead, use the \p{}
equivalent which doesn't have this problem.

12 years agoSynchronise Module-CoreList in Maintainers.pl with teh CPAN
Chris 'BinGOs' Williams [Tue, 22 May 2012 12:23:38 +0000 (13:23 +0100)]
Synchronise Module-CoreList in Maintainers.pl with teh CPAN

12 years agoLookup overloaded assignment operators when trying to swap the arguments
Rafael Garcia-Suarez [Tue, 20 Mar 2012 08:17:02 +0000 (09:17 +0100)]
Lookup overloaded assignment operators when trying to swap the arguments

This is in the case where we search for an overloaded operator when
passing the AMGf_assign flag (we're executing an assignment operator
like +=).

At the very beginning of Perl_amagic_call, if the flag AMGf_noleft is
not passed, we first try to look up the overload method corresponding
to the assignment operator, then the normal one if fallback is
authorized. However, if this fails, when trying later to find
overload magic with the arguments swapped (if AMGf_noright is not
passed), this procedure was not used and we looked up directly the base
operation from which the assignment operator might be derived.
As a consequence of what an operator like += might have looked
autogenerated even when fallback=>0 was passed.

This change only necessitates a minor adjustment in lib/overload.t,
where an overloaded += method wasn't corresponding semantically to the
overloaded + method of the same class, which can be seen as a
pathological case.

12 years agoClose the filehandle actually being tested in uni/readline.t
Steve Hay [Tue, 22 May 2012 07:37:01 +0000 (08:37 +0100)]
Close the filehandle actually being tested in uni/readline.t
(Also allows the tempfile() to be unlink()ed :-)

12 years agoperldelta for undef *_, &CORE::time crash
Father Chrysostomos [Tue, 22 May 2012 05:53:26 +0000 (22:53 -0700)]
perldelta for undef *_, &CORE::time crash

12 years agoperldelta for while(each %h)
Father Chrysostomos [Tue, 22 May 2012 05:52:11 +0000 (22:52 -0700)]
perldelta for while(each %h)

12 years agoperldelta for pos %foo
Father Chrysostomos [Tue, 22 May 2012 05:50:41 +0000 (22:50 -0700)]
perldelta for pos %foo

12 years agoperldelta for ‘no overload "invalid"’ warnings
Father Chrysostomos [Tue, 22 May 2012 05:49:31 +0000 (22:49 -0700)]
perldelta for ‘no overload "invalid"’ warnings

12 years agoperldelta for overload fallback inheritance
Father Chrysostomos [Tue, 22 May 2012 05:48:29 +0000 (22:48 -0700)]
perldelta for overload fallback inheritance

12 years agoperldelta for overload caching bug fixes
Father Chrysostomos [Tue, 22 May 2012 05:47:24 +0000 (22:47 -0700)]
perldelta for overload caching bug fixes

12 years agoperldelta for changed AMAGIC table mechanism
Father Chrysostomos [Tue, 22 May 2012 05:44:35 +0000 (22:44 -0700)]
perldelta for changed AMAGIC table mechanism

12 years agoperldelta for File::stat’s -p
Father Chrysostomos [Tue, 22 May 2012 05:36:55 +0000 (22:36 -0700)]
perldelta for File::stat’s -p

12 years agoperldelta for vec w/2GB offsets
Father Chrysostomos [Tue, 22 May 2012 05:32:17 +0000 (22:32 -0700)]
perldelta for vec w/2GB offsets

12 years agoperldelta for File::stat -r warning
Father Chrysostomos [Tue, 22 May 2012 05:30:31 +0000 (22:30 -0700)]
perldelta for File::stat -r warning

12 years agoperldelta for method{}
Father Chrysostomos [Tue, 22 May 2012 05:24:00 +0000 (22:24 -0700)]
perldelta for method{}

12 years agoperldelta for CORE:: and TARG
Father Chrysostomos [Tue, 22 May 2012 05:20:41 +0000 (22:20 -0700)]
perldelta for CORE:: and TARG

12 years agoperldelta for undef *^H non-ambiguity
Father Chrysostomos [Tue, 22 May 2012 05:15:33 +0000 (22:15 -0700)]
perldelta for undef *^H non-ambiguity

12 years agoperldelta for Hash::Util changes
Father Chrysostomos [Tue, 22 May 2012 05:12:24 +0000 (22:12 -0700)]
perldelta for Hash::Util changes

12 years agoperldelta for modding $_[0] in STORABLE_freeze
Father Chrysostomos [Tue, 22 May 2012 05:02:20 +0000 (22:02 -0700)]
perldelta for modding $_[0] in STORABLE_freeze

12 years agoperldelta for setting $^N
Father Chrysostomos [Tue, 22 May 2012 05:01:02 +0000 (22:01 -0700)]
perldelta for setting $^N

12 years agoperldelta for copying call checkers to closures
Father Chrysostomos [Tue, 22 May 2012 04:59:31 +0000 (21:59 -0700)]
perldelta for copying call checkers to closures

12 years agoperldelta for hvstore and %^H
Father Chrysostomos [Tue, 22 May 2012 04:57:11 +0000 (21:57 -0700)]
perldelta for hvstore and %^H

12 years agoperldelta for goto "\0"
Father Chrysostomos [Tue, 22 May 2012 04:55:36 +0000 (21:55 -0700)]
perldelta for goto "\0"

12 years agoperldelta for goto ""
Father Chrysostomos [Tue, 22 May 2012 04:52:16 +0000 (21:52 -0700)]
perldelta for goto ""

12 years agoIncrease $Pod::Functions::VERSION to 1.06
Father Chrysostomos [Tue, 22 May 2012 03:42:26 +0000 (20:42 -0700)]
Increase $Pod::Functions::VERSION to 1.06

The previous commit modified Pod::Functions by modifying perlfunc.pod,
but we have things set up in such a way that cmp_version.t won’t
see it.

12 years agoRemove double space from Pod::Functions descr
Father Chrysostomos [Tue, 22 May 2012 03:41:14 +0000 (20:41 -0700)]
Remove double space from Pod::Functions descr

12 years agoConsistent spaces after dots in CORE.pod
Father Chrysostomos [Tue, 15 May 2012 22:01:53 +0000 (15:01 -0700)]
Consistent spaces after dots in CORE.pod

12 years agoop.c: Remove redundant assignment
Father Chrysostomos [Sun, 13 May 2012 06:10:58 +0000 (23:10 -0700)]
op.c: Remove redundant assignment

This was added unnecessarily in commit ddeae0f14c.  It is a local
variable assigned to just before the function returns, so the value
is never used in the OP_UNDEF case.

12 years agoDon’t crash with &CORE::foo after undefining *_
Father Chrysostomos [Sun, 13 May 2012 01:43:13 +0000 (18:43 -0700)]
Don’t crash with &CORE::foo after undefining *_

When a sub is called with & and no parentheses, no @_ is set up.  This
means the sub call sees the existing @_.  It also means that, if *_
has been undefined, there is no @_.

pp_coreargs was not accounting for this, and was doing
AvARRAY(GvAV(PL_defgv)) without checking that GvAV(PL_defgv) was non-
null.  It crashed as a result.

12 years agoTest that ‘require v5’ ignores sub named v5
Father Chrysostomos [Sat, 12 May 2012 03:27:46 +0000 (20:27 -0700)]
Test that ‘require v5’ ignores sub named v5

This is something I broke in my first (unapplied) attempt to clean up
require’s parsing madness.

12 years agoMake while(each ...) imply defined($_ = ...)
Father Chrysostomos [Sat, 12 May 2012 03:13:01 +0000 (20:13 -0700)]
Make while(each ...) imply defined($_ = ...)

This came up in ticket #108286.

Quoting Nicholas Clark:
>
>     while (<STDIN>)
>     while (<*>)
>
> These both always implicitly assigned to $_, always implicitly
> added defined.
>
>     while ($_ = <STDIN>)
>     while ($a = <STDIN>)
>     while ($_ = <*>)
>     while ($a = <*>)
>     while ($_ = readdir D)
>     while ($a = readdir D)
>     while ($_ = each %h)
>     while ($a = each %h)
>
> The implicit defined added was by commit 4b161ae29769b4a3,
> //depot/maint-5.004/perl@949
>
>
> BUT:
>
>     while (readdir D)
>
> The implicit assignment to $_ and defined test were both added in
> *2009* (by commit 114c60ecb1f7)
>
>
> leaving:
>
>     while (each %h)
>
>
> So it is the odd one out. And in 2009 we felt comfortable to add
> both the implicit assignment and the defined test in blead for
> readdir, as a bug fix, and have had no reports of it caus-
> ing problems.

[He asked:]
> > > So that's a bug?

[And I responded:]
> > That's what I was trying to ask. :-)
>
> OK, after a quite a bit of deliberation and digging, I'm of the opinion that
>
> 1: yes, it's a bug

...

> So, there's only one use of while(each %...) on CPAN outside of
> debugging or test code, and that's only go the potential to break
> due to assignment now happening to to $_. Compared with 29 matches
> for while\s*\(\s*readdir of which 4 are .pm files. So
>
> 2: I think it's safe to fix it, just like readdir was fixed.

Just *as* readdir was fixed! :-)

12 years agooverride.t: Remove obsolete comment
Father Chrysostomos [Thu, 3 May 2012 16:12:03 +0000 (09:12 -0700)]
override.t: Remove obsolete comment

12 years agorequire_errors.t: Test <> error
Father Chrysostomos [Thu, 3 May 2012 03:37:12 +0000 (20:37 -0700)]
require_errors.t: Test <> error

12 years agoAllow require_errors.t to be run from the top level
Father Chrysostomos [Thu, 3 May 2012 03:36:20 +0000 (20:36 -0700)]
Allow require_errors.t to be run from the top level

12 years agoRemove OPpCONST_WARNING from B::Concise
Father Chrysostomos [Tue, 1 May 2012 01:04:23 +0000 (18:04 -0700)]
Remove OPpCONST_WARNING from B::Concise

12 years agoRemove OPpCONST_WARNING
Father Chrysostomos [Tue, 1 May 2012 00:46:48 +0000 (17:46 -0700)]
Remove OPpCONST_WARNING

This was added to op.h in commit 599cee73:

commit 599cee73f2261c5e09cde7ceba3f9a896989e117
Author: Paul Marquess <paul.marquess@btinternet.com>
Date:   Wed Jul 29 10:28:45 1998 +0100

    lexical warnings; tweaks to places that didn't apply correctly
     Message-Id: <9807290828.AA26286@claudius.bfsec.bt.co.uk>
     Subject: lexical warnings patch for 5.005_50

    p4raw-id: //depot/perl@1773

dump.c was modified to dump in, in this commit:

commit bf91b999b25fa75a3ef7a327742929592a2e7e9c
Author: Simon Cozens <simon@netthink.co.uk>
Date:   Sun May 13 21:20:36 2001 +0100

    Op private flags
    Message-ID: <20010513202036.A21896@netthink.co.uk>

    p4raw-id: //depot/perl@10117

But is apparently completely unused anywhere.  And I want that bit.

12 years agocoreamp.t: rename badly-named tests
Father Chrysostomos [Mon, 30 Apr 2012 04:16:51 +0000 (21:16 -0700)]
coreamp.t: rename badly-named tests

12 years agoop.c:ck_glob: Don’t do gv_fetchpv("CORE::GLOBAL::glob")
Father Chrysostomos [Sun, 29 Apr 2012 18:11:15 +0000 (11:11 -0700)]
op.c:ck_glob: Don’t do gv_fetchpv("CORE::GLOBAL::glob")

We have PL_globalstash precisely to avoid the nested stash lookup in
cases like these.

12 years agoop.c: Remove a redundant ck_subr call from ck_require
Father Chrysostomos [Sun, 29 Apr 2012 06:46:03 +0000 (23:46 -0700)]
op.c: Remove a redundant ck_subr call from ck_require

newUNOP(OP_ENTERSUB, ...) already calls ck_subr, so wrapping it in
ck_subr(...) is unnecessary and wasteful of precious CPU time.

12 years agoop.c: Remove a redundant ck_subr call from ck_glob
Father Chrysostomos [Sun, 29 Apr 2012 06:45:37 +0000 (23:45 -0700)]
op.c: Remove a redundant ck_subr call from ck_glob

newUNOP(OP_ENTERSUB, ...) already calls ck_subr, so calling ck_subr on
its return value is unnecessary and wasteful of precious CPU time.

12 years agoop.c: Remove a redundant ck_subr call from dofile
Father Chrysostomos [Sun, 29 Apr 2012 06:43:42 +0000 (23:43 -0700)]
op.c: Remove a redundant ck_subr call from dofile

newUNOP(OP_ENTERSUB, ...) already calls ck_subr, so wrapping it in
ck_subr(...) is unnecessary and wasteful of precious CPU time.

12 years agoop.c:ck_glob: Check PL_globhook before loading File::Glob
Father Chrysostomos [Sun, 29 Apr 2012 04:27:40 +0000 (21:27 -0700)]
op.c:ck_glob: Check PL_globhook before loading File::Glob

By loading File::Glob when there is no CORE::GLOBAL::glob, we just end
up calling Perl_load_module for every glob op, since File::Glob no
longer uses CORE::GLOBAL::glob by default.

We could just as well check whether PL_globhook is set, which would
be faster.

(File::Glob sets PL_globhook when it loads.  In 5.14, it didn’t
set anything, but ck_glob itself would set CORE::GLOBAL::glob to
File::Glob::csh_glob.)

12 years agoTest <> ovrld with glob override
Father Chrysostomos [Sat, 28 Apr 2012 07:16:25 +0000 (00:16 -0700)]
Test <> ovrld with glob override

While doing a PL_glob_index experiment on a branch, I almost screwed
up the stack for those cases where glob is overridden and there is
iterator overloading.  The tests passed anyway, meaning we need
more tests.

12 years agocproto.t: Add tests for BEGIN, etc.
Father Chrysostomos [Sun, 22 Apr 2012 01:55:38 +0000 (18:55 -0700)]
cproto.t: Add tests for BEGIN, etc.

12 years agoMake cproto.t more stringent
Father Chrysostomos [Sun, 22 Apr 2012 01:30:35 +0000 (18:30 -0700)]
Make cproto.t more stringent

It was allowing prototype() to return undef where an empty string
was expected.

12 years agoMake pos(@array) and pos(%hash) into errors
Father Chrysostomos [Sat, 12 May 2012 20:03:54 +0000 (13:03 -0700)]
Make pos(@array) and pos(%hash) into errors

Currently pos has an effective prototype of (;\[$@%*]), and what it
does is rather interesting.

First, it produces a strange uninitialized warning:

$ ./perl -Ilib -we 'pos my @a = 3'
Use of uninitialized value within @a in scalar assignment at -e line 1.

There is no uninitialized value here.  The value ‘within @a’ is actu-
ally @a itself.  The code that produces the error message was written
under the (perfectly logical) assumption that an array would never be
passed to report_uninit().

Secondly, it adds pos magic to the array itself:

$ ./perl -Ilib -e 'pos @a = 3; use Devel::Peek; Dump \@a'
SV = IV(0x8039fc) at 0x803a00
  REFCNT = 1
  FLAGS = (TEMP,ROK)
  RV = 0x825b90
  SV = PVAV(0x804a04) at 0x825b90
    REFCNT = 2
    FLAGS = (SMG)
    MAGIC = 0x30cb20
      MG_VIRTUAL = &PL_vtbl_mglob
      MG_TYPE = PERL_MAGIC_regex_global(g)
    ARRAY = 0x0
    FILL = -1
    MAX = -1
    ARYLEN = 0x0
    FLAGS = (REAL)

This magic can never be used, as @a =~ /foo/g is equivalent to
scalar(@a) =~ /foo/g, and scalar(@a) returns a scalar containing the
length of the array, not the array itself.

This seems clearly a mistake.

pos forces lvalue context on its argument, making pos(3) a compile-
time error.

Internally, the main distinction between \$ (scalar lvalue) and
\[$@%*] (scalar lvalue, or some other type) prototypes is that the
function S_scalar_mod_type returns true for functions with the former,
but false for functions with the latter.  (Tangentially, \[$@%*] and
\[$@%&*] are distinguished by the special-casing in op_lvalue_flags
under case OP_ENTERSUB.)

S_scalar_mod_type returns false for pos.  I think it should return
true.  That is what this commit does, resulting in consistency
with read():

$ ./perl -Ilib -we 'read($1, @2, $3)'
Can't modify array dereference in read at -e line 1, near "$3)
"
Execution of -e aborted due to compilation errors.
$ ./perl -Ilib -we 'pos(@2)'
Can't modify array dereference in match position at -e line 1, near "@2)
"
Execution of -e aborted due to compilation errors.

Except when it comes to globs, since read refuses *foo for its second
argument, but pos(*foo) has always Just Worked, so there is no reason
to forbid it.

So, now, pos has an effective prototype of (;\[$*]).

12 years ago[perl #112692] perlfunc: waitpid takes two args
Eric Brine [Tue, 22 May 2012 03:23:29 +0000 (20:23 -0700)]
[perl #112692] perlfunc: waitpid takes two args

12 years ago[Merge] Update overload caches properly
Father Chrysostomos [Tue, 22 May 2012 01:12:02 +0000 (18:12 -0700)]
[Merge] Update overload caches properly

This branch causes overload caches to update properly, instead of
remaining stale till the next ‘bless’.  Overloading also applies now
to objects that were created before a class had overloading, if over-
loading is added to a class at run time.

In the process of doing this, I fixed a few other bugs:
•  Overloaded classes can now inherit fallback.
• ‘no overload’ warns about invalid arguments.
•  use overload '+' => 'method::name' now supports double colons in
   the method name.  This is a regression from 5.003.  Apostrophes
   never stopped working, though.

The changes to the way overloading worked allowed me to simplify
things significantly and delete of lot of code, including eliminat-
ing type ‘A’ magic, for which overloading itself is named throughout
the source!