This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perl5.git
7 years agoUpdate an old email address of mine
Abigail [Sat, 14 Jan 2017 21:28:50 +0000 (22:28 +0100)]
Update an old email address of mine

7 years agoString bitwise operators will not accept code points > 0xFF in 5.28
Abigail [Sat, 14 Jan 2017 21:13:54 +0000 (22:13 +0100)]
String bitwise operators will not accept code points > 0xFF in 5.28

7 years agoReading/writing bytes from :utf8 handles will be fatal in 5.30
Abigail [Sat, 14 Jan 2017 20:44:56 +0000 (21:44 +0100)]
Reading/writing bytes from :utf8 handles will be fatal in 5.30

7 years agoDeprecating the modifyable variables in constants by 5.32.
Abigail [Sat, 14 Jan 2017 17:25:48 +0000 (18:25 +0100)]
Deprecating the modifyable variables in constants by 5.32.

It was already deprecated, but we're now adding a version number.

7 years agoMake it fatal to pass malformed UTF-8.
Abigail [Sat, 14 Jan 2017 03:01:39 +0000 (04:01 +0100)]
Make it fatal to pass malformed UTF-8.

Due to a bug in either Perl, or in some XS-code, it's possible
for a string which is supposed to be in UTF-8 format to not be
properly encoded. If you try to find out its type (digit,
punctuation) perl will now croak.

This behaviour was deprecated in Perl 5.18.

7 years agomy() in a false conditional will be fatal in Perl 5.30
Abigail [Sat, 14 Jan 2017 01:30:49 +0000 (02:30 +0100)]
my() in a false conditional will be fatal in Perl 5.30

7 years agoDeprecation of an unqualified dump() to mean CORE::dump().
Abigail [Fri, 13 Jan 2017 21:36:47 +0000 (22:36 +0100)]
Deprecation of an unqualified dump() to mean CORE::dump().

This will no longer be allowed in 5.30.

7 years agoDeprecating the use of C<< \cI<X> >> to specify a printable character.
Abigail [Fri, 13 Jan 2017 19:29:58 +0000 (20:29 +0100)]
Deprecating the use of C<< \cI<X> >> to specify a printable character.

Starting in 5.14, we deprecated the use of "\cI<X>" when this
results in a printable character. For instance, "\c:" is just
a fancy way of writing "z". Starting in 5.28, this will be a
fatal error.

This also includes certain usage in regular expressions with the
experimental (?[ ]) construct, or when "use re 'strict'" is in
effect (also experimental).

7 years agoB::OP::terse will go away in Perl 5.28.
Abigail [Thu, 24 Nov 2016 14:35:43 +0000 (15:35 +0100)]
B::OP::terse will go away in Perl 5.28.

Adjusted the deprecation message, and bumped the version of B::Terse.

7 years agoNo longer mention some uses of $SIG {__DIE__} are deprecated.
Abigail [Thu, 24 Nov 2016 12:57:23 +0000 (13:57 +0100)]
No longer mention some uses of $SIG {__DIE__} are deprecated.

The C<$SIG{__DIE__}> hook is called even inside an C<eval()>. It was
never intended to happen this way, but an implementation glitch made
this possible. This used to be deprecated, as it allowed strange action
at a distance like rewriting a pending exception in C<$@>. Plans to
rectify this have been scrapped, as users found that rewriting a
pending exception is actually a useful feature, and not a bug.

7 years agoRemove utils/c2ph and utils/pstruct
Abigail [Thu, 24 Nov 2016 12:22:10 +0000 (13:22 +0100)]
Remove utils/c2ph and utils/pstruct

These programs are the same, just behave differently depending on
under which name you call it.

This is a very old script, originally dating from the perl3 era.
It has been deprecated in favour of h2xs for a long time.

In Perl 5.26, these utilities will no longer be available.

7 years agoDon't recognize the --libpods option in Pod::Html
Abigail [Thu, 24 Nov 2016 11:40:04 +0000 (12:40 +0100)]
Don't recognize the --libpods option in Pod::Html

Since Perl 5.18, the --libpods option has been recognized, but
did not do anything other than issue a deprecation warnings.
As of now, using the --libpods option creates an error.

The version number of Pod::Html has bumped to 1.2202.

7 years agoRemove unneeded entry from pod/perldiag.pod
Abigail [Thu, 24 Nov 2016 00:11:01 +0000 (01:11 +0100)]
Remove unneeded entry from pod/perldiag.pod

It had an entry 'Use of %s is deprecated', matching the warnings
the deprecation() macro in handy.h could generate.

Most of these warning had already their own entries in perldiag.pod,
and the ones which did not, now do. Furthermore, the format of the
warnings has changed, as we now have a version in which the construct
disappears from Perl in the message.

7 years agoUse of inherited AUTOLOAD for non-methods will be fatal in 5.28.
Abigail [Wed, 23 Nov 2016 23:50:09 +0000 (00:50 +0100)]
Use of inherited AUTOLOAD for non-methods will be fatal in 5.28.

Which will be 21 years after it was deprecated (5.004).

7 years agoRemove the deprecate() macro from handy.h.
Abigail [Wed, 23 Nov 2016 22:03:13 +0000 (23:03 +0100)]
Remove the deprecate() macro from handy.h.

Since we now require each deprecation message to come with a
version in which the feature will disappear, and we have reworked
the existing uses of this macro, there doesn't seem to be a need
for this one anymore.

7 years agoJumping into constructs will be fatal in 5.28.
Abigail [Wed, 23 Nov 2016 21:52:36 +0000 (22:52 +0100)]
Jumping into constructs will be fatal in 5.28.

7 years agoUse of comma-less variable lists is deprecated.
Abigail [Wed, 23 Nov 2016 18:38:15 +0000 (19:38 +0100)]
Use of comma-less variable lists is deprecated.

It will be fatal by Perl 5.28.

7 years agoUse of Unicode code points exceeding IV_MAX will be fatal in Perl 5.28
Abigail [Wed, 23 Nov 2016 18:06:51 +0000 (19:06 +0100)]
Use of Unicode code points exceeding IV_MAX will be fatal in Perl 5.28

Changed the warning to reflect the deadline of this deprecation.
Update tests, perldiag.pod and added a section to perldeprecation.pod.

7 years agoUnescaped left braces in regular expressions will be fatal in 5.30.
Abigail [Mon, 21 Nov 2016 21:38:32 +0000 (22:38 +0100)]
Unescaped left braces in regular expressions will be fatal in 5.30.

In 5.26, some uses of unescaped left braces were made fatal; they have
given a deprecation warning since 5.20. Due to an oversight, some cases
were missed, and did not give a deprecation warning. They do now.

This patch changes said deprecation warning to mention the Perl version
in which the use of an unescaped left brace will be fatal (5.30).

The patch also cleans up some unnecessary quotes inside a C<> construct
in the discussion of this warning in perldiag.pod.

7 years agoBare heredocs will be fatal in 5.28.
Abigail [Fri, 18 Nov 2016 17:33:19 +0000 (18:33 +0100)]
Bare heredocs will be fatal in 5.28.

Heredocs without a terminator after the << have been deprecated
since 5.000. After more than 2 decades, it's time to retire this
construct. They will be fatal in 5.28.

7 years agoUse of \N{} will be fatal in 5.28.
Abigail [Fri, 18 Nov 2016 16:41:44 +0000 (17:41 +0100)]
Use of \N{} will be fatal in 5.28.

Use of \N{} in a double quoted context, with nothing between the
braces, was deprecated in 5.24, and it will be a fatal error in 5.28.

7 years agoReformat overlong comment.
Abigail [Fri, 18 Nov 2016 13:56:56 +0000 (14:56 +0100)]
Reformat overlong comment.

pod/perlhack.pod says to try hard not to exceed 79 columns.

7 years ago$/ = \-1 will be fatal in Perl 5.28.
Abigail [Fri, 18 Nov 2016 13:52:18 +0000 (14:52 +0100)]
$/ = \-1 will be fatal in Perl 5.28.

Setting $/ to a reference of a non-positive integer has been deprecated
since 5.20, in which it was special cased to act like you had set to
$/ to undef.

In Perl 5.28, setting $/ to a reference to a non-positive integer will
be a fatal error.

7 years agoOpening a file and dir using the same symbol will be fatal in 5.28.
Abigail [Thu, 17 Nov 2016 18:34:37 +0000 (19:34 +0100)]
Opening a file and dir using the same symbol will be fatal in 5.28.

Perl 5.10 deprecated using the same symbol to open both a filehandle
and a dirhandle, as this can lead to confusing code.

In Pelr 5.28, this will become a fatal error. This patch changes the
warning to reflect this.

7 years agoFix mentioning of C<$#>.
Abigail [Wed, 16 Nov 2016 23:38:38 +0000 (00:38 +0100)]
Fix mentioning of C<$#>.

A copy and past left a C<$*> instead of a C<$#>.

Pointed out by douglas steinwand.

7 years agoSetting ${^ENCODE} will be fatal by 5.28.
Abigail [Wed, 16 Nov 2016 18:07:32 +0000 (19:07 +0100)]
Setting ${^ENCODE} will be fatal by 5.28.

Hence, we adapted the warning, to mention the version in which it
will become a fatal error.

7 years agoBe consistent when addressing Perl.
Abigail [Tue, 15 Nov 2016 23:20:31 +0000 (00:20 +0100)]
Be consistent when addressing Perl.

In perldeprecation.pod, when referring to a particular perl version,
use "Perl 5.XX" (or "Perl 5.00X" for pre-5.6 versions) consistently.

7 years agoRemove deprecation warnings related to $* and $#.
Abigail [Tue, 15 Nov 2016 22:51:53 +0000 (23:51 +0100)]
Remove deprecation warnings related to $* and $#.

The magic variables $* and $# were deprecated in 5.000. Their magical
meaning was removed in Perl 5.10. Since then, a warning was issued
if the variables were used.

This warnings has been removed.

7 years agoTime limit the deprecation of :unique and :locked.
Abigail [Tue, 15 Nov 2016 18:35:28 +0000 (19:35 +0100)]
Time limit the deprecation of :unique and :locked.

The :unique and :locked attributes have had no effect since 5.8.8
and 5.005 respectively. They were deprecated in 5.12. They are now
scheduled to be deleted in 5.28.

There are two places the deprecation warning can be issued:
in lib/attributes.pm, and in toke.c. The warnings were phrased
differently, but since we're changing the warning anyway (as we
added the version of Perl in which the attributes will disappear),
we've used the same phrasing for this warning, regardless of where
it is generated:

    Attribute "locked" is deprecated, and will disappear in Perl 5.28
    Attribute "unique" is deprecated, and will disappear in Perl 5.28

7 years agoDrop .0 from version numbers.
Abigail [Mon, 14 Nov 2016 18:13:29 +0000 (19:13 +0100)]
Drop .0 from version numbers.

Since most perl versions we will refer to in this document will be
major releases, we'll drop the trailing ".0" whenever we mention
a version.

7 years agoActively deprecate File::Glob::glob().
Abigail [Mon, 14 Nov 2016 18:08:12 +0000 (19:08 +0100)]
Actively deprecate File::Glob::glob().

This function has been deprecated since 5.8. However, no deprecation
message was issued; only perl5.008delta.pod and a comment in the file
mention its deprecation.

This patch issues a deprecation message, and warns the user it will
be gone in perl 5.30. Since all this method does is calling
File::Glob::bsd_glob anyway, code calling this is easily fixed.

7 years agoMove discussion of using tie and friends on * less scalars which hold globs
Abigail [Mon, 14 Nov 2016 16:26:42 +0000 (17:26 +0100)]
Move discussion of using tie and friends on * less scalars which hold globs

This was deprecated in 5.14, and fixed in 5.16. Hence, it's moved out
of pod/perldiag.pod, and added to pod/perldeprecation.pod.

7 years agoRemoved entry "Setting ${^ENCODING} is deprecated"
Abigail [Mon, 14 Nov 2016 15:16:49 +0000 (16:16 +0100)]
Removed entry "Setting ${^ENCODING} is deprecated"

pod/perldiag.pod mentions twice that the use of ${^ENCODING} is deprecated.
This is overkill, and we've removed the entry which uses wording which is
no longer used.

7 years agoDeprecated POSIX functions were removed in 5.24.0
Abigail [Mon, 14 Nov 2016 15:12:12 +0000 (16:12 +0100)]
Deprecated POSIX functions were removed in 5.24.0

Therefore, we no longer need the entry in pod/perldiag.pod. We
do however need an entry in pod/perldeprecation.pod.

7 years agoCreated pod/perldeprecation.pod
Abigail [Mon, 14 Nov 2016 13:35:00 +0000 (14:35 +0100)]
Created pod/perldeprecation.pod

This pod is intended to document all deprecations in Perl.
It will document when something became deprecated, when it is
scheduled to be actually removed, and it will offer alternatives.

Initially, we documented the undeprecation of *glob{FILEHANDLE},
and removed its entry from pod/perldiag.pod where it was left
after it being no longer deprecated.

7 years agoperluniintro: Remove obsolete text
Karl Williamson [Mon, 16 Jan 2017 18:00:12 +0000 (11:00 -0700)]
perluniintro: Remove obsolete text

This refers to future plans about 5.24; 5.24 no longer is in the future.

7 years ago(perl #130262) split scalar context stack overflow fix
Tony Cook [Mon, 5 Dec 2016 00:48:14 +0000 (11:48 +1100)]
(perl #130262) split scalar context stack overflow fix

pp_split didn't ensure there was space for its return value
in scalar context.

7 years agoCorrect spelling error.
James E Keenan [Sun, 15 Jan 2017 00:07:21 +0000 (19:07 -0500)]
Correct spelling error.

7 years agoUse File::Spec->catfile() in Test2's Files.t test.
Craig A. Berry [Sat, 14 Jan 2017 21:44:15 +0000 (15:44 -0600)]
Use File::Spec->catfile() in Test2's Files.t test.

Explicitly using forward slashes to concatenate filenames is not
portable and we've already loaded File::Spec anyway.  Also, don't
try to remove the directory we're cleaning up unless we were
successful in opening it.

7 years agoDon't escape tilde when converting to VMS filespecs.
Craig A. Berry [Sat, 14 Jan 2017 20:44:15 +0000 (14:44 -0600)]
Don't escape tilde when converting to VMS filespecs.

There is only one use case for requiring a tilde to be escaped,
and that is when it is the first character in a file or directory
component and is *not* an indication of a special shell expansion
such as the user's home directory.  This scenario simply can't
come up when translating a Unix-format path to VMS format, so
there is nothing to be gained by escaping.

Escaping things we don't need to runs afoul of other goofy things
people do with filenames.  Test2 encodes data in tilde-delimited
temporary filenames and uses a naive join and split to manipulate
the components.  Adding a caret escape to each component is a
data corruption in this scheme, and this patch fixes test failures
in Test2 without any changes to that module.

7 years ago5.22.3 and 5.24.1 are done
Steve Hay [Sat, 14 Jan 2017 21:45:13 +0000 (21:45 +0000)]
5.22.3 and 5.24.1 are done
5.22.4 and 5.24.2 are imminent

7 years agoImport perldeltas from 5.22.3 and 5.24.1
Steve Hay [Sat, 14 Jan 2017 21:30:59 +0000 (21:30 +0000)]
Import perldeltas from 5.22.3 and 5.24.1

7 years agoImport Module::CoreList data for 5.22.3 and 5.24.1
Steve Hay [Sat, 14 Jan 2017 21:26:35 +0000 (21:26 +0000)]
Import Module::CoreList data for 5.22.3 and 5.24.1

7 years agoAdd epigraphs for 5.22.3 and 5.24.1
Steve Hay [Sat, 14 Jan 2017 20:44:45 +0000 (20:44 +0000)]
Add epigraphs for 5.22.3 and 5.24.1

7 years ago5.22.3 and 5.24.1 today
Steve Hay [Sat, 14 Jan 2017 18:08:39 +0000 (18:08 +0000)]
5.22.3 and 5.24.1 today

7 years ago[perl #130546] Restore delete-scalar-slice warning
Father Chrysostomos [Fri, 13 Jan 2017 06:17:04 +0000 (22:17 -0800)]
[perl #130546] Restore delete-scalar-slice warning

Commit v5.19.3-506-g429a25554a reduced false positives with the annoy-
ing ‘Scalar value such-and-such better written as such-and-such’ warn-
ing by flagging the op in the lexer (instead of warning immediately),
and then checking the op tree later, in order to avoid false positives
with perfectly valid constructs, such as qw"...".

The new code that checked the op tree looked for hslice and aslice
ops, but in the particular case of delete @a{...} and delete @a[...],
the slice op gets nulled and the delete op takes care of the slicing
operation (if you can call it that) itself.  The result was that the
warning disappeared altogether for delete.

This commit makes op.c check also for nulled hslice and aslice ops,
and applies the same heuristics to them as to unnulled slicing ops.

7 years agore.pm: pod formatting nits, and clarifications
Karl Williamson [Tue, 10 Jan 2017 17:31:29 +0000 (10:31 -0700)]
re.pm: pod formatting nits, and clarifications

7 years agoWarn on unescaped /[]}]/ under re strict
Karl Williamson [Fri, 6 Jan 2017 05:03:35 +0000 (22:03 -0700)]
Warn on unescaped /[]}]/ under re strict

This commit generates a warning when the experimental 're strict'
feature is in effect for unescaped '}' and ']' characters (in a regular
expression pattern) that are interpreted literally.

This brings the behavior of these more in line with ')' which croaks
when it is taken literally.

The problem with the existing behavior is that these characters may be
metacharacters or they may be literals, depending on action at a
distance.  Not so with ')', which is always a metacharacter unless
escaped.

Ideally, all three of these characters should behave similarly, but it
really is too late for that, except we can warn if the user has
requested extra checking of their patterns with this experimental
're strict' feature.

7 years agot/re/reg_mesg.t: Add new ability
Karl Williamson [Fri, 6 Jan 2017 04:51:12 +0000 (21:51 -0700)]
t/re/reg_mesg.t: Add new ability

This now allows one to say that a warning message is to be expected if
and only if 'use re "strict"' is on.

7 years agoVarious .t's: Escape literal '}' and ']' in patterns
Karl Williamson [Tue, 10 Jan 2017 18:09:33 +0000 (11:09 -0700)]
Various .t's: Escape literal '}' and ']' in patterns

It is clearer to show that these characters which are sometimes meta and
sometimes literal are meant to be taken literally here.

7 years agoregcomp.c: Clarify comment.
Karl Williamson [Fri, 6 Jan 2017 02:28:38 +0000 (19:28 -0700)]
regcomp.c: Clarify comment.

7 years agoAdd /xx regex pattern modifier
Karl Williamson [Thu, 12 Jan 2017 18:07:47 +0000 (11:07 -0700)]
Add /xx regex pattern modifier

This was first proposed in the thread starting at
http://www.nntp.perl.org/group/perl.perl5.porters/2014/09/msg219394.html

7 years agoperlre: Clarifications, typos
Karl Williamson [Fri, 13 Jan 2017 18:17:25 +0000 (11:17 -0700)]
perlre: Clarifications, typos

7 years agoperlretut: Add some white space for legibility
Karl Williamson [Wed, 11 Jan 2017 02:10:58 +0000 (19:10 -0700)]
perlretut: Add some white space for legibility

7 years agoregcomp.c: Remove obsolete data structure element
Karl Williamson [Thu, 12 Jan 2017 05:18:53 +0000 (22:18 -0700)]
regcomp.c: Remove obsolete data structure element

This was used for the removed feature of having the source in a
different encoding.

7 years agopp_sys.c: White space only
Karl Williamson [Fri, 13 Jan 2017 04:05:35 +0000 (21:05 -0700)]
pp_sys.c: White space only

Vertically align some components of an 'if' for readability.

7 years agoWrite tests for RT #77934.
James E Keenan [Thu, 12 Jan 2017 22:15:30 +0000 (17:15 -0500)]
Write tests for RT #77934.

Assistance with test provided by Jerry Hedden.

7 years agoRmv unused regex implementation structure element
Karl Williamson [Wed, 11 Jan 2017 21:21:16 +0000 (14:21 -0700)]
Rmv unused regex implementation structure element

7 years agoPATCH: [perl #130530]: HP-UX assertion failure
Karl Williamson [Mon, 9 Jan 2017 22:40:54 +0000 (15:40 -0700)]
PATCH: [perl #130530]: HP-UX assertion failure

This was introduced in a1a5ec35e6a3df0994b103aadb28a8c1a3a278da, and was
due to a thinko on my part.  Zefram figured it out.

A macro evaluating to a string constant returns an instance of that
constant.  Compilers are free to collapse all instances into a single
one (which saves space), or to have multiple copies.  The code was
assuming the former, and HP-UX cc doesn't.

The passed size also was one byte larger than it should have been.

7 years ago[perl #130522] test cases for len(STCLASS) > len(target)
Hugo van der Sanden [Mon, 9 Jan 2017 16:46:11 +0000 (16:46 +0000)]
[perl #130522] test cases for len(STCLASS) > len(target)

7 years ago[perl #130522] don't try to find_by_class outside the string
Hugo van der Sanden [Sun, 8 Jan 2017 14:59:36 +0000 (14:59 +0000)]
[perl #130522] don't try to find_by_class outside the string

If the calculated latest start position to try is before our current
start position, stop immediately: else we can read out of bounds,
and end up doing unnecessary work.

7 years ago[perl #130522] do not allow endpos to exceed strend
Hugo van der Sanden [Sun, 8 Jan 2017 14:54:57 +0000 (14:54 +0000)]
[perl #130522] do not allow endpos to exceed strend

Check substrings can come from lookaheads, so their length can exceed
minlen. Use a clamped variant of HOP3c to avoid a bad endpos in this case.

7 years ago(perl #130534) fix test failures under DragonFly BSD
Tomasz Konojacki [Tue, 10 Jan 2017 02:47:51 +0000 (03:47 +0100)]
(perl #130534) fix test failures under DragonFly BSD

7 years agoAdd Tomasz Konojacki to AUTHORS
Karl Williamson [Tue, 10 Jan 2017 19:34:52 +0000 (12:34 -0700)]
Add Tomasz Konojacki to AUTHORS

7 years agot/loc_tools.pl: Quit immediately if incompat locale
Karl Williamson [Tue, 10 Jan 2017 18:38:34 +0000 (11:38 -0700)]
t/loc_tools.pl: Quit immediately if incompat locale

The design of this was to not continue when presented with a locale that
we have discovered is incompatible with Perl.  Instead it was soldiering
on.  Those incompatibilities could cause segfaults, etc if the libc
isn't fully protected against unexpected input.

7 years agot/loc_tools.pl: Allow for multiple warnings
Karl Williamson [Tue, 10 Jan 2017 18:35:05 +0000 (11:35 -0700)]
t/loc_tools.pl: Allow for multiple warnings

This code searched the first warning for particular patterns.  It really
should search all warnings for complete correctness.

7 years agot/loc_tools.pl: Emphasize input conditions in comment
Karl Williamson [Tue, 10 Jan 2017 18:33:32 +0000 (11:33 -0700)]
t/loc_tools.pl: Emphasize input conditions in comment

7 years agolocale.c: Fix typo in comment
Karl Williamson [Tue, 10 Jan 2017 18:32:53 +0000 (11:32 -0700)]
locale.c: Fix typo in comment

7 years agolocale.c: -DL shouldn't affect other things
Karl Williamson [Tue, 10 Jan 2017 18:31:01 +0000 (11:31 -0700)]
locale.c: -DL shouldn't affect other things

Prior to this commit, -DL would cause a message to be suppressed
elsewhere.  Code could be relying on that message being output in the
expected place.

7 years agoperldelta for 95309d6ba0f3
Tony Cook [Mon, 9 Jan 2017 00:09:50 +0000 (11:09 +1100)]
perldelta for 95309d6ba0f3

7 years agoadd build options to disable the PERL_HASH* and PERL_PERTURB_KEYS env vars
Tony Cook [Thu, 8 Dec 2016 03:14:11 +0000 (14:14 +1100)]
add build options to disable the PERL_HASH* and PERL_PERTURB_KEYS env vars

These variables either control or reveal information used in perl's
hash implementation that a careful user may not want controlled or
exposed.

7 years agoperlpodspec: Note Pod::Simple instead of Pod::Parser
Karl Williamson [Sun, 8 Jan 2017 17:41:56 +0000 (10:41 -0700)]
perlpodspec: Note Pod::Simple instead of Pod::Parser

Pod::Parser is on its way out from core.  This changes the text to
correspond.

7 years ago[perl #130495] add fresh_perl() option for prog with embedded utf8
Hugo van der Sanden [Sat, 7 Jan 2017 01:27:50 +0000 (01:27 +0000)]
[perl #130495] add fresh_perl() option for prog with embedded utf8

Support { wide_chars => 1 } in the args hash to fresh_perl*() functions,
and use it for the recently added test in re/pat.t

7 years agoImprove perlintern.pod docs for PL_dowarn
Aaron Crane [Sat, 7 Jan 2017 15:32:46 +0000 (15:32 +0000)]
Improve perlintern.pod docs for PL_dowarn

7 years agoFix save-stack type error
Aaron Crane [Sat, 7 Jan 2017 13:57:05 +0000 (13:57 +0000)]
Fix save-stack type error

7 years agoadd setproctitle() support for DragonFly BSD
Peter Avalos [Sat, 7 Jan 2017 14:32:08 +0000 (14:32 +0000)]
add setproctitle() support for DragonFly BSD

RT #130068

(applied untested, as I don't have access to a  dragonfly box - DAPM)

7 years agofix some comment typos about PL_isa_DOES
David Mitchell [Sat, 7 Jan 2017 14:12:05 +0000 (14:12 +0000)]
fix some comment typos about PL_isa_DOES

... and expand one of the comments a bit.

7 years agocflags.SH: omit a needless process in generated file
Aaron Crane [Fri, 6 Jan 2017 17:03:21 +0000 (17:03 +0000)]
cflags.SH: omit a needless process in generated file

Using the shell "case" statement rather than grep(1) will save a process on
every core C file compiled.

7 years agot/perf/optree.t: remove obsolete comment
David Mitchell [Sat, 7 Jan 2017 10:09:28 +0000 (10:09 +0000)]
t/perf/optree.t: remove obsolete comment

with commit v5.25.8-172-gb243b19, I removed some special-casing of the A
in (A&&B) being in boolean context, but forgot to remove a comment
describing this special-casing.

7 years agoEliminate two unused variables detected by clang.
James E Keenan [Fri, 6 Jan 2017 22:56:50 +0000 (17:56 -0500)]
Eliminate two unused variables detected by clang.

"warning: unused variable 'i' [-Wunused-variable]"

7 years ago[MERGE] redo boolean context
David Mitchell [Fri, 6 Jan 2017 16:28:50 +0000 (16:28 +0000)]
[MERGE] redo boolean context

Overhaul the stuff that flags an op as being in boolean context (currently
just padhv and rv2hv). Make the mechanism in rpeep() general, so that
other ops can be easily added in future, and add a generic testing
framework for such ops in t/perf/optree.t.

This alters the amount on situations recognised as being in boolean
context (mainly increasing them).

7 years agoIn A && B, stop special-casing boolean-ness of A
David Mitchell [Fri, 6 Jan 2017 11:35:11 +0000 (11:35 +0000)]
In A && B, stop special-casing boolean-ness of A

Some ops, (currently PADHV and RV2HV) can be flagged as being in boolean
context, and if so, may return a simple truth value which may be more
efficient to calculate than a full scalar value. (This was originally
motivated by code like if (%h) {...}, where the scalar context %h returned a
bucket ratio string, which involved counting how many HvARRAY buckets were
non-empty, which was slow in large hashes. It's been made less important
since %h in scalar context now just returns a key count, which is quick to
calculate.)

There is an issue with the A argument of  A||B, A//B and A&&B, in that,
although A checked by the logop in boolean context, depending on its
truth value the original A may be passed through to the next op. So in
something like $x = (%h || -1), it's not sufficient for %h to return a
truth value; it must return a full scalar value which may get assigned to
$x.

So in general, we only mark the A op as being in boolean context if the
logop is in void context, or if the returned A would only be consumed in
boolean context; so !(A||B) would be ok for example.

However, && is a special case of this, since it will return the original A
only if A was false. Before this commit, && was special-cased to mark A as
being in boolean context regardless of the context of (A&&B). The downside
of this is that the A op can't just return &PL_sv_no as a false value;
it has to return something that is usable in scalar context too. For
example with %h, it returns sv_2mortal(newSViv(0))), which stringifies to
"0" while &PL_sv_no stringifies to "".

This commit removes that special case and makes && behave like || and //
again.

The upside is that some ops in boolean context will be able to more
cheaply return a false value (e.g. just &PL_sv_no verses
sv_2mortal(newSViv(0))).

The main downside is that && in unknown context (typically an
'if (%h} {...}' as the last statement in a sub) will have to check at
runtime whether the caller context is slower.  It will also have to return
a scalar value for something like $y = (%h && $x), but that's a relatively
uncommon occurrence, and now that %h in scalar context doesn't have to
count used buckets, the extra cost in these rare cases is minor.

7 years agoadd xor, grep, flip, flop to boolean cxt detection
David Mitchell [Wed, 4 Jan 2017 23:50:14 +0000 (23:50 +0000)]
add xor, grep, flip, flop to boolean cxt detection

The code that detects whether certain ops (currently just PADHV and RV2HV)
are called in boolean context only recognises a few ops as providing
boolean context: NOT, OR, DOR, AND, COND_EXPR.

This commit expands this by adding GREPWHILE, FLIP, FLOP, XOR too (in the
case of XOR it only applies to the RHS arg - the LHS is not simple to
detect).

This means that in something like

    @AofH_nonempty = grep %$_, @AofH

the test for each hash being non-empty will now be done in boolean rather
than full scalar context, so may be faster.

Similarly (although less excitingly) these hash key counts are also
boolean now:

    %hash .. $other;
    $other .. %hash;
    $other xor %hash;

(I basically did a grep for 'SvTRUE' in pp*.c to see what other ops might
be imposing boolean context.)

Since this has been added to the general boolean context detection
mechanism, it will also apply for any future ops with are 'booleanised'.

7 years agoreindent block in rpeep()
David Mitchell [Wed, 4 Jan 2017 21:22:21 +0000 (21:22 +0000)]
reindent block in rpeep()

(whitespace-only change)

The code for the case OP_PADAV/OP_PADSV was too far left.

7 years agore-implement boolean context detection
David Mitchell [Wed, 4 Jan 2017 20:27:55 +0000 (20:27 +0000)]
re-implement boolean context detection

When certain ops are used in a boolean context (currently just PADHV and
RV2SV, implementing '%hash'), one of the private flags OPpTRUEBOOL or
OPpMAYBE_TRUEBOOL is set on the op to indicate this; at
runtime, the pp function can then just return a boolean value rather than
 a full scalar value (in the case of %hash, an element count).

However, the code which sets these flags has had a complex history, and is
a bit messy. It also sets the flags incorrectly (but safely) in many
cases: principally indicating boolean context when it's in fact void, or
scalar context when it's in fact boolean. Both these permutations make the
code potentially slower (but still correct).

[ As a side-note: in 5.25, a bare %hash in scalar context changed from
returning a bucket count etc, to just returning a key count, which is
quicker to calculate. So the boolean optimisation for %hash is not nearly
as important now: it's now just the overhead of creating a temp to return
a count verses returning &PL_sv_yes, rather than counting keys. However
the improved and generalised boolean context detection added by this
commit will be useful in future to apply boolean context to other ops. ]

In particular, this wasn't being optimised (i.e. a 'not' of a hash within
an if):

    if (!%hash) { ...}

This commit fixes all these cases (and uncomments a load of failing tests
in t/perf/optree.t which were added in the previous commit.)

It makes the code below nearly 3 times faster:

    my $c; my %h = 1..10;
    for my $i (1..10_000_000) { if (!%h) { $c++ }; }

It restructures the relevant code in rpeep() so that rather than switching
on logops like OP_OR, then seeing if that op is preceded by PADHV/RV2HV,
it instead switches on PADHV/RV2HV then sees if succeeding ops impose
boolean context on that op - that is to say, in all possible execution
paths after the PADHV/RV2HV pushes a scalar onto the stack, will that
scalar only ever be used for a boolean test? (*).

The scanning of succeeding ops is extracted out into a static function.
This will make it very easy in future to apply boolean context to other
ops too, or to expand the definition of boolean context (e.g. adding
'xor').

(*) Although in theory an expression like (A && B) can return A if A is
false, if A happens to be %hash, and as long as pp_padhv() etc return
a boolean false value that is also usable in scalar context (so it returns
0 rather than PL_sv_no), then we can pretend that OP_AND's LH arg is
never used as a scalar.

7 years agoadd testing framework for boolean context
David Mitchell [Wed, 4 Jan 2017 19:07:46 +0000 (19:07 +0000)]
add testing framework for boolean context

Some ops (currently just padhv and rv2hv) are optimised when found to be
in boolean context - by setting a private flag on the op indicating
definite or maybe boolean context. At run time, the op can just return
true / false rather than a real value, which may be cheaper.

This commit adds a bunch of tests in nested loops to optree.t to check
that the right private flags are set for the various permutations of

    if (%h || $x) { ...}

etc.

It's written in such a way that its easy to add new ops to it.

At the moment many permutations are actually commented out, as these
(fairly comprehensive) tests show up a number of deficiencies in the
current implementation. These should be fixed in the next commit.

7 years agot/perf/optree.t: add use warnings, strict
David Mitchell [Wed, 4 Jan 2017 09:16:51 +0000 (09:16 +0000)]
t/perf/optree.t: add use warnings, strict

7 years agoRemoved unused CHR_DIST macro from a second file (RT 130519).
James E Keenan [Fri, 6 Jan 2017 12:48:21 +0000 (07:48 -0500)]
Removed unused CHR_DIST macro from a second file (RT 130519).

7 years agoRemoved unused CHR_DIST macros
Andy Lester [Sun, 27 Nov 2016 04:46:13 +0000 (22:46 -0600)]
Removed unused CHR_DIST macros

7 years agoFix the Unicode Bug in the range operator
Aaron Crane [Sun, 20 Nov 2016 14:18:22 +0000 (14:18 +0000)]
Fix the Unicode Bug in the range operator

7 years agoregcomp.c: Use memEQ instead of looping an element at a time
Karl Williamson [Thu, 5 Jan 2017 05:41:53 +0000 (22:41 -0700)]
regcomp.c: Use memEQ instead of looping an element at a time

7 years agoperlapi: Add clarification for SvGROW()
Karl Williamson [Thu, 5 Jan 2017 05:25:15 +0000 (22:25 -0700)]
perlapi: Add clarification for SvGROW()

7 years agotoke.c: Make too-long inline function just static
Karl Williamson [Thu, 5 Jan 2017 05:18:24 +0000 (22:18 -0700)]
toke.c: Make too-long inline function just static

This function is too long to be effectively inlined, so don't request
the compiler to do so.

7 years agoutf8.c: Add a const to a function parameter
Karl Williamson [Thu, 5 Jan 2017 05:16:08 +0000 (22:16 -0700)]
utf8.c: Add a const to a function parameter

7 years agoperldelta for 47a83dc69df7, c345ac2ecadb, 728ecd1a3998, f2a60c1f79f4
Tony Cook [Thu, 5 Jan 2017 00:04:05 +0000 (11:04 +1100)]
perldelta for 47a83dc69df7c345ac2ecadb728ecd1a3998f2a60c1f79f4

7 years agoVarious fixes for dtrace builds on FreeBSD and for other platforms
Tony Cook [Wed, 4 Jan 2017 23:39:44 +0000 (10:39 +1100)]
Various fixes for dtrace builds on FreeBSD and for other platforms

(to a lesser extent)

7 years ago(perl #130108) check if dtrace accepts -xnolibs and use it if available
Tony Cook [Mon, 28 Nov 2016 04:15:18 +0000 (15:15 +1100)]
(perl #130108) check if dtrace accepts -xnolibs and use it if available

dtrace without -xnolibs fails in a FreeBSD jail, so we need to supply
it on FreeBSD.

Unfortunately systemtap's dtrace emulation doesn't support -xnolibs so
we need to test if it's available.

7 years ago(perl #130108) separate compiled objects from dtrace modified objects
Tony Cook [Mon, 28 Nov 2016 04:19:12 +0000 (15:19 +1100)]
(perl #130108) separate compiled objects from dtrace modified objects

When generating an object file with "dtrace -G", dtrace also modifies
the input object files.

This causes two problems:

1) Since the objects are modified, their modification times are updated
which may break dependency checks by make.

2) on FreeBSD at least, once the object has been processed it can't be
processed again by dtrace -G

7 years ago(perl #130108) add elf to libswanted on FreeBSD 10.x
Tony Cook [Mon, 28 Nov 2016 04:22:16 +0000 (15:22 +1100)]
(perl #130108) add elf to libswanted on FreeBSD 10.x

usedtrace builds add references to libelf symbols, causing link
failures without it.

at hints time we don't know if the user will interactively select
dtrace and there's no CBU, so it's added unconditionally on 10.x

7 years ago(perl #130108) generate a dummy dtrace_main.o if perlmain.o doesn't contain probes
Tony Cook [Thu, 17 Nov 2016 11:18:30 +0000 (22:18 +1100)]
(perl #130108) generate a dummy dtrace_main.o if perlmain.o doesn't contain probes

efc4bddfd4 added generating a probes object file for perlmain.o, since
the compiler was generating probes even for unused inline functions.

The default compiler on FreeBSD 11 however doesn't generate probes for
these unused inline functions, and dtrace -G fails because it can't
find any.

So if dtrace fails for perlmain.o generate a dummy object file to
take its place.

Similarly for XS::APItest.