This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perl5.git
7 years agodoop.c: use new SvPVCLEAR and constant string friendly macros
Yves Orton [Wed, 19 Oct 2016 09:14:25 +0000 (11:14 +0200)]
doop.c: use new SvPVCLEAR and constant string friendly macros

7 years agodoio.c: use new SvPVCLEAR and constant string friendly macros
Yves Orton [Wed, 19 Oct 2016 09:14:25 +0000 (11:14 +0200)]
doio.c: use new SvPVCLEAR and constant string friendly macros

7 years agogv.c: rework special var matching logic to be simpler
Yves Orton [Wed, 19 Oct 2016 09:09:00 +0000 (11:09 +0200)]
gv.c: rework special var matching logic to be simpler

The old code used a bunch of tricks that IMO are unlikely
to actually make any performance difference, and make
the code harder to read, search, and understand, and less
amenable to using string constant friendly macros.

So for instance instead of switching on the first char
and then comparing the second on for an exact match
instead just compare the full string. The extra char
is unlikely to make a difference to the underlying code
that gets called, and the end result is easier searching.

Another issue is that some of the code was inadverdantly
doing prefix matches, and not exact matchs for certain
magic var names. This is fixed as part of these changes.

7 years agogv.c: rework string separator parsing to use new string macros
Yves Orton [Wed, 19 Oct 2016 09:08:10 +0000 (11:08 +0200)]
gv.c: rework string separator parsing to use new string macros

7 years agogv.c: switch to using string constant friendly macros
Yves Orton [Wed, 19 Oct 2016 09:07:40 +0000 (11:07 +0200)]
gv.c: switch to using string constant friendly macros

7 years agogv.c: add a require_tie_mod_s() wrapper for constant string args
Yves Orton [Wed, 19 Oct 2016 09:06:26 +0000 (11:06 +0200)]
gv.c: add a require_tie_mod_s() wrapper for constant string args

7 years agoperl.[ch]: switch to using SvPVCLEAR() and string constant friendly macros
Yves Orton [Wed, 19 Oct 2016 09:01:08 +0000 (11:01 +0200)]
perl.[ch]: switch to using SvPVCLEAR() and string constant friendly macros

7 years agovms: use hv_fetchs() with constant string key
Yves Orton [Wed, 19 Oct 2016 08:59:06 +0000 (10:59 +0200)]
vms: use hv_fetchs() with constant string key

7 years agopod: mention SvPVCLEAR()
Yves Orton [Wed, 19 Oct 2016 08:58:30 +0000 (10:58 +0200)]
pod: mention SvPVCLEAR()

7 years agoamigaos4: use constant string friendly macros
Yves Orton [Wed, 19 Oct 2016 08:56:44 +0000 (10:56 +0200)]
amigaos4: use constant string friendly macros

7 years agodist/Data-Dumper: switch to using SvPVCLEAR()
Yves Orton [Wed, 19 Oct 2016 08:56:00 +0000 (10:56 +0200)]
dist/Data-Dumper: switch to using SvPVCLEAR()

7 years agoStorable: switch to using SvPVCLEAR()
Yves Orton [Wed, 19 Oct 2016 08:55:40 +0000 (10:55 +0200)]
Storable: switch to using SvPVCLEAR()

7 years agoos2: switch to using string constant friendly macros
Yves Orton [Wed, 19 Oct 2016 08:54:54 +0000 (10:54 +0200)]
os2: switch to using string constant friendly macros

7 years agoext/XS-APItest: switch to using strEQs()
Yves Orton [Wed, 19 Oct 2016 08:54:05 +0000 (10:54 +0200)]
ext/XS-APItest: switch to using strEQs()

this could use further love, and switch to using memEQs()
in many places.

7 years agoext/mro: use memEQs() for constant string checks
Yves Orton [Wed, 19 Oct 2016 08:52:28 +0000 (10:52 +0200)]
ext/mro: use memEQs() for constant string checks

7 years agoext/PerlIO-encoding: use SvPVCLEAR()
Yves Orton [Wed, 19 Oct 2016 08:50:58 +0000 (10:50 +0200)]
ext/PerlIO-encoding: use SvPVCLEAR()

7 years agoext/POSIX: use _memEQs() and not memEQ() for constant string comparison
Yves Orton [Wed, 19 Oct 2016 08:50:19 +0000 (10:50 +0200)]
ext/POSIX: use _memEQs() and not memEQ() for constant string comparison

7 years agoext/B: use strEQs() and strEQ() in expressions
Yves Orton [Wed, 19 Oct 2016 08:49:40 +0000 (10:49 +0200)]
ext/B: use strEQs() and strEQ() in expressions

7 years agoext/VMS-Stdio: switch to using macros designed for string constant args
Yves Orton [Wed, 19 Oct 2016 08:48:21 +0000 (10:48 +0200)]
ext/VMS-Stdio: switch to using macros designed for string constant args

7 years agoext/attributes: use _memEQs() when comparing to string arguments
Yves Orton [Wed, 19 Oct 2016 08:47:01 +0000 (10:47 +0200)]
ext/attributes: use _memEQs() when comparing to string arguments

7 years agoDevel-Peek: use hv_fetchs() when the key is a constant string
Yves Orton [Wed, 19 Oct 2016 08:44:53 +0000 (10:44 +0200)]
Devel-Peek: use hv_fetchs() when the key is a constant string

7 years agosv.c: add sv_setpv_bufsize() and SvPVCLEAR()
Yves Orton [Wed, 19 Oct 2016 08:40:29 +0000 (10:40 +0200)]
sv.c: add sv_setpv_bufsize() and SvPVCLEAR()

The first can be used to wrap several SVPV steps into
a single sub, and a wrapper macro which is the equivalent
of

   $s= "";

but is optimized in various ways.

7 years agohandy.h, hv.h: fixup hash s suffix macro definitions, move to hv.h
Yves Orton [Wed, 19 Oct 2016 08:36:14 +0000 (10:36 +0200)]
handy.h, hv.h: fixup hash s suffix macro definitions, move to hv.h

For some reason s suffix macro definitions intended for handling
constant string arguments were put into handy.h and not into hv.h.

I think this is wrong, especially as the macro defintions have
"drifted" and are not properly defined in terms the right base
macros.

Also we want to have such wrappers for the main hash functions,
so move them all to hv.h, recode them properly in terms of the
right base macros, and add support for the missing functions.

7 years agohandy.h: add _memEQs() and _memNEs() for use with constant strings
Yves Orton [Wed, 19 Oct 2016 08:32:29 +0000 (10:32 +0200)]
handy.h: add _memEQs() and _memNEs() for use with constant strings

memEQs() is already defined, and requires a length parameter for
the first pointer argument. However some times we do not have
this length handy and simply want to use the length of the constant
string instead.

In an ideal world, to be compatible with more s suffix macros,
IMO the existing memEQs() should have been called something like
memEQsl() maybe, and the ones I am adding would get the memEQs(
name, but it didnt work out like that.

7 years agohandy.h: add strEQs() and strNEs() for comparing to constant strings
Yves Orton [Wed, 19 Oct 2016 08:30:44 +0000 (10:30 +0200)]
handy.h: add strEQs() and strNEs() for comparing to constant strings

They use strncmp() and derive the length using STR_WITH_LEN style
tricks in the wrapper call.

7 years agogv.c: document where @- and @+ (and %- and %+ are initialized in gv.c)
Yves Orton [Thu, 13 Oct 2016 16:41:00 +0000 (18:41 +0200)]
gv.c: document where @- and @+ (and %- and %+ are initialized in gv.c)

7 years agouniprops.t: split into 10 seperate test files t/re/uniprops01.t etc
Yves Orton [Wed, 19 Oct 2016 07:52:01 +0000 (09:52 +0200)]
uniprops.t: split into 10 seperate test files t/re/uniprops01.t etc

This way we can run them at the same time under parallel test,
as there are a lot of tests (140k or so) this makes a difference.

7 years agoPATCH: [perl #129766] Internal cleanup in numeric.c
Andy Lester [Fri, 30 Sep 2016 16:20:47 +0000 (10:20 -0600)]
PATCH: [perl #129766] Internal cleanup in numeric.c

No functional changes

7 years agoUpdate Net-Ping to CPAN version 2.51
Chris 'BinGOs' Williams [Tue, 18 Oct 2016 10:14:18 +0000 (11:14 +0100)]
Update Net-Ping to CPAN version 2.51

  [DELTA]

2.51  Mon Oct 17 16:11:03 2016 +0200 (rurban)
       version in cperl since 5.25.2c

       Bugfixes
       - Fixed missing _unpack_sockaddr_in family, which took AF_INET6 for
         a AF_INET addr in t/500_ping_icmp.t and t/500_ping_icmp_ttl.t.
         Use now a proper default.

2.50  Sat Apr 16 11:50:20 2016 +0200 (rurban)
       version in cperl since 5.22.2c

       Features
       - Handle IPv6 addresses and the AF_INET6 family.
       - Added the optional family argument to most methods.
         valid values: 6, "v6", "ip6", "ipv6", AF_INET6
       - new can take now named arguments, a hashref.
       - Added the following named arguments to new:
         gateway host port bind retrans pingstring source_verify econnrefused
         IPV6_USE_MIN_MTU IPV6_RECVPATHMTU IPV6_HOPLIMIT
       - Added a dontfrag option, setting IP_DONTFRAG and on linux
         also IP_MTU_DISCOVER to IP_PMTUDISC_DO. Note that is ignored if
         Socket does not export IP_DONTFRAG.
       - Added the wakeonlan method
       - Improve argument default handling
       - Added missing documentation

       Bugfixes
       - Reapply tos with ping_udp, when the address is changed.
         RT #6706 (Torgny.Hofstedt@sevenlevels.se)
         ditto re-bind to a device.

       Internals
       - $ip is now a hash with {addr, addr_in, family} not the addr_in packed IP.
       - added _resolv replacing inet_aton,
         _pack_sockaddr_in and _unpack_sockaddr_in replacing sockaddr_in,
         _inet_ntoa replacing inet_ntoa
       - Use _isroot helper, with Win32 _IsAdminUser helper.
       - added several new tests (Steve Peters)

2.43  Mon Apr 29 00:23:56 2013 -0300
        version in perl core since 5.19.9
        Bugfixes
        - Handle getprotobyn{ame,umber} not being available
2.42  Sun May 26 19:08:46 2013 -0700
        version in perl core since 5.19.1
        Bugfixes
        - Stabilize tests
       Internals
        - wrap long pod lines

7 years agoUpdate Archive-Tar to CPAN version 2.12
Chris 'BinGOs' Williams [Tue, 18 Oct 2016 09:10:41 +0000 (10:10 +0100)]
Update Archive-Tar to CPAN version 2.12

  [DELTA]

2.12  16/10/2016 (KHW && JKEENAN)
- Fix pod in bin/ptar
- Distinguish between archives with/without directory entries

7 years agoutf8.c: Reflow 2 lines, so it is clear they are 2.
Karl Williamson [Tue, 18 Oct 2016 02:35:36 +0000 (20:35 -0600)]
utf8.c: Reflow 2 lines, so it is clear they are 2.

THis caused some confusion, see
<2B6CE3F8-B566-4581-B7E3-815C45F37E04@petdance.com>
so I reflowed things.

7 years agoop.c: Fix EBCDIC-only bug
Karl Williamson [Tue, 18 Oct 2016 02:16:21 +0000 (20:16 -0600)]
op.c: Fix EBCDIC-only bug

We have no tests that this fails for, but on an EBCDIC machine, the
branches here are incorrect.  They are trying to determine if a UTF-8
representation will be larger than a non-UTF-8 representation for code
points < 256.  The proper test is if the code points are UTF-8
invariant.

7 years agotoke.c: Fix EBCDIC issue
Karl Williamson [Fri, 19 Aug 2016 03:13:04 +0000 (21:13 -0600)]
toke.c: Fix EBCDIC issue

The value here is Unicode, not native, so needs a different macro.
There's no test for this, as this is allocating space, and could be one
byte off, which is only a problem if it is one byte small, and we were
at a limit where that single byte made the difference.

7 years agoperlapi: Grammar, typos
Karl Williamson [Thu, 18 Aug 2016 23:57:14 +0000 (17:57 -0600)]
perlapi: Grammar, typos

7 years agotoke.c: Fix grammar in comment
Karl Williamson [Wed, 17 Aug 2016 21:22:50 +0000 (15:22 -0600)]
toke.c: Fix grammar in comment

7 years agomake regen for the IBM/CRAY fp
Jarkko Hietaniemi [Mon, 17 Oct 2016 21:55:26 +0000 (17:55 -0400)]
make regen for the IBM/CRAY fp

7 years agoAdd scan for IBM and Cray mainframe fp formats.
Jarkko Hietaniemi [Mon, 17 Oct 2016 12:29:35 +0000 (08:29 -0400)]
Add scan for IBM and Cray mainframe fp formats.

For completeness: it's quite unlikely Perl would build in those
environments.

Though with Cray it's less impossible: Perl used to build in C90
UNICOS, in 5.8-ish timeframe.

With IBM, highly unlikely, because there probably never was a UNIXy
enough environment where the IBM Floating Point Architecture was used.

7 years ago(perl #128996) prevent PL_op pointing to freed ops
Tony Cook [Mon, 17 Oct 2016 03:32:41 +0000 (14:32 +1100)]
(perl #128996) prevent PL_op pointing to freed ops

When yylex() attempts to report a UTF-8 encoding error, it
indirectly accesses PL_op, this would cause an access to freed
memory if the CV containing that op (and the op itself) had been
freed.

7 years agoAdd script for looking at test time outliers.
Jarkko Hietaniemi [Sun, 16 Oct 2016 19:26:36 +0000 (15:26 -0400)]
Add script for looking at test time outliers.

Requires logging the output of "make test" with HARNESS_TIMER=1

7 years agonetbsd/vax perldelta tweakery.
Jarkko Hietaniemi [Sun, 16 Oct 2016 19:12:29 +0000 (15:12 -0400)]
netbsd/vax perldelta tweakery.

7 years agomacOS Sierra (10.12) does have clockid_t.
Jarkko Hietaniemi [Sun, 16 Oct 2016 20:33:23 +0000 (16:33 -0400)]
macOS Sierra (10.12) does have clockid_t.

Scan for it in all platforms.

7 years agoPATCH: [perl #129891] t/op/utf8decode.t failing
Karl Williamson [Sat, 15 Oct 2016 17:02:04 +0000 (11:02 -0600)]
PATCH: [perl #129891] t/op/utf8decode.t failing

This bug is a result of 32-bit vs 64-bit words, and is a problem in the
test file and not the underlying code.

The blamed commit changed things so that is a UTF-8 sequence has
multiple malformations, a diagnostic is generated for each.  Some of the
tests in utf8decode.t overflow on 32-bit words, but not 64.  The
solution is to change the .t to also look for the extra overflow
warnings on 32 bit machines.

7 years agoutf8.c: Silence a compiler warning
Karl Williamson [Sat, 15 Oct 2016 17:00:57 +0000 (11:00 -0600)]
utf8.c: Silence a compiler warning

Some compilers wrongly warn that this is used uninitialized.

7 years agoperldelta: draft for commits up to 877b982928
Aaron Crane [Sun, 16 Oct 2016 13:12:42 +0000 (14:12 +0100)]
perldelta: draft for commits up to 877b982928

7 years agoMove perldelta entry to correct section
Aaron Crane [Sun, 16 Oct 2016 12:58:52 +0000 (13:58 +0100)]
Move perldelta entry to correct section

7 years ago[RT #129789] Time::HiRes: fix compilation on darwin
Sergey Aleynikov [Wed, 5 Oct 2016 15:29:34 +0000 (18:29 +0300)]
[RT #129789] Time::HiRes: fix compilation on darwin

Commit 1c5665476f0d7250c7d93f82eab2b7cda1e6937f added explicit cast
for one of the clock_gettime() arguments, but darwin lacks clockid_t,
so update emulation layer to match function prototype too.

7 years agoIf a unit test doesn't finish in 5 minutes, it's not a unit test.
Jarkko Hietaniemi [Fri, 14 Oct 2016 02:04:20 +0000 (22:04 -0400)]
If a unit test doesn't finish in 5 minutes, it's not a unit test.

These tests seem to often be outliers in execution time.  In faster
modern machines the slowness is not noticeable, but in slower machines
these are excruciatingly slow.

In slow machines these tests may grind for hours, but that is not
that useful information.  We know the machine is slow, already.

The uniprops.t could also use the watchdog, except that TestProp.pl
seems to be purposefully avoiding using test.pl.

7 years agoperlsec: convert C snippet from K&R C to C89
Lukas Mai [Fri, 14 Oct 2016 11:21:33 +0000 (13:21 +0200)]
perlsec: convert C snippet from K&R C to C89

Also include required headers and report errors on failure.

(Inspired by afoken's post at <http://perlmonks.org/?node_id=1173959>.)

7 years agoperlapi: Fix clause that should have been removed earlier
Karl Williamson [Thu, 13 Oct 2016 01:14:13 +0000 (19:14 -0600)]
perlapi: Fix clause that should have been removed earlier

7 years agoutf8.h: Simplify macro
Karl Williamson [Thu, 13 Oct 2016 01:12:11 +0000 (19:12 -0600)]
utf8.h: Simplify macro

This complicated macro boils down to just one bit.

7 years agoAdd utf8n_to_uvchr_error
Karl Williamson [Tue, 11 Oct 2016 03:18:37 +0000 (21:18 -0600)]
Add utf8n_to_uvchr_error

This new function behaves like utf8n_to_uvchr(), but takes an extra
parameter that points to a U32 which will be set to 0 if no errors are
found; otherwise each error found will set a bit in it.  This can be
used by the caller to figure out precisely what the error(s) is/are.
Previously, one would have to capture and parse the warning/error
messages raised.   This can be used, for example, to customize the
messages to the expected end-user's knowledge level.

7 years agoutf8n_to_uvchr(): Make a parameter const
Karl Williamson [Sun, 9 Oct 2016 03:19:18 +0000 (21:19 -0600)]
utf8n_to_uvchr(): Make a parameter const

7 years agoutf8n_to_uvchr(): Note multiple malformations
Karl Williamson [Thu, 6 Oct 2016 01:09:02 +0000 (19:09 -0600)]
utf8n_to_uvchr(): Note multiple malformations

Some UTF-8 sequences can have multiple malformations.  For example, a
sequence can be the start of an overlong representation of a code point,
and still be incomplete.  Until this commit what was generally done was
to stop looking when the first malformation was found.  This was not
correct behavior, as that malformation may be allowed, while another
unallowed one went unnoticed.  (But this did not actually create
security holes, as those allowed malformations replaced the input with a
REPLACEMENT CHARACTER.)  This commit refactors the error handling of
this function to set a flag and keep going if a malformation is found
that doesn't preclude others.  Then each is handled in a loop at the
end, warning if warranted.  The result is that there is a warning for
each malformation for which warnings should be generated, and an error
return is made if any one is disallowed.

Overflow doesn't happen except for very high code points, well above the
Unicode range, and above fitting in 31 bits.  Hence the latter 2
potential malformations are subsets of overflow, so only one warning is
output--the most dire.

This will speed up the normal case slightly, as the test for overflow is
pulled out of the loop, allowing the UV to overflow.  Then a single test
after the loop is done to see if there was overflow or not.

7 years agoAPItest/t/utf8.t: Indent a bunch of code
Karl Williamson [Fri, 7 Oct 2016 21:07:57 +0000 (15:07 -0600)]
APItest/t/utf8.t: Indent a bunch of code

And reflow to fit in 80 columns.  This is in preparation for the next
commit which will enlocde this new code with two more for loops.
Several lines that were missing semi-colons have these added (they were
at the end of nested blocks, so it wasn't an error)

7 years agoAPItest/t/utf8.t: Fix improper tests
Karl Williamson [Sun, 9 Oct 2016 02:53:31 +0000 (20:53 -0600)]
APItest/t/utf8.t: Fix improper tests

These two tests are overlong malformations, besides being the ones
purportedly being tested.  Make them not overlong, so are testing just
one thing

7 years agoAPItest/t/utf8.t: Add missing test
Karl Williamson [Thu, 6 Oct 2016 00:34:15 +0000 (18:34 -0600)]
APItest/t/utf8.t: Add missing test

Under some circumstances we weren't validating that the generated
warnings are correct.  This required reordering some 'if' tests, and
revised special casing of the overflow test.

7 years agoAPItest/t/utf8.t: Rename test for clarity
Karl Williamson [Thu, 6 Oct 2016 00:32:55 +0000 (18:32 -0600)]
APItest/t/utf8.t: Rename test for clarity

7 years agoutf8.c: Extract some code into 2 functions
Karl Williamson [Mon, 3 Oct 2016 03:50:10 +0000 (21:50 -0600)]
utf8.c: Extract some code into 2 functions

This is in preparation for the same functionality to each be used in a
new place in a future commit

7 years agoutf8.c: Rename a couple of macros for clarity
Karl Williamson [Mon, 3 Oct 2016 03:31:52 +0000 (21:31 -0600)]
utf8.c: Rename a couple of macros for clarity

These were recently added in 2b47960981adadbe81b9635d4ca7861c45ccdced.
This also removes the #undefs of these in preparation for them to be
used later in the file.

7 years agoutf8.h: Change some flag definition constants
Karl Williamson [Mon, 3 Oct 2016 03:09:27 +0000 (21:09 -0600)]
utf8.h: Change some flag definition constants

These #defines give flag bits in a U32.  This commit opens a gap that
will be filled in a future commit.  A test file has to change to
correspond, as it duplicates the defines.

7 years agoAPItest/t/utf8.t: Extract code to common function
Karl Williamson [Mon, 3 Oct 2016 03:05:15 +0000 (21:05 -0600)]
APItest/t/utf8.t: Extract code to common function

There are many instances of this simple code to dump an array of trapped
warning messages.  The problem is that they display better when joined
by "" rather than by a comma.  Rather than change each instance to do
that, I changed each instance to a sub call and changed it there.

7 years agoutf8.c: Add some UNLIKELY()s
Karl Williamson [Fri, 30 Sep 2016 18:42:45 +0000 (12:42 -0600)]
utf8.c: Add some UNLIKELY()s

for branch prediction

7 years agoAdd details to UTF-8 malformation error messages
Karl Williamson [Wed, 28 Sep 2016 21:05:17 +0000 (15:05 -0600)]
Add details to UTF-8 malformation error messages

I've long been unsatisfied with the information contained in the
error/warning messages raised when some input is malformed UTF-8, but
have been reluctant to change the text in case some one is relying on
it.  One reason that someone might be parsing the messages is that there
has been no convenient way to otherwise pin down what the exact
malformation might be.  A few commits from now will add a facility
to get the type of malformation unambiguously.  This will be a better
mechanism to use for those rare modules that need to know what's the
exact malformation.

So, I will fix and issue pull requests for any module broken by this
commit.

The messages are changed by now dumping (in \xXY format) the bytes that
make up the malformed character, and extra details are added in most
cases.

Messages about overlongs now display the code point they evaluate to and
what the shortest UTF-8 sequence for generating that code point is.

Messages about overflowing now just display that it overflows, since the
entire byte sequence is now dumped.  The previous message displayed just
the byte which was being processed where overflow was detected, but that
information is not at all meaningfull.

7 years agoutf8.c: Consolidate duplicate error msg text
Karl Williamson [Wed, 28 Sep 2016 16:19:03 +0000 (10:19 -0600)]
utf8.c: Consolidate duplicate error msg text

This text is generated in 2 places; consolidate into one place.

7 years agoUpgrade Scalar-List-Utils from version 1.45 to 1.46
Steve Hay [Thu, 13 Oct 2016 12:31:51 +0000 (13:31 +0100)]
Upgrade Scalar-List-Utils from version 1.45 to 1.46

7 years agoUpgrade Test::Simple from version 1.302056 to 1.302059
Steve Hay [Thu, 13 Oct 2016 07:29:16 +0000 (08:29 +0100)]
Upgrade Test::Simple from version 1.302056 to 1.302059

7 years agoUpgrade parent from version 0.234 to 0.236
Steve Hay [Thu, 13 Oct 2016 07:23:55 +0000 (08:23 +0100)]
Upgrade parent from version 0.234 to 0.236

7 years agoUpgrade HTTP::Tiny from version 0.068 to 0.070
Steve Hay [Thu, 13 Oct 2016 07:17:00 +0000 (08:17 +0100)]
Upgrade HTTP::Tiny from version 0.068 to 0.070

7 years agocorelist: Fix typo in variable name
Thomas Sibley [Wed, 12 Oct 2016 16:44:30 +0000 (09:44 -0700)]
corelist: Fix typo in variable name

7 years agoautodoc.pl: Allow =item lists in perlapi
Karl Williamson [Thu, 13 Oct 2016 00:30:11 +0000 (18:30 -0600)]
autodoc.pl: Allow =item lists in perlapi

Such lists were silently ignored.  This fixes things so no pod commands
are silently ignored, and hence lists are now accepted in a function's
pod.  This fixes the entry for 'vverify', whose =item list was not
getting picked up.

7 years agoperlapi: Fix docs for 2 scope related macros
Karl Williamson [Thu, 13 Oct 2016 00:27:26 +0000 (18:27 -0600)]
perlapi: Fix docs for 2 scope related macros

These 2 macros were using =item instead of =for apidoc, so they silently
were not included in perlapi.  This commit also changes  their
references to links.

7 years agoAdd epigraphs for 5.22.3-RC4 and 5.24.1-RC4
Steve Hay [Wed, 12 Oct 2016 22:01:01 +0000 (23:01 +0100)]
Add epigraphs for 5.22.3-RC4 and 5.24.1-RC4

7 years ago5.22.3-RC4 and 5.24.1-RC4 today
Steve Hay [Wed, 12 Oct 2016 19:12:25 +0000 (20:12 +0100)]
5.22.3-RC4 and 5.24.1-RC4 today

7 years agoop.c: fix what looks like typos in comments
Lukas Mai [Wed, 12 Oct 2016 00:20:18 +0000 (02:20 +0200)]
op.c: fix what looks like typos in comments

7 years agoRevert "Reduce SelectSaver memory footprint"
James E Keenan [Tue, 11 Oct 2016 14:02:22 +0000 (10:02 -0400)]
Revert "Reduce SelectSaver memory footprint"

This reverts commit 26d58bfed57736ec1e1f1dfd579484f8b6fcccd7.

7 years ago[rt #129336] #!perl -i u erroneously interpreted as -u
Dan Collins [Fri, 23 Sep 2016 05:21:20 +0000 (01:21 -0400)]
[rt #129336] #!perl -i u erroneously interpreted as -u

Perl_moreswitches processes a single switch, and returns a pointer
to the start of the next switch. It can return either
the a pointer to the next flag itself:

    #!perl -n -p
               ^ Can point here

Or, to the space before the next "arg":

    #!perl -n -p
             ^ Can point here

(Where the next call to Perl_moreswitches will consume " -".)

In the case of -i[extension], the pointer is by default pointing at
the space after the end of the argument. The current code tries to
do the former, by unconditionally advancing the pointer, and then
advancing it again if it is on a '-'. But that is incorrect:

    #!perl -i p
              ^ Will point here, but that isn't a flag

I could fix this by removing the unconditional s++, and having it
increment by 2 if *(s+1)=='-', but this work isn't actually
necessary - it's better to just leave it pointing at the space after
the argument.

7 years agoProvide a template for call to File::Temp::tempfile().
François Perrad [Sun, 9 Oct 2016 20:13:21 +0000 (16:13 -0400)]
Provide a template for call to File::Temp::tempfile().

tempfile() with template gives a file in the current directory.
tempfile() without template gives a file in /tmp.  These may be on different
kinds of filesystems (in the instant case, the former was on ext2, the latter
on ext4) with different characteristics with respect to high-resolution
timing.

Originally reported at:
https://rt.cpan.org/Public/Bug/Display.html?id=116127#txn-1674171

7 years agoReduce SelectSaver memory footprint
Nicolas R [Thu, 8 Sep 2016 20:29:46 +0000 (14:29 -0600)]
Reduce SelectSaver memory footprint

This is saving about 500k when using SelectSaver
as most of the time Carp is not required.

before> perl -I. -e 'require q{lib/SelectSaver.pm}; print qx{grep VmRSS /proc/$$/status}'
VmRSS:      2920 kB

after> perl -I. -e 'require q{lib/SelectSaver.pm}; print qx{grep VmRSS /proc/$$/status}'
VmRSS:      2352 kB

Committer:  Increment SelectSaver $VERSION.  Add perldelta entry for SelectSaver.

For: RT # 129235

7 years agoXS-APItest/t/utf8.t: Fix failing EBCDIC test
Karl Williamson [Wed, 5 Oct 2016 20:56:59 +0000 (14:56 -0600)]
XS-APItest/t/utf8.t: Fix failing EBCDIC test

Recent commit 418080dc73a4b9e525a76d6d3b5034ff616716b4 fixing a test in
this file that was failing only on EBCDIC platforms had an error.  It
applied a correction to a test that didn't require it, causing it to
fail.  This commit changes that to use a different method to detect
which tests to apply the correction to, and knowing that some things can
be determined earlier as a result.

7 years agoutf8.c: Add missing cast
Karl Williamson [Wed, 5 Oct 2016 19:45:00 +0000 (13:45 -0600)]
utf8.c: Add missing cast

This string literal contains U8's.  It normally is only compiled on
EBCDIC, and when I tried it (by changing the #ifdef's around) on Linux
g++, it fails to compile.  Apparently it does compile on z/OS, but the
logs don't show the result.  But there are a bunch of failures there
involving this function, and this could explain them.

7 years ago[perl #129350] anchored/floating substrings must be utf8 if target is
Hugo van der Sanden [Tue, 4 Oct 2016 13:40:11 +0000 (14:40 +0100)]
[perl #129350] anchored/floating substrings must be utf8 if target is

If the target is utf8 and either the anchored or floating substrings
are not, we need to create utf8 copies to check against. The state
of the two substrings may not be the same, but we were only testing
whichever we planned to check first.

7 years ago[MERGE] eliminate OP_PUSHRE and optimise split()
David Mitchell [Tue, 4 Oct 2016 10:40:12 +0000 (11:40 +0100)]
[MERGE] eliminate OP_PUSHRE and optimise split()

7 years agoPerl_newASSIGNOP: fix on g++ builds
David Mitchell [Sun, 25 Sep 2016 18:30:39 +0000 (19:30 +0100)]
Perl_newASSIGNOP: fix on g++ builds

op.c: In function ‘OP* Perl_newASSIGNOP(PerlInterpreter*, I32, OP*, I32, OP*)’:
op.c:6605:15: error: jump to label ‘detach_split’ [-fpermissive]
               detach_split:
               ^
op.c:6631:22: note:   from here
                 goto detach_split;
                      ^
op.c:6584:30: note:   skips initialization of ‘PMOP* const pm’
                 PMOP * const pm = (PMOP*)right;

7 years agoConcise.pm: extract padname code and fixup split
David Mitchell [Mon, 19 Sep 2016 15:42:45 +0000 (16:42 +0100)]
Concise.pm: extract padname code and fixup split

The code that prints '$i:1,2'' in something like 'padsv[$i:1,2]':
extract it out into a separate function, then use it with  split
to display the array name rather than just a target number in:

    $ perl -MO=Concise -e'my @a = split()'
    ...
    split(/" "/ => @a:1,2)[t2] vK/LVINTRO,RTIME,ASSIGN,LEX,IMPLIM ->6

7 years agofix common assign issue on @a = (split(), 1)
David Mitchell [Mon, 19 Sep 2016 14:39:34 +0000 (15:39 +0100)]
fix common assign issue on @a = (split(), 1)

RT #127999 Slowdown in split + list assign

The compile-time common-value detection mechanism for OP_ASSIGN
was getting OP_SPLIT wrong.

It was assuming that OP_SPLIT was always dangerous. In fact,
OP_SPLIT is usually completely safe, not passing though any of its
arguments, except where the assign in (@a = split()) has been optimised
away and the array attached directly to the OP_SPLIT op, or the ops that
produce the array have been appended as an extra child of the OP_SPLIT op
(OPf_STACKED).

7 years agoBetter optimise my/local @a = split()
David Mitchell [Mon, 19 Sep 2016 11:35:13 +0000 (12:35 +0100)]
Better optimise my/local @a = split()

There are currently two optimisations for when the results of a split
are assigned to an array.

For the first,

    @array = split(...);

the aassign and padav/rv2av are optimised away, and pp_split() directly
assigns to the array attached to the split op (via op_pmtargetoff or
op_pmtargetgv).

For the second,

    my @array    = split(...);
    local @array = split(...);
    @{$expr}     = split(...);

The aassign is optimised away, but the padav/rv2av is kept as an additional
arg to split. pp_split itself then uses the first arg popped off the stack
as the array (This was introduced by FC with v5.21.4-409-gef7999f).

This commit moves these two:

    my @array    = split(...);
    local @array = split(...);

from the second case to the first case, by simply setting OPpLVAL_INTRO
on the OP_SPLIT, and making pp_split() do SAVECLEARSV() or save_ary()
as appropriate.

This makes my @a = split(...) a few percent faster.

7 years agore-indent block in Perl_newASSIGNOP
David Mitchell [Sun, 18 Sep 2016 15:13:41 +0000 (16:13 +0100)]
re-indent block in Perl_newASSIGNOP

Whitepace-only change.

This is a followup to the previous commit, which simplified that code
somewhat.

7 years agomake OP_SPLIT a PMOP, and eliminate OP_PUSHRE
David Mitchell [Thu, 15 Sep 2016 09:59:37 +0000 (10:59 +0100)]
make OP_SPLIT a PMOP, and eliminate OP_PUSHRE

Most ops that execute a regex, such as match and subst, are of type PMOP.
A PMOP allows the actual regex to be attached directly to that op, due
to its extra fields.

OP_SPLIT is different; it is just a plain LISTOP, but it always has an
OP_PUSHRE as its first child, which *is* a PMOP and which has the regex
attached.

At runtime, pp_pushre()'s only job is to push itself (i.e. the current
PL_op) onto the stack. Later pp_split() pops this to get access to the
regex it wants to execute.

This is a bit unpleasant, because we're pushing an OP* onto the stack,
which is supposed to be an array of SV*'s. As a bit of a hack, on
DEBUGGING builds we push a PVLV with the PL_op address embedded instead,
but this still isn't very satisfactory.

Now that regexes are first-class SVs, we could push a REGEXP onto the
stack rather than PL_op. However, there is an optimisation of @array =
split which eliminates the assign and embeds the array's GV/padix directly
in the PUSHRE op. So split still needs access to that op. But the pushre
op will always be splitop->op_first anyway, so one possibility is to just
skip executing the pushre altogether, and make pp_split just directly
access op_first instead to get the regex and @array info.

But if we're doing that, then why not just go the full hog and make
OP_SPLIT into a PMOP, and eliminate the OP_PUSHRE op entirely: with the
data that was spread across the two ops now combined into just the one
split op.

That is exactly what this commit does.

For a simple compile-time pattern like  split(/foo/, $s, 1), the optree
looks like:

    before:
        <@> split[t2] lK
           </> pushre(/"foo"/) s/RTIME
           <0> padsv[$s:1,2] s
           <$> const(IV 1) s

    after:
        </> split(/"foo"/)[t2] lK/RTIME
           <0> padsv[$s:1,2] s
           <$> const[IV 1] s

while for a run-time expression like split(/$pat/, $s, 1),

    before:
        <@> split[t3] lK
           </> pushre() sK/RTIME
              <|> regcomp(other->8) sK
                 <0> padsv[$pat:2,3] s
           <0> padsv[$s:1,3] s
           <$> const(IV 1)s

    after:
        </> split()[t3] lK/RTIME
           <|> regcomp(other->8) sK
              <0> padsv[$pat:2,3] s
           <0> padsv[$s:1,3] s
           <$> const[IV 1] s

This makes the code faster and simpler.

At the same time, two new private flags have been added for OP_SPLIT -
OPpSPLIT_ASSIGN and OPpSPLIT_LEX - which make it explicit that the
assign op has been optimised away, and if so, whether the array is
lexical.

Also, deparsing of split has been improved, to the extent that

    perl TEST -deparse op/split.t

now passes.

Also, a couple of panic messages in pp_split() have been replaced with
asserts().

7 years agoTime-HiRes: explicit clockid_t cast for C++11
Jarkko Hietaniemi [Sat, 1 Oct 2016 14:30:29 +0000 (10:30 -0400)]
Time-HiRes: explicit clockid_t cast for C++11

7 years agoPL_inf/PL_nan need different export with C++
Jarkko Hietaniemi [Fri, 30 Sep 2016 21:18:16 +0000 (17:18 -0400)]
PL_inf/PL_nan need different export with C++

After the 9ee3aea9, the old way worked with C++ for building
the core, but then failed building the POSIX extension.

(This change is about building with C++ after the 9ee3aea9,
even though that change was about ordering perl.h into a more
logical order for vax-netbsd, or for any non-IEEE-754 platform.)

7 years agovax-netbsd: do not export inf/nan which we do not have
Jarkko Hietaniemi [Fri, 30 Sep 2016 11:35:53 +0000 (07:35 -0400)]
vax-netbsd: do not export inf/nan which we do not have

7 years agovax-netbsd: POSIX: skip t/math.t tests needing inf/nan
Jarkko Hietaniemi [Thu, 29 Sep 2016 10:47:13 +0000 (06:47 -0400)]
vax-netbsd: POSIX: skip t/math.t tests needing inf/nan

7 years agovax-netbsd: POSIX: skip inf/nan parts
Jarkko Hietaniemi [Tue, 27 Sep 2016 23:07:40 +0000 (19:07 -0400)]
vax-netbsd: POSIX: skip inf/nan parts

7 years agovax-netbsd: POSIX: fenv.h is work-in-progress
Jarkko Hietaniemi [Tue, 27 Sep 2016 22:40:46 +0000 (18:40 -0400)]
vax-netbsd: POSIX: fenv.h is work-in-progress

Given that fenv.h seems very IEEE-754 oriented,
it's likely to stay that way for a while.

7 years agovax-netbsd: avoid NV_INF/NV_NAN uses
Jarkko Hietaniemi [Thu, 29 Sep 2016 21:57:05 +0000 (17:57 -0400)]
vax-netbsd: avoid NV_INF/NV_NAN uses

7 years agovax-netbsd: inf/nan only if IEEE 754
Jarkko Hietaniemi [Thu, 29 Sep 2016 12:23:12 +0000 (08:23 -0400)]
vax-netbsd: inf/nan only if IEEE 754

7 years agoAPItest/t/utf8.t: Add some constants
Karl Williamson [Fri, 30 Sep 2016 03:07:19 +0000 (21:07 -0600)]
APItest/t/utf8.t: Add some constants

Though unused now, they were convenient during some debugging, and may
be again.

7 years agoAPItest/t/utf8.t: Fix 3-byte overlong test
Karl Williamson [Fri, 30 Sep 2016 03:05:49 +0000 (21:05 -0600)]
APItest/t/utf8.t: Fix 3-byte overlong test

Unlike ASCII platforms, one can tell on EBCDIC ones if an otherwise
valid 3-byte sequence is overlong on the first byte.

7 years agoAPItest/t/utf8.t: Fix EBCDIC test
Karl Williamson [Fri, 30 Sep 2016 03:03:30 +0000 (21:03 -0600)]
APItest/t/utf8.t: Fix EBCDIC test

Unlike on ASCII platforms, it may take more than one byte of a partial
character to determine if it represents a code point that needs 32 or
more bits to represent.  This fixes the test to account for that.

7 years agoutf8.c: Add missing type specifier to declaration
Karl Williamson [Fri, 30 Sep 2016 03:01:36 +0000 (21:01 -0600)]
utf8.c: Add missing type specifier to declaration

This code was missing a STRLEN specifier; only compiled on EBCDIC.