This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perl5.git
7 years agotoke.c: Convert to use isFOO_utf8_safe() macros
Karl Williamson [Wed, 14 Dec 2016 01:34:12 +0000 (18:34 -0700)]
toke.c: Convert to use isFOO_utf8_safe() macros

7 years agoConvert core (except toke.c) to use isFOO_utf8_safe()
Karl Williamson [Wed, 30 Nov 2016 16:53:17 +0000 (09:53 -0700)]
Convert core (except toke.c) to use isFOO_utf8_safe()

The previous commit added this feature; now this commit uses it in core.
toke.c is deferred to the next commit to aid in possible future
bisecting, because some of the changes there seem somewhat more likely
to expose bugs.

7 years agoAdd isFOO_utf8_safe() macros
Karl Williamson [Thu, 15 Dec 2016 23:30:27 +0000 (16:30 -0700)]
Add isFOO_utf8_safe() macros

The original API does not check that we aren't reading beyond the end of
a buffer, apparently assuming that we could keep malformed UTF-8 out by
use of gatekeepers, but that is currently impossible.  This commit adds
"safe" macros for determining if a UTF-8 sequence represents
an alphabetic, a digit, etc.  Each new macro has an extra parameter
pointing to the end of the sequence, so that looking beyond the input
string can be avoided.

The macros aren't currently completely safe, as they don't test that
there is at least a single valid byte in the input, except by an
assertion in DEBUGGING builds.  This is because typically they are
called in code that makes that assumption, and frequently tests the
current byte for one thing or another.

7 years agotoke.c: Avoid a conversion to/from UTF-8
Karl Williamson [Sat, 3 Dec 2016 19:14:33 +0000 (12:14 -0700)]
toke.c: Avoid a conversion to/from UTF-8

If the source file is encoded as UTF-8, we don't have to find its code
point equivalent when parsing--we can just copy it unchanged.  This
wasn't done before because of the fear the input would be malformed, and
finding the code point had the side effect of checking for
well-formedness.  The previous commit added wellformedness checking,
so doing it again here would be redundant.

7 years agoPATCH: [perl #126310] single quote UTF-8 malformation detection
Karl Williamson [Fri, 2 Dec 2016 16:35:53 +0000 (09:35 -0700)]
PATCH: [perl #126310] single quote UTF-8 malformation detection

This adds UTF-8 wellformedness checking in Perl_lex_next_chunk, which
should get called for all program text, so this makes sure the entire
program is well-formed, not just single- or double-quoted strings.

7 years agoDie on malformed isFOO_utf8() input
Karl Williamson [Thu, 8 Dec 2016 04:08:38 +0000 (21:08 -0700)]
Die on malformed isFOO_utf8() input

At the p5p core hackathon in November 2016, it was decided to make the
previous deprecation message fatal for malformed input passed to the
isFOO_utf8() macros and friends.

7 years agoUse fnc to force out malformed warnings
Karl Williamson [Fri, 9 Dec 2016 15:45:18 +0000 (08:45 -0700)]
Use fnc to force out malformed warnings

The previous commit added a function to do this task.  This current
commit changes the several places in the core that have here-to-fore
done this in an ad-hoc (and not as reliable) manner to use the new
function.

A couple of messages in toke.c are left in so as to avoid changing
diagnostics unnecessarily.  If those messages had been created in the
project after the enhanced malformation warnings were created, they
would have been phrased differently.

The reason some of the methods weren't so reliable, is they relied on
fatalizing the warnng message.  However if warnings are turned off, it
never gets to the point of outputting, hence doesn't necessarily die.

7 years agoAdd fnc to force out UTF-8 malform warnings at death
Karl Williamson [Thu, 8 Dec 2016 03:48:40 +0000 (20:48 -0700)]
Add fnc to force out UTF-8 malform warnings at death

The bottom level UTF-8 decode routine now generates detailed messages
when it encounters malformations.  In some instances these should be
treated as croak reasons and output even if warnings are off, just
before dying.  This commit adds a function to do this.

7 years agoSwitch most open() calls to three-argument form.
John Lightsey [Fri, 23 Dec 2016 17:35:45 +0000 (12:35 -0500)]
Switch most open() calls to three-argument form.

Switch from two-argument form.  Filehandle cloning is still done with the two
argument form for backward compatibility.

Committer:  Get all porting tests to pass.  Increment some $VERSIONs.
Run: ./perl -Ilib regen/mk_invlists.pl; ./perl -Ilib regen/regcharclass.pl

For: RT #130122

7 years agoSilence win32 compiler warning
Karl Williamson [Fri, 23 Dec 2016 01:36:33 +0000 (18:36 -0700)]
Silence win32 compiler warning

The function's parameter was not declared const in embed.fnc, but was in
the function itself.

7 years agotoke.c: Silence win32 compiler warning.
Karl Williamson [Fri, 23 Dec 2016 01:24:26 +0000 (18:24 -0700)]
toke.c: Silence win32 compiler warning.

7 years agoutf8.c Extract common code into macros
Karl Williamson [Sun, 18 Dec 2016 00:25:29 +0000 (17:25 -0700)]
utf8.c Extract common code into macros

The 3 case changing functions: to upper, lower, and title case are
essentially identical except for what they call to actually do the
change; those being different macros or functions.

The fourth function, to fold, is identical to the other three for the
first part of its code, but diverges at the end in order to handle some
special cases.

This commit replaces the first part of the bodies of these 4 functions
by a common macro.  And it replaces the remainder of the first 3
functions by another common macro.

I'm not a fan of this kind of macro to use in generating code, but it
seems the best way to keep these definitions in sync.  (It has to be a
macro instead of a function because one of the parameters is a macro,
which you can't pass to a function.  I suppose one could create
functions that just calls their macro, and get around it that way, but
it doesn't seem worth it.)

This commit just moved the code to the macro, and I manually verified
that there were no logic changes.

1 of the passed-in functions requires one less argument (the final one)
than the other 3.  I originally tried to do something with the C
preprocessor to get around that, but it didn't work with the Win32
version of the preprocessor, so I gave up and added a dummy parameter to
the fourth function, which is static so that's ok to do.  Below, for the
record is my original attempt:

    /* These two macros are used to make optional a parameter to the
     * passed-in function to the macros just above.  If the passed-in
     * function doesn't take the parameter, use PLACEHOLDER in the macro
     * call; otherwise surround the parameter by a PARAM() call */
    #define PARAM(parameter) ,parameter
    #define PLACEHOLDER    /* Something for the preprocessor to grab onto */

And within the macro, it called the function like this:

    L1_func(*p, ustrp, lenp/*,*/ L1_func_extra_param)

7 years agoAPItest/t/handy.t: Bring final special case into loop
Karl Williamson [Sun, 18 Dec 2016 20:38:01 +0000 (13:38 -0700)]
APItest/t/handy.t: Bring final special case into loop

All the tests in this file are now in two loops, one for the isFOO()
macros, and the other for the toFOO() macros.  Thus the main logic
applies to all, and tests can be added or changed easily.

7 years agoAPItest/t/handy.t: White-space only
Karl Williamson [Sun, 18 Dec 2016 20:17:45 +0000 (13:17 -0700)]
APItest/t/handy.t: White-space only

Indent newly formed block

7 years agoAPItest/t/handy.t: Add more tests
Karl Williamson [Sun, 18 Dec 2016 19:40:06 +0000 (12:40 -0700)]
APItest/t/handy.t: Add more tests

Macros with the '_uvchr' suffix were not being tested at all.  Instead,
the undocumented backwards-compatibility-only macros with the suffixes
_uni were being tested, but these might diverge, and the tests wouldn't
find that.

7 years agoAPItest/t/handy.t: Add more tests
Karl Williamson [Sun, 18 Dec 2016 18:55:49 +0000 (11:55 -0700)]
APItest/t/handy.t: Add more tests

The macros like isALPHA() were not getting tested; instead the theory
being that testing isALPHA_A() was good enough because they are #defined
to be the same.  But that might change and the tests wouldn't uncover
that.  And it turned out that some things wern't getting tested at all
if there was no _A version of the macro, for example isALNUM().  This
commit adds test for the version of the isFOO() macros with no suffix.

7 years agoAPItest/t/handy.t: Use abbrev. char name in test names
Karl Williamson [Sun, 18 Dec 2016 02:43:28 +0000 (19:43 -0700)]
APItest/t/handy.t: Use abbrev. char name in test names

I got tired of seeing all these long character names fly by on my screen
while testing, so this changes to use any official Unicode abbreviation
when available.  It's kind of silly to do this in this test, but I might
extract and improve this for more general use in tests of characters in
the future.

This also changes some imports so that the full module name need not
always be specified.

7 years agoAPItest/t/handy.t: White-space only
Karl Williamson [Sun, 18 Dec 2016 02:22:14 +0000 (19:22 -0700)]
APItest/t/handy.t: White-space only

indent newly formed block.

7 years agoAPItest/t/handy.t: Fold in another special case
Karl Williamson [Sun, 18 Dec 2016 02:19:39 +0000 (19:19 -0700)]
APItest/t/handy.t: Fold in another special case

The previous commit revamped this .t to make most things
part of a single loop.  This adds another thing that was outside it.

7 years agoAPItest/t/handy.t: Refactor for maintenance
Karl Williamson [Thu, 15 Dec 2016 23:12:30 +0000 (16:12 -0700)]
APItest/t/handy.t: Refactor for maintenance

Over the years code has kept getting copied and modified slightly in
each new place.  And a future commit would create still more.  This cuts
down the number of slightly different versions to the minimum reasonably
attainable.

7 years ago(perl #130335) fix numeric comparison for sort's built-in compare
Tony Cook [Wed, 14 Dec 2016 03:24:08 +0000 (14:24 +1100)]
(perl #130335) fix numeric comparison for sort's built-in compare

For non-'use integer' this would always compare as NVs, but with
64-bit integers and non-long doubles, integers can have more
significant digits, making the sort <=> replacement less precise
than the <=> operator.

Use the same code to perform the comparison that <=> does, which
happens to be handily broken out into Perl_do_ncmp().

7 years agoClarify use of 'continue' keyword after 'given'.
James E Keenan [Tue, 20 Dec 2016 23:27:36 +0000 (18:27 -0500)]
Clarify use of 'continue' keyword after 'given'.

For: RT #130324

7 years agot/uni/variables.t: Test what it purports to test
Karl Williamson [Thu, 22 Dec 2016 04:31:06 +0000 (21:31 -0700)]
t/uni/variables.t: Test what it purports to test

One of the tests wasn't testing what it thought it was, since evalbytes
downgrades the input if if is UTF-8 encoded.  Therefore, this needs to
use unicode_eval, as the other places in the .t that do similar things
use.

7 years agotoke.c: Simplify finding mirror-image close delimiter
Karl Williamson [Tue, 20 Dec 2016 20:07:23 +0000 (13:07 -0700)]
toke.c: Simplify finding mirror-image close delimiter

This is the code that figures out what the closing delimiter is for a
given opening string delimiter.  For most, it is the same character,
but for a few, it is a mirror-image character.

I have had to figure out multiple times how these couple lines of code
works.  This time, as I started to comment it, so I wouldn't have to do
figure it out again, I realized that its cleverness wasn't really saving
anything, and might slow things down.  So split into two parallel strings,
with one string containing the opening delimiters which have mirror
image closing ones, and the other containing those closing delimiters,
in the same order.  So we find the offset into the first string of the
opening delimiter.  If it isn't in that string, it isn't mirrored, but
if it does, the corresponding closing delimiter is found at the same
offset in the other string.

7 years agotoke.c: Skip some work for UTF-8 invariant
Karl Williamson [Tue, 20 Dec 2016 18:43:08 +0000 (11:43 -0700)]
toke.c: Skip some work for UTF-8 invariant

Since these chars are the same when encoded in UTF-8 as when not, no
need to do the extra UTF-8 work.

7 years agopod/perlop: Note that need space between op and \w delim
Karl Williamson [Tue, 20 Dec 2016 21:37:11 +0000 (14:37 -0700)]
pod/perlop: Note that need space between op and \w delim

You can't say qqXfooX because it thinks it is all one bareword.  Note
this, and that

    qq XfooX

works.

7 years agoPerlIO-scalar: Bump version to 0.26
Karl Williamson [Thu, 22 Dec 2016 17:53:56 +0000 (10:53 -0700)]
PerlIO-scalar: Bump version to 0.26

7 years agoPerlIOScalar_eof(): silence compiler warning:
David Mitchell [Thu, 22 Dec 2016 10:27:40 +0000 (10:27 +0000)]
PerlIOScalar_eof(): silence compiler warning:

    scalar.xs:23:15: warning: variable ā€˜pā€™ set but not used
    [-Wunused-but-set-variable]
         char *p;

I'm not sure why this has only started warning, but this commit shuts it
up anyway.

7 years agoDeck the halls
Chris 'BinGOs' Williams [Wed, 21 Dec 2016 13:59:31 +0000 (13:59 +0000)]
Deck the halls

7 years agoCorrect version number for Module::CoreList.
James E Keenan [Wed, 21 Dec 2016 13:29:25 +0000 (08:29 -0500)]
Correct version number for Module::CoreList.

7 years agoUpdate of Module::CoreList
Sawyer X [Wed, 21 Dec 2016 10:20:54 +0000 (11:20 +0100)]
Update of Module::CoreList

7 years agoMerge branch 'blead' of ssh://perl5.git.perl.org/perl into blead
Sawyer X [Wed, 21 Dec 2016 09:39:22 +0000 (10:39 +0100)]
Merge branch 'blead' of ssh://perl5.git.perl.org/perl into blead

7 years agoLink to epigraph
Sawyer X [Wed, 21 Dec 2016 09:39:15 +0000 (10:39 +0100)]
Link to epigraph

7 years agoBump Module::CoreList version following 5.25.8 release.
James E Keenan [Tue, 20 Dec 2016 23:07:55 +0000 (18:07 -0500)]
Bump Module::CoreList version following 5.25.8 release.

7 years agoBump the perl version in various places for 5.25.9
Sawyer X [Tue, 20 Dec 2016 20:19:08 +0000 (21:19 +0100)]
Bump the perl version in various places for 5.25.9

7 years agoNew perldelta
Sawyer X [Tue, 20 Dec 2016 19:36:47 +0000 (20:36 +0100)]
New perldelta

7 years agoTick off release
Sawyer X [Tue, 20 Dec 2016 19:31:35 +0000 (20:31 +0100)]
Tick off release

7 years agoUpdate epigraph. Will add link later
Sawyer X [Tue, 20 Dec 2016 19:31:04 +0000 (20:31 +0100)]
Update epigraph. Will add link later

7 years agoMerge branch 'release-5.25.8' into blead
Sawyer X [Tue, 20 Dec 2016 19:29:09 +0000 (20:29 +0100)]
Merge branch 'release-5.25.8' into blead

7 years agoperldelta: Fix typo
Karl Williamson [Tue, 20 Dec 2016 17:00:27 +0000 (10:00 -0700)]
perldelta: Fix typo

7 years agoadd new release to perlhist v5.25.8
Sawyer X [Tue, 20 Dec 2016 16:46:10 +0000 (17:46 +0100)]
add new release to perlhist

7 years agoPod typos
Sawyer X [Tue, 20 Dec 2016 16:27:02 +0000 (17:27 +0100)]
Pod typos

7 years agoUpdate perldelta for 5.25.8
Sawyer X [Tue, 20 Dec 2016 16:23:29 +0000 (17:23 +0100)]
Update perldelta for 5.25.8

7 years agoUpdate Module::CoreList for 5.25.8
Sawyer X [Tue, 20 Dec 2016 15:55:34 +0000 (16:55 +0100)]
Update Module::CoreList for 5.25.8

7 years agodocument removal of non-standard hash function build options in perldelta
Yves Orton [Tue, 20 Dec 2016 01:15:26 +0000 (02:15 +0100)]
document removal of non-standard hash function build options in perldelta

7 years agoutfebcdic.h: Fix typo in comment
Karl Williamson [Mon, 19 Dec 2016 21:04:10 +0000 (14:04 -0700)]
utfebcdic.h: Fix typo in comment

Spotted by Christian Hansen

7 years agoperlapi: Expand on utf8n_to_uvchr_error
Karl Williamson [Mon, 19 Dec 2016 20:25:20 +0000 (13:25 -0700)]
perlapi: Expand on utf8n_to_uvchr_error

7 years agoperlapi: Add explanation for why certain macros don't exist.
Karl Williamson [Sun, 18 Dec 2016 20:57:46 +0000 (13:57 -0700)]
perlapi: Add explanation for why certain macros don't exist.

This also fixes some orphaned references.

7 years agoUpdate Test-Simple to CPAN version 1.302073
Chris 'BinGOs' Williams [Mon, 19 Dec 2016 09:26:24 +0000 (09:26 +0000)]
Update Test-Simple to CPAN version 1.302073

7 years agoCorrect one spelling error.
James E Keenan [Sun, 18 Dec 2016 23:20:56 +0000 (18:20 -0500)]
Correct one spelling error.

7 years agoperldelta for 6b2c7479, dd688536
Tony Cook [Sun, 18 Dec 2016 22:28:18 +0000 (09:28 +1100)]
perldelta for 6b2c7479dd688536

7 years agoperldelta for Test-Simple 1.302067 to 1.302071.
James E Keenan [Sun, 18 Dec 2016 21:16:41 +0000 (16:16 -0500)]
perldelta for Test-Simple 1.302067 to 1.302071.

7 years agoUpgrade Test-Simple to 1.302071.
James E Keenan [Sun, 18 Dec 2016 14:01:09 +0000 (09:01 -0500)]
Upgrade Test-Simple to 1.302071.

Had to run ./perl -Ilib regen/lib_cleanup.pl.

7 years agoRevert "Update Socket to CPAN version 2.024."
James E Keenan [Sun, 18 Dec 2016 20:58:36 +0000 (15:58 -0500)]
Revert "Update Socket to CPAN version 2.024."

This reverts commit 3e7b45e4a2b8308f16a5ca9443c3f6b8caafe0a6.

Reason: test failures on Win32 not yet fully addressed.

7 years agoUpdate Archive-Tar to CPAN version 2.24
Chris 'BinGOs' Williams [Sun, 18 Dec 2016 11:50:16 +0000 (11:50 +0000)]
Update Archive-Tar to CPAN version 2.24

  [DELTA]

2.24  16/12/2016 (SREZIC)
- Handle tarballs compressed with pbzip2 (RT #119262)

7 years agoUpdate Socket to CPAN version 2.024.
James E Keenan [Sat, 17 Dec 2016 22:43:00 +0000 (17:43 -0500)]
Update Socket to CPAN version 2.024.

'porting/customized.t --regen' for Socket.pm and .xs

perldelta entry for Socket 2.020 to 2.024 upgrade.

7 years agoperldelta entry for Pod::Simple 3.32 to 3.35 upgrade.
James E Keenan [Sat, 17 Dec 2016 22:22:59 +0000 (17:22 -0500)]
perldelta entry for Pod::Simple 3.32 to 3.35 upgrade.

7 years agoUpdate Pod-Simple to CPAN version 3.35.
James E Keenan [Sat, 17 Dec 2016 22:14:13 +0000 (17:14 -0500)]
Update Pod-Simple to CPAN version 3.35.

From ChangeLog:  Stabilize t/search50.t (per rurban). Turn off utf8 warnings
when trying to see if a file is UTF-8 or not.

7 years agoregexes: make scanning for ANYOF faster
David Mitchell [Fri, 16 Dec 2016 13:07:58 +0000 (13:07 +0000)]
regexes: make scanning for ANYOF faster

Given a character class of random chars (like [acgt] say, rather than
predefined ones like [\d], say), speed up the code in:

1) S_find_byclass(), which scans for the first char in the string that's
   in that class (e.g. /[acgt]...../),
2) S_regrepeat() which scans past all chars that are in that class
   (e.g. /....[acgt]+..../)

by hoisting an unchanging test outside the main while loop. So this:

    while (s < end) {
        if (ANYOF_FLAGS(node))
            match = reginclass(*s, ...);
        else
            match = ANYOF_BITMAP_TEST(*s, ...);
        ...
    }

becomes this:

    if (ANYOF_FLAGS(node)) {
        while (s < end) {
            match = reginclass(*s, ...);
            ...
        }
    else
        while (s < end) {
            match = ANYOF_BITMAP_TEST(*s, ...);
            ...
        }
    }

The average of the 3 tests added to t/perf/benchmarks by this commit show
this change (raw numbers, lower better):

         before    after
       -------- --------
    Ir   3294.0   2763.0
    Dr    900.7    802.3
    Dw    356.0    390.0
  COND    569.0    436.7
   IND     11.0     11.0

COND_m      1.2      2.0
 IND_m      7.3      7.3

7 years agoUpdate Archive-Tar to CPAN version 2.22
Chris 'BinGOs' Williams [Fri, 16 Dec 2016 10:50:53 +0000 (10:50 +0000)]
Update Archive-Tar to CPAN version 2.22

  [DELTA]

2.22  16/12/2016 (MANWAR)
- Add missing strict/warnings pragma to Constants.pm

7 years agoUpdate bignum to CPAN version 0.47
Chris 'BinGOs' Williams [Thu, 15 Dec 2016 14:39:45 +0000 (14:39 +0000)]
Update bignum to CPAN version 0.47

7 years agoUpdate Math-BigRat to CPAN version 0.2611
Chris 'BinGOs' Williams [Thu, 15 Dec 2016 14:38:20 +0000 (14:38 +0000)]
Update Math-BigRat to CPAN version 0.2611

  [DELTA]

2016-12-13 v0.2611 pjacklam

 * Add more logic to Makefile.PL regarding INSTALLDIRS (CPAN RT #119199
   and #119225).

2016-12-11 v0.2610 pjacklam

 * Fix Makefile.PL so that this module installs over the core version.

7 years agoUpdate Math-BigInt-FastCalc to CPAN version 0.5005
Chris 'BinGOs' Williams [Thu, 15 Dec 2016 14:37:15 +0000 (14:37 +0000)]
Update Math-BigInt-FastCalc to CPAN version 0.5005

7 years agoUpdate Math-BigInt to CPAN version 1.999806
Chris 'BinGOs' Williams [Thu, 15 Dec 2016 14:35:53 +0000 (14:35 +0000)]
Update Math-BigInt to CPAN version 1.999806

  [DELTA]

2016-12-13 v1.999806 pjacklam

 * Add more logic to Makefile.PL regarding INSTALLDIRS (CPAN RT #119199
   and #119225).

 * In the TODO file, remove stuff that has been implemented.

2016-12-11 v1.999805 pjacklam

 * Fix Makefile.PL so that this module installs over the core version.

 * Add more tests for _nok() (binomial coefficient "n over k"). These new tests
   revealed some problems with some of the backend libraries when _nok() was
   given very large arguments.

 * Remove t/Math/BigFloat/#Subclass.pm#, which is an Emacs temporary file
   included by accident.

2016-12-07 v1.999804 pjacklam

 * Implement as_bytes(), as requested (CPAN RT 119096). Also implement the
   inverse conversion from_bytes(). This applies to Math::BigInt only. (Alas,
   these methods will be inherited from Math::BigInt into Math::BigFloat,
   Math::BigRat etc. where the methods won't work. Fixing this class
   relationship is an issue of its own.)

 * Implement _as_bytes() and _from_bytes() in Math::BigInt::Lib. Preferably,
   the various backend libraries will implement faster versions of their
   own. Add author test files for testing these methods thorougly.

 * Fix from_hex(), from_oct(), and from_bin().
   - When called as instance methods, the new value should be assigned to the
     invocand unless the invocand is read-only (a constant).
   - When called as instance methods, the assigned value was incorrect, if the
     invocand was inf or NaN.
   - Add tests to t/from_hex-mbf.t, t/from_oct-mbf.t, and t/from_bin-mbf.t
     to confirm the fix.
   - Add new test files t/from_hex-mbi.t, t/from_oct-mbi.t, and
     t/from_bin-mbi.t for better testing of these methods with Math::BigInt.

 * Correct typo in Math/BigInt/Lib.pm (otherise -> otherwise) (CPAN RT 118829).

 * Add POD coverage testing of Math::BigInt::Lib to t/03podcov.t.

7 years agoUpdate B-Debug to CPAN version 1.24
Chris 'BinGOs' Williams [Thu, 15 Dec 2016 14:32:39 +0000 (14:32 +0000)]
Update B-Debug to CPAN version 1.24

  [DELTA]

1.24 2016-12-11 rurban
  * add 5.25.6 support: split optimization

7 years agoUpdate Archive-Tar to CPAN version 2.20
Chris 'BinGOs' Williams [Thu, 15 Dec 2016 14:31:00 +0000 (14:31 +0000)]
Update Archive-Tar to CPAN version 2.20

  [DELTA]

2.20  15/12/2016 (AGRUNDMA)
- Check for gzip/bzip2 before round tripping gz/bz2 files in tests

7 years agoperlapi: Clarify entry for utf8n_to_uvchr()
Karl Williamson [Wed, 14 Dec 2016 18:38:12 +0000 (11:38 -0700)]
perlapi: Clarify entry for utf8n_to_uvchr()

7 years agoperlapi: Clarify the isFOO_A() macros meanings
Karl Williamson [Mon, 12 Dec 2016 03:30:33 +0000 (20:30 -0700)]
perlapi: Clarify the isFOO_A() macros meanings

7 years agoAPItest/t/utf8.t: Fix test name
Karl Williamson [Mon, 12 Dec 2016 00:31:59 +0000 (17:31 -0700)]
APItest/t/utf8.t: Fix test name

This test name gave the wrong function being tested.

7 years agoAPItest/t/utf8.t: White-space, comment only
Karl Williamson [Sat, 10 Dec 2016 19:18:50 +0000 (12:18 -0700)]
APItest/t/utf8.t: White-space, comment only

Wraps lines to fit in 79 columns, removes a comment for development that
shouldn't have been committed in the first place.

7 years agoAPItest/t/utf8.t: Use more idiomatic Perl
Karl Williamson [Sat, 10 Dec 2016 18:03:58 +0000 (11:03 -0700)]
APItest/t/utf8.t: Use more idiomatic Perl

This replaces

    unless(x) { y }

by

    x or y

Spotted by ilmari

7 years agoembed.fnc: Mark some functions as pure
Karl Williamson [Mon, 12 Dec 2016 16:38:24 +0000 (09:38 -0700)]
embed.fnc: Mark some functions as pure

Some of these were identified by me, and some by Andy Lester

7 years agoembed.fnc: Remove pure declaration for fcns that deal with SVs
Karl Williamson [Mon, 12 Dec 2016 21:50:34 +0000 (14:50 -0700)]
embed.fnc: Remove pure declaration for fcns that deal with SVs

These aren't actually pure, as dealing with SVs can trigger side
effects, including processing of magic.

7 years agoregen/embed.pl: Enforce static fcn can't be declared pure.
Karl Williamson [Mon, 12 Dec 2016 21:52:24 +0000 (14:52 -0700)]
regen/embed.pl: Enforce static fcn can't be declared pure.

7 years agoembed.fnc: Remove pure function flag for static functions
Karl Williamson [Mon, 12 Dec 2016 21:47:33 +0000 (14:47 -0700)]
embed.fnc: Remove pure function flag for static functions

As mentioned in the comments added in the commit immediately before this
one, declaring a static function pure doesn't tell the compiler anything
more than it can already figure out, and may be destructive if the
compiler decides to skip checking for pureness because we mistakenly
declared something pure that isn't

I added the R flag to the ones that didn't have it, as all these are run
to get their return values.

7 years agoembed.fnc: Add comments about pure attribute flag
Karl Williamson [Mon, 12 Dec 2016 21:43:19 +0000 (14:43 -0700)]
embed.fnc: Add comments about pure attribute flag

This notes some cautions about using it.

7 years agoregen/embed.pl: Keep parsing for some fatal issues
Karl Williamson [Mon, 12 Dec 2016 21:37:37 +0000 (14:37 -0700)]
regen/embed.pl: Keep parsing for some fatal issues

It's best to list all errors in a single run.  This creates a mechanism
to do so and uses it in a few places.

7 years agoperlapi: Document ckWARN-type macros
Karl Williamson [Mon, 12 Dec 2016 16:22:13 +0000 (09:22 -0700)]
perlapi: Document ckWARN-type macros

7 years agolocale.c: Silence compiler warning
Karl Williamson [Wed, 14 Dec 2016 16:38:29 +0000 (09:38 -0700)]
locale.c: Silence compiler warning

The FREEBSD compiler isn't smart enough to realize this isn't used
before setting.

7 years agoAPItest/t/utf16_to_utf8.t: Avoid use of Encode
Karl Williamson [Tue, 13 Dec 2016 22:27:37 +0000 (15:27 -0700)]
APItest/t/utf16_to_utf8.t: Avoid use of Encode

It's probably not a good idea to rely on a CPAN module's correctly
working to test something in core, but this does.  But it turns out that
there is a core equivalent to encoding UTF-8, utf8::encode(), which this
changes to use.  There are other uses of Encode here, but I don't have
the tuits to fix those.

The reason I'm fixing this at all, is that Encode 2.88 appears to have
broken encode("UTF-8") on EBCDIC platforms.  This change allows this to
be determined for sure, while removing one outside dependency from core.

7 years agoFix above-Unicode UTF-8 detection for EBCDIC
Karl Williamson [Tue, 13 Dec 2016 17:35:39 +0000 (10:35 -0700)]
Fix above-Unicode UTF-8 detection for EBCDIC

The root cause of this was missing parentheses causing (s[0] + 1) to be
evaluated instead of the desired s[1].  It was causing an error in
lib/warnings.t, but only on EBCDIC platforms.

7 years agoFix missing X in 2 embed.fnc entries
Karl Williamson [Mon, 12 Dec 2016 14:27:13 +0000 (07:27 -0700)]
Fix missing X in 2 embed.fnc entries

Commit 680b55f7dc3b143fa8c4cc5bbd905f9242504f3b should have had 'X' for
two entries that were missing it.

7 years ago[perl #130307] Correctly unwind on cache hit
Hugo van der Sanden [Mon, 12 Dec 2016 15:15:06 +0000 (15:15 +0000)]
[perl #130307] Correctly unwind on cache hit

We've already incremented curlyx.count in the WHILEM branch before
we check for a hit in the super-linear cache, so must reverse that
on the sayNO.

7 years agoperldelta - DAPM's recent significant changes
David Mitchell [Mon, 12 Dec 2016 13:20:40 +0000 (13:20 +0000)]
perldelta - DAPM's recent significant changes

7 years agoutf8.c: Silence compiler warning
Karl Williamson [Fri, 25 Nov 2016 15:35:30 +0000 (08:35 -0700)]
utf8.c: Silence compiler warning

This was generating a "comparison between signed and unsigned integer
expression" warning

7 years agoembed.fnc: Make some functions not flagged as 'A'
Karl Williamson [Sun, 11 Dec 2016 03:24:15 +0000 (20:24 -0700)]
embed.fnc: Make some functions not flagged as 'A'

As explained in the previous commit, I misunderstood the available scope
of functions not otherwise qualified by a flag.  This changes some of
them to correspond with my new understanding.

7 years agoembed.fnc: Add comments; wordsmith others
Karl Williamson [Sun, 11 Dec 2016 03:19:39 +0000 (20:19 -0700)]
embed.fnc: Add comments; wordsmith others

After some years of working on the Perl core, I did not realize that the
default for functions in this file is to make them invisible outside the
core.  I've jumped through hoops to try to do that, not realizing it was
automatic.  This adds comments so newbies don't make the same mistake.

And it rewords slightly various other comments.

7 years agoutfebcdic.h: Follow up to adding const qualifiers
Karl Williamson [Sun, 11 Dec 2016 02:16:56 +0000 (19:16 -0700)]
utfebcdic.h: Follow up to adding const qualifiers

This is a follow-up to commit 9f2eed981068e7abbcc52267863529bc59e9c8c0,
which manually added const qualifiers to some generated code in order to
avoid some compiler warnings.  The code changed by the other commit had
been hand-edited after being generated to add branch prediction, which
would be too hard to program in at this time, so the const additions
also had to be hand-edited in.

The commit just before this current one changed the generator to add the
const, and I then did comparisons by hand to make sure the only
differences were the branch predictions.  In doing so, I found one
missing const, plus a bunch of differences in the generated code for
EBCDIC 037.  We do not currently have a smoker for that system, so the
differences could be as a result of a previous error, or they could be
the result of the added 'const' causing the macro generator to split
things differently.  It splits in order to avoid size limits in some
preprocessors, and the extra 'const' tokens could have caused it to make
its splits differently.

Since we don't have any smokers for this, and no known actual systems
running it, I decided not to bother to hand-edit the output to add
branch prediction.

7 years agoregen/regcharclass.pl: Add const cast
Karl Williamson [Sun, 11 Dec 2016 02:09:19 +0000 (19:09 -0700)]
regen/regcharclass.pl: Add const cast

This is a follow-up to commit 9f2eed981068e7abbcc52267863529bc59e9c8c0,
which manually added const qualifiers to some generated code in order to
avoid some compiler warnings.  This changes the code generator to use
the same 'const' qualifier generally.  The code changed by the other
commit had been hand-edited after being generated to add branch
prediction, which would be too hard to program in at this time, so the
const additions also had to be hand-edited in.

7 years agoPATCH: [perl #37836] Simple Regex causes SEGV
Karl Williamson [Fri, 9 Dec 2016 05:01:16 +0000 (22:01 -0700)]
PATCH: [perl #37836] Simple Regex causes SEGV

As mentioned in the notes in the ticket, the test for this was wrong,
relying on an optimization in the regex compiler that avoided the
problematic code altogether.

When corrected, the test would not segfault, but does croak.  This is
because the regex engine croaks on malformed UTF-8, which this is.
croaking is probably the best option here, and has been in place for a
number of releases.  To fix the test, the pattern is modified by adding
a character to circumvent the optimization, and the croak is guarded by
a fresh_perl

7 years agotoke.c: Use strpbrk instead of sequential strchr()
Karl Williamson [Tue, 6 Dec 2016 17:16:10 +0000 (10:16 -0700)]
toke.c: Use strpbrk instead of sequential strchr()

    strpbrk("ABC")

does the same thing (faster) as

    strchr('A') || strchr('B') || strchr('C')

7 years agoregexec.c: Remove obsolete expression
Karl Williamson [Fri, 9 Dec 2016 20:47:27 +0000 (13:47 -0700)]
regexec.c: Remove obsolete expression

The flags here are obsolete, as UTF8_ALLOW_DEFAULT is what we want.
It allows no more than the and'ed UTF8_ALLOW_ANYUV.

7 years agoregexec.c: Remove use of obsolete flag
Karl Williamson [Fri, 9 Dec 2016 20:25:05 +0000 (13:25 -0700)]
regexec.c: Remove use of obsolete flag

This flag is now defined as 0, so it does nothing.  This is the final
use of it in core.

7 years agoio/perlio.t: Un-TODO now passing test
Karl Williamson [Sun, 11 Dec 2016 14:39:33 +0000 (07:39 -0700)]
io/perlio.t: Un-TODO now passing test

This was fixed by c47992b404786dcb8752239045e21cbcd7e3d103.

7 years agoPerlIO-scalar: Fix fail to detect incomplete seqs at EOF
Christian Hansen [Sun, 25 Mar 2012 23:23:39 +0000 (17:23 -0600)]
PerlIO-scalar: Fix fail to detect incomplete seqs at EOF

7 years agoReadability improvements.
James E Keenan [Sun, 11 Dec 2016 13:37:06 +0000 (08:37 -0500)]
Readability improvements.

Break one long paragraph into four.  Break some long sentences in two.
Correct one spelling error.  Use POD formatting more consistently on
'package'.

More for RT #129345

7 years agoyyparse(): extend parser stack before every shift.
David Mitchell [Sat, 10 Dec 2016 20:07:32 +0000 (20:07 +0000)]
yyparse(): extend parser stack before every shift.

This reverts v5.25.7-60-gb2c9b6e and adds a test.

In that previous commit of mine, for efficiency I changed it so that it
checked and extended the parser stack only after every reduce rather than
every shift, but when it did check, it extended it by at least 15 slots to
allow for all the elements of the longest possible rule to be shifted.

Turns out this was bad reasoning. The following type of code can shift
indefinitely without ever reducing:

    [{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{

7 years agomisaligned buffer with heredoc and /(?{...})/
David Mitchell [Sat, 10 Dec 2016 15:06:30 +0000 (15:06 +0000)]
misaligned buffer with heredoc and /(?{...})/

RT #129199

When an re_eval like /(?{...})/ is tokenised, as well as tokenising the
individual elements of the code, the whole src string is returned as a
constant too, to enable the stringification of the regex to be calculated.
For example,

    /abc(?{$x})def/

is tokenised like

    MATCH '('
        CONST('abc')
        DO  '{'  '$'  CONST('x') '}'
        ','
        CONST('(?{$x})')
        ','
        CONST('def'),
    ')'

If the code within the (?{...}) contains a heredoc (<<) and the PL_linestr
buffer happens to get reallocated, the pointer which points to the start
of the code string will get adjusted using the wrong buffer pointer.
Later when the end of the code is reached and the whole code string '(?{$x})'
is copied to a new SV, garbage may get copied (or it may panic with -ve
length, out of memory etc). Note that this garbage will only used for the
string representation of the regex, e.g.

    my $r = qr/abc(?{$x})def/;
    print "$r"; # garbage used here
    /xyz$r/;    # garbage not used here

7 years agoRemove directory depth check from configure.com.
Craig A. Berry [Fri, 9 Dec 2016 22:58:25 +0000 (16:58 -0600)]
Remove directory depth check from configure.com.

The limit of 8 levels deep was lifted well over a decade ago and
thus does not apply to any currently-supported VMS systems.

7 years agoFix i64size and u64size on VMS.
Craig A. Berry [Fri, 9 Dec 2016 22:54:20 +0000 (16:54 -0600)]
Fix i64size and u64size on VMS.

These are always 8 bytes and, since VAX is no longer supported,
always defined, so don't make them conditional on -Duse64bitint.