This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perl5.git
10 years agohandy.h: Add two macros
Karl Williamson [Wed, 1 Jan 2014 05:35:46 +0000 (22:35 -0700)]
handy.h: Add two macros

handy.h contains a macro that reads a hex digit and returns its value,
with fewer branches than a naive implementation would use.  This commit
just copies and modifies it to create two macros for
    1) just converting the hex value, without advancing the input; and
    2) doing the same for an octal value.

10 years agohandy.h: Add debugging assertion
Karl Williamson [Wed, 1 Jan 2014 05:19:45 +0000 (22:19 -0700)]
handy.h: Add debugging assertion

This macro requires the input to be a hex digit, without testing.  It is
prudent to assert that under DEBUGGING.

10 years agoMove a macro from utf8.h to handy.h for wider use.
Karl Williamson [Wed, 1 Jan 2014 05:13:06 +0000 (22:13 -0700)]
Move a macro from utf8.h to handy.h for wider use.

Future commits will want this available outside utf8.h

10 years agoregen/warnings.pl: Add comments
Karl Williamson [Wed, 1 Jan 2014 04:57:53 +0000 (21:57 -0700)]
regen/warnings.pl: Add comments

These note that warnings categories should be independent in the calls
to ckWARN() and packWARN() type macros.

10 years agoext/XS-APItest/t/utf8.t: White-space only
Karl Williamson [Wed, 1 Jan 2014 05:05:45 +0000 (22:05 -0700)]
ext/XS-APItest/t/utf8.t: White-space only

Indent and reflow to fit into 79 columns due to a new enclosing block in
the previous commit

10 years agoutf8.c: Fix warning category and subcategory conflicts
Karl Williamson [Wed, 1 Jan 2014 04:45:54 +0000 (21:45 -0700)]
utf8.c: Fix warning category and subcategory conflicts

The warnings categories non_unicode, nonchar, and surrogate are all
subcategories of 'utf8'.  One should never call a packWARN() with both a
category and a subcategory of it, as it will mean that one can't
completely make the subcategory independent.  For example,

    use warnings 'utf8';
    no warnings 'surrogate';

surrogate warnings will be output if they are tested with a

    ckWARN2(WARN_UTF8, WARN_SURROGATE);

utf8.c was guilty of this.

10 years agoutf8.c: Don't do redundant test
Karl Williamson [Wed, 1 Jan 2014 04:41:09 +0000 (21:41 -0700)]
utf8.c: Don't do redundant test

The test here for WARN_UTF8 is redundant, as only if one of the other
three warning categories is enabled will anything actually be output.

10 years agoutf8.c: Typo in comment, and clarification
Karl Williamson [Wed, 1 Jan 2014 04:37:52 +0000 (21:37 -0700)]
utf8.c: Typo in comment, and clarification

10 years agoUnicode::UCD::prop_aliases(): Don't generate spurious warnings
Karl Williamson [Tue, 31 Dec 2013 19:30:35 +0000 (12:30 -0700)]
Unicode::UCD::prop_aliases(): Don't generate spurious warnings

Certain inputs to prop_aliases caused spurious warning.

10 years agot/test.pl: Reword comment
Karl Williamson [Wed, 1 Jan 2014 19:58:05 +0000 (12:58 -0700)]
t/test.pl: Reword comment

There was a typo in this comment, but looking at it closely made me
realize that I didn't really understand it.  This clarifies it.

10 years agoperl5180delta: typos
Dominic Hargreaves [Wed, 1 Jan 2014 19:45:35 +0000 (19:45 +0000)]
perl5180delta: typos

10 years agoregexec.c: Clarify comment
Karl Williamson [Wed, 1 Jan 2014 18:36:17 +0000 (11:36 -0700)]
regexec.c: Clarify comment

10 years agoregexec.c: Guard against malformed UTF-8 in [...]
Karl Williamson [Wed, 1 Jan 2014 16:59:20 +0000 (09:59 -0700)]
regexec.c: Guard against malformed UTF-8 in [...]

The code that handles bracketed character classes assumed that the
string being matched against did not have the too-short malformation;
this could lead to reading beyond-the-end-of-buffer.  (It did check for
other malformations.)  This is solved by changing the function that
operates on bracketed character classes to take and use an extra
parameter, the actaul buffer end.

10 years agopp.c: Remove unnecessary mask operation.
Karl Williamson [Wed, 1 Jan 2014 16:52:55 +0000 (09:52 -0700)]
pp.c: Remove unnecessary mask operation.

An unsigned character (U8) should not have more than 8 bits of data, so
no need to force that by masking with 0xFF.

10 years agopp.c: Guard against malformed UTF-8 input in ord()
Karl Williamson [Wed, 1 Jan 2014 16:49:04 +0000 (09:49 -0700)]
pp.c: Guard against malformed UTF-8 input in ord()

This code got the actual length of the input scalar, but discarded it.
If that scalar contains malformed UTF-8 that has fewer bytes than is
indicated, a read beyond-buffer-end could happen.  Simply use the actual
length.

10 years agoRegenerated Configure after backports
H.Merijn Brand [Wed, 1 Jan 2014 17:32:50 +0000 (18:32 +0100)]
Regenerated Configure after backports

10 years agopp.c: Simplify lc and uc stringification code
Father Chrysostomos [Wed, 1 Jan 2014 14:06:30 +0000 (06:06 -0800)]
pp.c: Simplify lc and uc stringification code

Originally, lc and uc would not warn about undef, due to an implemen-
tation detail.

The implementation changed in 673061948, and extra code was added to
keep the behaviour the same.

Commit 0a0ffbced enabled the warnings about undef, but did so by added
even more code in the midst of the blocks that existed solely to avoid
the warning.

We can just delete those blocks and put in a simple stringification.

10 years agopp.c: Improve self-referential comment
Father Chrysostomos [Wed, 1 Jan 2014 13:56:15 +0000 (05:56 -0800)]
pp.c: Improve self-referential comment

pp.c:pp_lc has this:

    /* Here is where we would do context-sensitive actions.  See the
     * commit message for this comment for why there isn't any */

If I try to look up the commit that added the comment, I get this:

commit 06b5486afd6f58eb7fdf8c5c8cdb8520a4c87f40
Author: Karl Williamson <public@khwilliamson.com>
Date:   Fri Nov 11 10:13:28 2011 -0700

    pp.c: White-space only

    This outdents and reflows comments as a result of the removal of a
    surrounding block

86510fb15 was the commit that added the comment, whose commit message
contains the explanation, so cite that directly.

10 years agoReënable in-place lc/uc
Father Chrysostomos [Wed, 1 Jan 2014 13:51:36 +0000 (05:51 -0800)]
Reënable in-place lc/uc

It used to be that this code:

for("$foo") {
  lc $_;
  ...
}

would modify $_, allowing other code in the ‘for’ block to see the
changes (bug #43207).  Commit 17fa077605 fixed that by changing the
logic that determined whether lc/uc(first) could modify the sca-
lar in place.

In doing so, it stopped in-place modification from happening at all,
because the condition became SvPADTMP && SvTEMP, which never happens.

(SvPADTMP unually indicates an operator return value stored in a pad;
i.e., a scalar that will next be used by the same operator again to
return another value.  SvTEMP indicates that the REFCNT will go down
shortly, usually a temporary value created solely for the sake of
returning something.)

Now that bug #78194 is fixed, for("$foo") no longer exposes a PADTMP
to the following code, so we *can* now assume (as was done erroneously
before) that PADTMP indicates something like lc("$foo$bar") and modify
pp_stringify’s return value in place.

Also, we can extend this to apply to TEMP variables that have a ref-
erence count of 1, since they cannot be in use elsewhere.  We skip
TEMP variables with set-magic, because they could be tied, and
SvSETMAGIC would have a side effect.  (That could happen with
lc(delete $h{tied_elem}).)

Previously, this was skipped for uc and lc for overloaded references,
since stringification could change the utf8ness.  That is no longer
sufficient.  As of Perl 5.16, typeglobs and non-overloaded blessed
references can also enable their utf8 flag upon stringification, if
the stash or glob names contains wide characters.  So I changed the
!SvAMAGIC (not overloaded) to SvPOK (is a string already), which will
cover most cases where this optimisation helps.  The two tests added
to the end of lc.t fail with !SvAMAGIC.

10 years agolc.t: More tests for #43207
Father Chrysostomos [Tue, 31 Dec 2013 05:29:49 +0000 (21:29 -0800)]
lc.t: More tests for #43207

10 years agoUpdate Time-Piece to CPAN version 1.26
Chris 'BinGOs' Williams [Wed, 1 Jan 2014 09:03:39 +0000 (09:03 +0000)]
Update Time-Piece to CPAN version 1.26

  [DELTA]

1.26      2013-12-29
        - no changes since previous (trial) release

1.25_01   2013-12-16
        - fix compiling for WinCE, execution is untested
        - add a .gitignore (from Win32::API)
        - fix a compiler warning about unused var, and add inlining
        - add PERL_NO_GET_CONTEXT to XS to bring the binary into 21st century
        - refactor XS code to remove large sections of duplicate machine code
        - fix _crt_localtime to return year only once, previously
          _crt_localtime returned year (item #6) twice in the list

10 years agoregexec.c: Remove redundant test
Karl Williamson [Tue, 31 Dec 2013 15:42:27 +0000 (08:42 -0700)]
regexec.c: Remove redundant test

A string must be in utf8 format if the first code point that came from
it is above 255; therefore it is redundant to test for both.

10 years agoPATCH [perl #120901] perlbug.PL - Add to user feedback/docs
Martin McGrath [Tue, 31 Dec 2013 16:22:28 +0000 (09:22 -0700)]
PATCH [perl #120901] perlbug.PL - Add to user feedback/docs

10 years agoMerge branch into blead that changes \p above-Unicode behavior
Karl Williamson [Tue, 31 Dec 2013 15:28:20 +0000 (08:28 -0700)]
Merge branch into blead that changes \p above-Unicode behavior

This changes the behavior of Unicode property matching for above-Unicode
code points.  It changes the format of mktables output tables for binary
properties for efficiency, eliminating a pass while reading them in.
It changes the format somewhat of the output tables when output for
debugging purposes so that they no longer fail some tests.

10 years agoRemove no-longer used inversion list function
Karl Williamson [Sun, 29 Dec 2013 04:36:58 +0000 (21:36 -0700)]
Remove no-longer used inversion list function

The function _invlist_invert_prop() is hereby removed.  The recent
changes to allow \p{} to match above-Unicode means that no special
handling of properties need be done when inverting.

This function was accessible to XS code that cheated by using #defines
to pretend it was something it wasn't, but it also has been marked
as subject to change since its inception, and never appeared in any
documentation.

10 years agoWhite-space only
Karl Williamson [Thu, 26 Dec 2013 21:01:49 +0000 (14:01 -0700)]
White-space only

This indents various newly-formed blocks (by the previous commit) in
these three files, and reflows lines to fit into 79 columns

10 years agoChange format of mktables output binary property tables
Karl Williamson [Wed, 25 Dec 2013 03:11:23 +0000 (20:11 -0700)]
Change format of mktables output binary property tables

mktables now outputs the tables for binary properties as inversion
lists, with a size as the first element.  This means simpler handling of
these tables in the core, including removal of an entire pass over them
(it was done just to get the size).  These tables are marked as for
internal use by the Perl core only, so their format is changeable at
will.

10 years agoChange \p{} matching for above-Unicode code points
Karl Williamson [Tue, 24 Dec 2013 03:35:54 +0000 (20:35 -0700)]
Change \p{} matching for above-Unicode code points

http://markmail.org/message/eod7ukhbbh5tnll4 is the beginning of the
thread that led to this commit.

This commit revises the handling of \p{} and \P{} to treat above-Unicode
code points as typical Unicode unassigned ones, and only output a
warning during matching when the answer is arguable under strict Unicode
rules (that is "matched" for \p{}, and "didn't match" for \P{}).  The
exception is if the warning category has been made fatal, then it tries
hard to always output the warning.  The definition of \p{All} is changed
to be qr/./s, and no warning is issued at all for matching it against
above-Unicode code points.

10 years agoregcomp.c: comment typo and rewording
Karl Williamson [Thu, 19 Dec 2013 05:57:55 +0000 (22:57 -0700)]
regcomp.c: comment typo and rewording

10 years agoregcomp.c: Refactor 'if' statement
Karl Williamson [Thu, 19 Dec 2013 05:53:46 +0000 (22:53 -0700)]
regcomp.c: Refactor 'if' statement

This refactoring makes it clear that within a (?[]), we don't try to
optimize the [] part.  This is for clarity for the future only, as
currently the only changed behavior is if this is being compiled with /l
rules, and (?[]) generates a syntax error under /l.

10 years agoFatalized non-unicode warnings skip regex optimization
Karl Williamson [Thu, 19 Dec 2013 05:41:35 +0000 (22:41 -0700)]
Fatalized non-unicode warnings skip regex optimization

This makes sure that fatalized non-unicode warnings actually get output.
For example \p{Line_Break=CR} would normally get optimized into an EXACT
node.  But if the user has made non-unicode warnings fatal indicating
they want to be sure not to try to even match such code points, the
optimization is skipped so that the checks are made.

Documentation for this change will be in a future commit.

10 years agomktables: Split off some functionality
Karl Williamson [Wed, 27 Nov 2013 19:16:25 +0000 (12:16 -0700)]
mktables: Split off some functionality

This adds a new function that formats a count of code points.  Currently
it calls the current function that formats a generic number.  A future
commit will change so that the output of the two functions differ.  The
reason for this commit is to make that later commit's difference listing
smaller and easier to understand.

10 years agomktables: Add \p{Unicode}
Karl Williamson [Wed, 27 Nov 2013 18:39:48 +0000 (11:39 -0700)]
mktables: Add \p{Unicode}

This is a clearer synonym for \p{Any}

10 years agomktables: Separate out defns of \p{Any} and \p{All}
Karl Williamson [Wed, 27 Nov 2013 17:59:08 +0000 (10:59 -0700)]
mktables: Separate out defns of \p{Any} and \p{All}

This is in preparation to making them mean different things, in a future
commit

10 years agoregcomp.h: Reorder some #defines
Karl Williamson [Tue, 26 Nov 2013 03:18:31 +0000 (20:18 -0700)]
regcomp.h: Reorder some #defines

There are no logic changes.  The previous commit changed the numbers for
some of the bits.  This commit re-arranges things so that the #defines
are again in numerical order.

10 years agoRe-order some flag bits to avoid potential branches
Karl Williamson [Tue, 26 Nov 2013 03:12:33 +0000 (20:12 -0700)]
Re-order some flag bits to avoid potential branches

The ANYOF_INVERT flag is used in every single pattern match of
[bracketed character classes].  With backtracking, this can be a huge
number.  All the other flags' uses pale by comparison.  I noticed that
by making it the lowest bit, we don't have to use CBOOL, as the only
possibilities are 0 and 1.  cBOOL hopefully will be optimized away, but
not always.  This commit reorders some of the flag bits to make this one
the lowest, and adds a compile check to make sure it isn't inadvertently
changed.

10 years agoOutput regex above-Unicode matching in syn strt class
Karl Williamson [Mon, 30 Dec 2013 22:16:57 +0000 (15:16 -0700)]
Output regex above-Unicode matching in syn strt class

A warning is supposed to be raised under some conditions when matching
an above-Unicode code point against a Unicode property.  Prior to this
patch, if the synthetic start class excluded the code point, the warning
would be skipped, even though it was attempted to be matched.

10 years agoConvert regnode to a flag for [...]
Karl Williamson [Tue, 26 Nov 2013 02:40:12 +0000 (19:40 -0700)]
Convert regnode to a flag for [...]

Prior to this commit, there were 3 types of ANYOF nodes; now there are
two: regular, and one for the synthetic start class (ssc).  This commit
converted the third type dealing with warning about matching \p{}
against non-Unicode code points, into using the spare flag bit for ANYOF
nodes.

This allows this bit to apply to ssc ANYOF nodes, whereas previously it
couldn't.  There is a bug in which the warning isn't raised if the match
is rejected by the optimizer, because of this inability.  This bug will
be fixed in a later commit.

Another option would have been to create a new node-type which was an
ANYOF_SSC_WARN_SUPER node.  But this adds extra complications to things;
and we have a spare bit that we might as well use.  The comments give
better possibilities for freeing up 2 bits should they be needed.

10 years agoregcomp.c: Split #define into two
Karl Williamson [Mon, 30 Dec 2013 22:04:37 +0000 (15:04 -0700)]
regcomp.c: Split #define into two

The syntethic start class regnode (SSC) and a bracketed character class
node share much of the same data structure, including a flags field,
and some of the same flag bits within it.  Currently, only
locale-related flags (under /l rules) are the same between the two
during construction of the SSC.  But a future commit will introduce
another common flag.  This commit creates an extra #define for use where
we want the common flags, while retaining the existing one for use where
we want the locale flags.  The new #define is just a copy of the
existing one, to be changed in the future commit.

10 years agomktables: Better comment some variables
Karl Williamson [Tue, 26 Nov 2013 02:31:57 +0000 (19:31 -0700)]
mktables: Better comment some variables

10 years agomktables: Calculate debugging information placement
Karl Williamson [Fri, 15 Nov 2013 04:12:40 +0000 (21:12 -0700)]
mktables: Calculate debugging information placement

When outputting debugging information under the -annotate option, it's
nice to line up the columns.  This commit does a pass through the tables
where the final real data column is variable width so that it can figure
out where to put the debugging info so as almost all of the columns can
be lined up, and not have to be right-shifted because of overlong real
data.

Certain tables prior to this commit had been manually eyeballed and
column information hard-coded in.  This is no longer necessary.  This
means that one parameter to the write() function is no longer used, and
is removed here.

10 years agomktables: White-space only
Karl Williamson [Fri, 15 Nov 2013 02:30:42 +0000 (19:30 -0700)]
mktables: White-space only

Outdent a just-removed block, and better align several other statements

10 years agomktables: Convert to use new function
Karl Williamson [Fri, 15 Nov 2013 02:32:44 +0000 (19:32 -0700)]
mktables: Convert to use new function

The previous commit added a new function used in newly added code; this
changes some existing code to use that function

10 years agomktables: Don't change table format with debugging info
Karl Williamson [Thu, 14 Nov 2013 04:56:31 +0000 (21:56 -0700)]
mktables: Don't change table format with debugging info

The -annotate option to mktables causes it to output extra information
(in the form of comments) to its generated tables to make them human
readable and useful for debugging.  Prior to this commit, this caused
the tables' formats to be changed somewhat by causing what normally
ranges to have a line output for each element of the range.  This bloats
the tables, and causes UCD.t to fail, as it is looking for a
particular syntax for the tables.

This commit causes the debugging information to be placed separately
but adjacent to the real data.  The ranges remain as they would be
without -annotate.  This removes the bloat (as the debugging info is
stripped out as the table is read in) and causes UCD.t to pass.

It also allows for the format of the real data to change in a later
commit, and the debugging info can remain relevant.

A future commit will improve the indentation of the comment annotations

10 years agomktables: Improve display of debugging information
Karl Williamson [Tue, 12 Nov 2013 19:09:19 +0000 (12:09 -0700)]
mktables: Improve display of debugging information

Under the -annotate option, mktables outputs the UTF-8 for the printable
characters.  This commit adds a non-spacing blank before each such one
that is supposed to combine with its preceding character (marks).  This
causes the display of the character to look better.

This necessitated making a local variable more global in scope.

10 years agolib/Unicode/UCD.t: White-space only
Karl Williamson [Fri, 8 Nov 2013 16:34:54 +0000 (09:34 -0700)]
lib/Unicode/UCD.t: White-space only

Indent a newly formed block

10 years agoAdd tests for legacy Unicode data files
Karl Williamson [Fri, 8 Nov 2013 16:26:51 +0000 (09:26 -0700)]
Add tests for legacy Unicode data files

There are 5 files in lib/unicore/To that may be in direct use by
applications, and which are not used by Perl itself.  These have been
changed in an earlier stable release to have comments in them saying,
their use is deprecated, and that Unicode::UCD gives a stable API for
access to the data they contain.  However, no warning is given if an
application reads these files, so the deprecation cycle needs to be
quite long.  Until we decide to get rid of these files sometime in the
future, we should make sure they exist and are correct.  Since they
aren't actually used by Perl, there were no such tests.  This commit
adds some tests.  It puts them in lib/Unicode/UCD.t, as that required
the least amount of work, as it already has nearly all the
infrastructure required for testing these.

10 years agolib/Unicode/UCD.t: Anchor a couple of regexes
Karl Williamson [Fri, 8 Nov 2013 16:21:11 +0000 (09:21 -0700)]
lib/Unicode/UCD.t: Anchor a couple of regexes

A future commit will need these to be anchored to avoid false positives.

10 years agolib/Unicode/UCD.t: Clarify diagnostic
Karl Williamson [Thu, 7 Nov 2013 19:38:31 +0000 (12:38 -0700)]
lib/Unicode/UCD.t: Clarify diagnostic

This diagnostic comes from either of 2 problems, so mention both of
them.

10 years agolib/Unicode/UCD.t: Rename a $variable
Karl Williamson [Thu, 7 Nov 2013 18:56:09 +0000 (11:56 -0700)]
lib/Unicode/UCD.t: Rename a $variable

This is in preparation for a future commit where the new name makes more
sense.

10 years agoUnicode/UCD.t: Add missing 'next' statement
Karl Williamson [Wed, 6 Nov 2013 17:56:07 +0000 (10:56 -0700)]
Unicode/UCD.t: Add missing 'next' statement

When a test fails, it should do a 'next' to stop processing the current
property.

10 years agomktables: White-space only
Karl Williamson [Wed, 6 Nov 2013 05:52:10 +0000 (22:52 -0700)]
mktables: White-space only

Align a few lines to begin on same column which has been outdented so
nothing exceeds 79 columns

10 years agoUnicode::UCD: Remove access to some legacy-only properties
Karl Williamson [Wed, 6 Nov 2013 05:33:06 +0000 (22:33 -0700)]
Unicode::UCD: Remove access to some legacy-only properties

Five files are currently being kept around only because they existed
before Unicode::UCD gave access to the properties they define, and some
application programs may rely on their presence, and format.  More
compact files have supplanted the use of these files by the Perl core.

Mistakenly, Unicode::UCD gave access to these files via the made-up
property names that they are referred to by in mktables.  This was
undocumented.  This commit removes this access.

10 years agomktables: Clarify overloaded variable name
Karl Williamson [Mon, 4 Nov 2013 16:57:29 +0000 (09:57 -0700)]
mktables: Clarify overloaded variable name

The term 'full' is overloaded here in this small section of code.  In
some cases it refers to the full case mapping versus the simple case
mapping; in other cases it refers to the full name for a property as
opposed to the abbreviated name.  This commit expands each to indicate
which is meant.

10 years agomktables, UCD.t: Fix nits in comments; add comment
Karl Williamson [Sun, 3 Nov 2013 05:22:48 +0000 (23:22 -0600)]
mktables, UCD.t: Fix nits in comments; add comment

10 years agomktables: Don't output trailing tabs in tables
Karl Williamson [Tue, 29 Oct 2013 01:49:55 +0000 (19:49 -0600)]
mktables: Don't output trailing tabs in tables

This makes sure that the tabs aren't output unless there is a following
non-null value, saving some disk space

10 years agoUnicode/UCD.t: white-space, comments
Karl Williamson [Mon, 28 Oct 2013 23:00:25 +0000 (17:00 -0600)]
Unicode/UCD.t: white-space, comments

Wrap to 79 columns; add a comment

10 years agomktables: Stop generating most leading zeros
Karl Williamson [Mon, 28 Oct 2013 22:43:01 +0000 (16:43 -0600)]
mktables: Stop generating most leading zeros

Leading zeros were generated to conform with Unicode usage, but these
are machine-read files so this just takes up some extra space and extra
parsing cycles at run-time.  It's a small matter, but we should design
our files to be the most efficient possible.  It is possible to get more
human-readable files by using the -annotate option to mktables.

Certain files whose existence has been published have their formats
unchanged, in case some application is reading them.  The files contain
comments that their use is deprecated, but there is no warning generated
if they are opened and read, nor is it really feasible to add such a
warning.  At some time in the future, we may feel it's ok to remove
these files, as their contents have been available since v5.16 through a
stable API in Unicode::UCD, but until we remove them, we shouldn't
change their formats.

Not all other leading zeros are removed; just the ones that were
convenient to remove.

10 years agomktables: Further explain how things work in a comment
Karl Williamson [Sun, 20 Oct 2013 16:57:21 +0000 (10:57 -0600)]
mktables: Further explain how things work in a comment

10 years agomktables: Add an advisory comment to generated files.
Karl Williamson [Sun, 20 Oct 2013 16:27:42 +0000 (10:27 -0600)]
mktables: Add an advisory comment to generated files.

10 years agomktables: Regenerate if called with different cmd line args
Karl Williamson [Sun, 20 Oct 2013 16:20:13 +0000 (10:20 -0600)]
mktables: Regenerate if called with different cmd line args

mktables acts pretty much like its own Makefile.  This is because the
rules for regenerating are complicated and too hard to keep in sync in a
Makefile with new versions of Unicode.  mktables itself already has
enough intelligence to automatically update the rules when it gets
modified to account for new files from Unicode.

However, prior to this commit, it didn't keep track of the options it
was called with, thus it wouldn't necessarily run when those options
changed to affect the desired outputs.

10 years agomktables: Tighten regex match to real data
Karl Williamson [Sun, 20 Oct 2013 16:13:39 +0000 (10:13 -0600)]
mktables: Tighten regex match to real data

The actual file has spaces, so use \s instead of the more dangerous dot.
Also, after processing the line, no need to look to see if it matches
something else.

10 years agomktables: Fixup debugging info
Karl Williamson [Fri, 18 Oct 2013 02:05:18 +0000 (20:05 -0600)]
mktables: Fixup debugging info

The -annotate parameter generates extra information in the tables
created by mktables which is useful to me in understanding the Unicode
standard and debugging.  I doubt that anyone else has ever used it.  It
has been broken for some tables for some time.  This commit fixes those.

10 years agomktables: Always strip off returned comments in tables
Karl Williamson [Mon, 30 Dec 2013 22:43:12 +0000 (15:43 -0700)]
mktables: Always strip off returned comments in tables

mktables generates (among other things) many perl .pl files which when
executed, return a string containing many lines.  Each line may end
with '#' comments.  Previously, it didn't always strip off those
comments to the caller, which it assumed uses a 'do' statement to
execute these, and the comments are automatically ignored.  However, it
turns out that the 'mkheader' script in Unicode::Normalize doesn't cope
with these comments.  This usually doesn't get called except once when
normally these comments aren't generated, but if it does, things don't
just compile.  So, just strip off the comments, rather than letting the
'do' handle it.

10 years agomktables: White-space only: wrap to 79 cols
Karl Williamson [Fri, 18 Oct 2013 02:03:52 +0000 (20:03 -0600)]
mktables: White-space only: wrap to 79 cols

10 years agoregcomp.c: Add comments
Karl Williamson [Tue, 31 Dec 2013 15:06:17 +0000 (08:06 -0700)]
regcomp.c: Add comments

10 years agoregcomp.c: Reinstate use of synthetic start class
Karl Williamson [Sun, 29 Dec 2013 04:48:57 +0000 (21:48 -0700)]
regcomp.c: Reinstate use of synthetic start class

This effectively reverts commit
a74bca75951b6a3b0ad03ba07eb31e2ca1227308, although the syntax has
changed.  This commit inadvertently caused a synthetic start class (SSC)
to not be generated in many cases where it previously was.  The
SSC is generated by the regex optimizer to hopefully speed up finding
where to start matching the target string against the regex pattern.  I
don't know if this is a valid data point, but in the 3 months that this
was in blead, there were no complaints of a slowdown that could be
attributed to this.

The commit that caused this was made after discussing it with Yves
Orton.  It just seemed (and still seems) wrong that doing what the code
indicates is a logical OR should actually restrict the possibilities.
The change essentially caused the result of OR'ing together the matches
of two nodes, one of which nominally could match a sub-string of zero
length, to also match a sub-string of zero length.  Previous to that
commit, and after this new one, the result of doing the OR excludes a
zero-length string, as if it were an AND.

The end result of the change was that the SSC could match a zero-length
string, and thus was discarded as not being useful.  Yves and I knew
that the change would not cause bugs; just potentially create more false
positives.  And we were right.

I believe that this is further indication that the optimizer could
benefit greatly from an overhaul.  It's clear from looking at the code
and commits that other people have been similarly fooled.

10 years agotoke.c: Remove redundant check
Father Chrysostomos [Tue, 31 Dec 2013 05:18:54 +0000 (21:18 -0800)]
toke.c: Remove redundant check

(and turn it into an assertion.)

PL_lex_repl can only be set here if we are parsing a substitution
(OP_SUBST) or transliteration (OP_TRANS).  I believe this check
has been unnecessary since perl 5.000, which it was added.

10 years agoImprove rcatline bad fh warnings
Father Chrysostomos [Mon, 30 Dec 2013 01:11:24 +0000 (17:11 -0800)]
Improve rcatline bad fh warnings

This is not helpful:

append I/O operator() on closed filehandle STDIN at - line 3.
append I/O operator() on closed filehandle STDIN at - line 4.
(Are you trying to call append I/O operator() on dirhandle STDIN?)

That .=<> compiles to a separate op from <> is an implementation
detail, so show ‘readline()’ as we do with <>.

10 years agoperlhacktips: -Accflags for PERL_DEBUG_READONLY_OPS
Father Chrysostomos [Mon, 30 Dec 2013 00:43:03 +0000 (16:43 -0800)]
perlhacktips: -Accflags for PERL_DEBUG_READONLY_OPS

It is not clear to all that this has to be specified as
-Accflags=-D... when used on the Configure command line.

10 years agoperlguts: Make Memory Allocation and PerlIO top-level
Father Chrysostomos [Sun, 29 Dec 2013 01:34:38 +0000 (17:34 -0800)]
perlguts: Make Memory Allocation and PerlIO top-level

These two sections were in the middle of the subroutines section,
but they have little to do with subroutines, whereas the surrounding
sections do pertain to them.  I think it was a mistake for them to
have been put under Subroutines to begin with.

10 years agoConsistent spaces after dots in perlintern.pod
Father Chrysostomos [Sun, 29 Dec 2013 01:28:09 +0000 (17:28 -0800)]
Consistent spaces after dots in perlintern.pod

10 years agoperlapi: Consistent spaces after dots
Father Chrysostomos [Sat, 28 Dec 2013 14:55:13 +0000 (06:55 -0800)]
perlapi: Consistent spaces after dots

plus some typo fixes.  I probably changed some things in perlintern, too.

10 years agocut out/inline wrapper calls of sv_*catpvf*
Daniel Dragan [Thu, 26 Dec 2013 19:18:16 +0000 (14:18 -0500)]
cut out/inline wrapper calls of sv_*catpvf*

these wrappers use 1 or 2 indirect calls to reach the guts of Perl's
format string engine. Win64 and ARM (and I assume other 4 register regcall
platforms) compilers can't easily tailcall or optimize these due to
sv_vcatpvfn_flags > 4 args and strlen calls. They allocate lots of C
stack and set up new frames and copy args over. So just call the core
format string function directly.

Not all paths to sv_vcatpvfn_flags were optimized since they have no CORE
or CPAN grep usage. sv_vcatpvf has usage, sv_catpvf_mg* have none but were
done anyway because they sound like they would be commonly used.

10 years agoAdd names (descriptions) to t/dumper.t tests lacking them.
James E Keenan [Tue, 24 Dec 2013 02:43:16 +0000 (03:43 +0100)]
Add names (descriptions) to t/dumper.t tests lacking them.

TEST() runs over its first argument three times.  The description is only
printed on the first of the three tests.  Suggestions for more precise
descriptions welcome.

For: RT #120854

10 years agoFix $Config{src} on VMS.
Craig A. Berry [Sat, 28 Dec 2013 20:09:46 +0000 (14:09 -0600)]
Fix $Config{src} on VMS.

It may not matter much as it's been broken since dab31494e8bab and
doesn't seem to have caused any trouble, but to be pedantically
correct the location of the source is not the same as the install
location.

10 years agoMake perl_setup.com infer perl_root from its own location.
Craig A. Berry [Sat, 28 Dec 2013 17:22:28 +0000 (11:22 -0600)]
Make perl_setup.com infer perl_root from its own location.

The perl_setup.com command procedure initializes the root logical
name, the shareable image logical name pointing to the main Perl
dynamic library, and either command symbols or command table
entries that reference those logical names.  It's always by
default hard-coded the prefix chosen at configuration time as the
basis for where Perl should be located.

The original rationale for that was that it gets run right before
installperl and sets things up correctly for installation.  But
that optimizes for a single use case that is easily handled by
specifying the correct install location as a parameter and
pessimizes for every other use case, notably relocating an
installed Perl directory tree.

So make it infer the correct root from its own location and
specify the install location only at installation time.  Among
other benefits, this allows the install location to be chosen
at installation time by overriding the default prefix like so:

  MMK/MACRO=(PREFIX="DSA0:[homedir.MyPerl2.]") install

10 years agoMerge the sfio removal to blead.
Nicholas Clark [Fri, 27 Dec 2013 15:22:45 +0000 (16:22 +0100)]
Merge the sfio removal to blead.

10 years agoAdd the removal of the sfio support to perldelta.
Nicholas Clark [Fri, 27 Dec 2013 15:20:08 +0000 (16:20 +0100)]
Add the removal of the sfio support to perldelta.

Given that this code no longer works, it doesn't feel important to list it in
the headlines. It's not clear where the best section for it is.

10 years agoPurge sfio support from configure.com, Configure and related files.
Nicholas Clark [Tue, 10 Dec 2013 18:32:59 +0000 (19:32 +0100)]
Purge sfio support from configure.com, Configure and related files.

Most of these are actually generated, so the maintenance complexity reduction
is not as impressive as the diffstat suggests.

(Incorporating a fix from Merijn)

10 years agoPurge sfio support, which has been broken for a decade.
Nicholas Clark [Mon, 9 Dec 2013 21:18:22 +0000 (22:18 +0100)]
Purge sfio support, which has been broken for a decade.

The last Perl release that built with -Dusesfio was v5.8.0, and even that
failed many regression tests. Every subsequent release fails to build, and
in the decade that has passed we have had no bug reports about this. So it's
safe to delete all the code. The Configure related code will be purged in a
subsequent commit.

2 references to sfio intentionally remain in fakesdio.h and nostdio.h, as
these appear to be for using its stdio API-compatibility layer.

10 years agoFix sfio breakage caused by the fix for RT #78494.
Nicholas Clark [Mon, 9 Dec 2013 08:15:10 +0000 (09:15 +0100)]
Fix sfio breakage caused by the fix for RT #78494.

Commit 2e0cfa16dea85dd3 (Feb 2011) fixed RT #78494, but inadvertently broke
non-PerlIO configurations. -Uuseperlio was restored in March 2011 with commit
b6ae43b72863e12d, but this change is needed to restore the sfio build.

This is the last fix needed to get blead building with -Dusesfio, after 10
years of breakage. However, many many tests still fail (and one hangs).
Note, specifically this is only tested with sfio97. Perl is making a couple
of cheating assumptions which break with sfio2005, and I've not attempted to
fix Perl's naughtiness to get it to build with current sfio. (Nor has anyone
else in the past 8 years, it would seem. Or even reported a problem.)

10 years agoFix a typo introduced in Nov 2008 by commit 4ee3916907333148.
Nicholas Clark [Sun, 8 Dec 2013 20:50:53 +0000 (21:50 +0100)]
Fix a typo introduced in Nov 2008 by commit 4ee3916907333148.

One use of dSAVE_ERRNO was mistyped as dSAVED_ERRNO, but as it was in the
sfio-only code it was not spotted.

10 years agoFix sfio breakage caused by the addition of PERLIO_TERM in Oct 2006.
Nicholas Clark [Sun, 8 Dec 2013 20:11:46 +0000 (21:11 +0100)]
Fix sfio breakage caused by the addition of PERLIO_TERM in Oct 2006.

Commit 6cb8cb214e85c7d6 in Oct 2006 added a new macro PERLIO_TERM, but didn't
provide an appropriate definition for the sfio build. Commit 6b29934bd65555b7
(also Oct 2006) plus this change provides a working PERLIO_TERM for sfio.

10 years agoFix sfio breakage in PerlIO_findFILE() caused by commit de009b76d60bdeb8.
Nicholas Clark [Sun, 8 Dec 2013 18:15:25 +0000 (19:15 +0100)]
Fix sfio breakage in PerlIO_findFILE() caused by commit de009b76d60bdeb8.

One hunk of commit de009b76d60bdeb8 (April 2005) makes a variable const,
which is then assigned to. This is in sfio-specific code, so was not noticed.
This change was merged to maint-5.8 as part of commit f1c3982b668c9e30 (Sep
2005).

10 years agoAlso build PerlIO_get_layers with -Dusesfio
Nicholas Clark [Sun, 8 Dec 2013 17:47:54 +0000 (18:47 +0100)]
Also build PerlIO_get_layers with -Dusesfio

This extends patch 5fef3b4a7f0c97d3 from April 2003 from fixing the
stdio-only build to also fix the sfio build, which was broken when
PerlIO_get_layers was added (2 commits previously, 39f7a87036eb8d13).
Without this fix, perl would refuse to build with -Dusesfio.

Given that 39f7a87036eb8d13 was merged to maint-5.8, this means that the
-Dusesfio build was broken for v5.8.1 and later on that branch, as well as
for v5.10.0 and all subsequent releases. Given that in the past 10 years,
no-one has reported this, it's safe to assume that no-one considers sfio
support to be important.

10 years agolib/diagnostics.t: Add test
Karl Williamson [Fri, 27 Dec 2013 04:43:07 +0000 (21:43 -0700)]
lib/diagnostics.t: Add test

This adds a test so that both =item lines of an adjacent pair get
tested.

10 years agolib/diagnostics.t: Use different test data
Karl Williamson [Fri, 27 Dec 2013 04:50:28 +0000 (21:50 -0700)]
lib/diagnostics.t: Use different test data

This is testing that things work for two adjacent =item lines in
perldiag.pod that share the same description.  However a future commit
will change perldiag.pod so that one of the specific adjacent lines
previously used here will be removed.  Therefore, choose a different set
of adjacent lines that aren't scheduled to be changed.

This adds a comment in perldiag that the newly chosen adjacent lines are
thus used in diagnostics.t

10 years agoIncrease $constant::VERSION to 1.31
Father Chrysostomos [Thu, 26 Dec 2013 02:03:16 +0000 (18:03 -0800)]
Increase $constant::VERSION to 1.31

10 years agoRemove constant.pm-specific behaviour from Internals::SvREADONLY
Father Chrysostomos [Thu, 26 Dec 2013 02:02:57 +0000 (18:02 -0800)]
Remove constant.pm-specific behaviour from Internals::SvREADONLY

Some stuff on CPAN is using this undocumented function, so give
constant.pm its own.  It is already a core module, depending on
functionality provided by the core solely for its sake; so this
does not really change its relationship to the core.

10 years agoRevert "[perl #119801] Stop @DB::dbline modifications from crashing"
Father Chrysostomos [Wed, 25 Dec 2013 14:16:31 +0000 (06:16 -0800)]
Revert "[perl #119801] Stop @DB::dbline modifications from crashing"

This reverts commit c1cec775e9019cc8ae244d4db239a7ea5c0b343e.

See ticket #120864.

10 years ago[perl #120426] atof() small value rounding errors
David Mitchell [Mon, 2 Dec 2013 15:04:49 +0000 (15:04 +0000)]
[perl #120426] atof() small value rounding errors

For something like 0.153e-305, which is small, but not quite the smallest
number (which is around 2.2e-308), adding extra digits to the fractional part
could cause unnecessary rounding to zero.

From the bug report:

    $ echo 0.1530e-305 | perl -e '$v = <STDIN>; print "v=", $v + 0, "\n";'
    v=0
    $ echo 0.153e-305  | perl -e '$v = <STDIN>; print "v=", $v + 0, "\n";'
    v=1.53e-306

This was because 0.1234e-305 is calculated as

    1234 / (10^309)

and 10^309 becomes infinity. In these edge cases, repeatedly decrement
the exponent and divide the mantissa by 10 until the exponent becomes in
range; in this case we instead calculate

    123 / (10^308)

10 years agodo cflags on stdout, not stderr
David Mitchell [Wed, 4 Dec 2013 15:53:51 +0000 (15:53 +0000)]
do cflags on stdout, not stderr

The current UNIX build system does a strange thing to generate the
appropriate command-line to compile a particular src file. It calls
the cflags shell script, which
1) echoes to stdout the command line needed to compile the specified
   file (excluding the name of the src file itself), e.g.
        cc -c -Dfoo -Wbar ...
2) echoes the same thing to stderr, prefixied with '   CCCMD ='

Make then does

    `sh cflags foo.o`  foo.c

the cflags output to stdout is captured by the backticks, and is used
by make as the command line to run (with the foo.c appended). This run is
silent. The output to stderr isn't captured, and gets displayed. So the
user sees:

    $ make
    `sh cflags foo.o` foo.c
       CCCMD = cc -c -Dfoo -Wbar ...
    ...

This is annoying for 2 reasons:
1) you don't get a simple command-line displayed which you could do a
simple cut and paste with (e.g. when you want to recompile a specific
source file, but alter the flags).
2) The make generates output on stderr, even when then there aren't any
errors. So "make 2>errs" can't be used to quickly spot warnings and
errors.

This commit fixes this by making cflags just output the cc command and
flags to stdout, then get Makefile to call it twice, once to echo
the command-line (on stdout), and once to execute it with backticks.
So the make output is now:

    $ make
    cc -c -Dfoo -Wbar ... foo.c
    ...

There is some stuff in Makefile.SH related to cross-compiling, which this
commit make have broken. Specifically the CCCMD and CCCMDSRC macros
have been changed in the normal case to remove backticks (and add them to
the make rules instead), but not for the cross compilation route.
The CC* defs in the cross-compilation case have a trailing -I$(CROSS_LIB)
outside of the backticks, which compilates matters.

However, in the subdir Cross/, there appears to be separate (and
divergent) copies of Makefile.SH and cflags, so maybe the files
I edited are no longer used for cross-compilation????

(followup: according to
   <20131204170112.GA2490@iabyn.com>
the cross-compiling stuff I mentioned above has bit-rotted, and I don't
need to worry about it)

10 years agocflags/cflags.SH: use '#' comments
David Mitchell [Tue, 3 Dec 2013 17:12:17 +0000 (17:12 +0000)]
cflags/cflags.SH: use '#' comments

These scripts had a mixture of old-style ':' comments and new-style
'#' comments. Since they have both, the old ones can't be needed for
portability reasons, so standardise on the modern form.

The old-style were just too confusing, especially as my syntax highlighter
didn't know about them.

10 years agocflags.SH - add commentary
David Mitchell [Tue, 3 Dec 2013 16:17:56 +0000 (16:17 +0000)]
cflags.SH - add commentary

Add comments to the top of cflags.SH to explain what it does.
Also make it output comments at the top of the generated cflags
script explaining that its auto-generated.

10 years agodoio.c: Stop semop from modifying its argument
Father Chrysostomos [Wed, 25 Dec 2013 13:44:23 +0000 (05:44 -0800)]
doio.c: Stop semop from modifying its argument

Perl_do_semop, which implements the Perl semop function, copies its
second argument to a new struct array, which it passes to the system’s
semop function.  It then copies the contents of the struct back into
the argument’s string buffer.

Neither the Darwin nor Linux documentation says that semop modifies
the structs passed to it, and, even if it did happen, perl has never
handle it correctly.  It would have to stringify its argument forcibly
(to avoid copying back into a temporary string buffer) and also call
get-magic.  And then it would fail with a read-only argument.

Since read-only arguments have always been permitted and the copy
ing-back has never worked correctly, and since this will cause prob-
lems if we upgrade modifications to COW buffers into crashes (the
PERL_DEBUG_READONLY_COW mode I am working in), this commit removes
that code.

10 years agopp_sys.c remove null checks and locality
Daniel Dragan [Tue, 24 Dec 2013 10:04:55 +0000 (05:04 -0500)]
pp_sys.c remove null checks and locality

pp_enterwrite, EXTEND contains a funccall, dont save gv around it
pp_ioctl, move optype to first place used to reduce liveness

10 years agopp_sys.c: More null check removal
Father Chrysostomos [Tue, 24 Dec 2013 13:44:01 +0000 (05:44 -0800)]
pp_sys.c: More null check removal

Thanks again to Daniel Dragan for pointing out candidates in
<rt-4.0.18-29603-1387872667-551.120842-15-0@perl.org> (ticket #120842).

10 years agoInterpret do CORE() as do-file
Father Chrysostomos [Tue, 24 Dec 2013 06:48:10 +0000 (22:48 -0800)]
Interpret do CORE() as do-file

a96df64385 inadvertently changed it.  do-file is how it has alwas been
interpreted, at least as far back as 5.000, as far as I can tell.

10 years agoLet's be consistent.
Abigail [Tue, 24 Dec 2013 12:51:32 +0000 (13:51 +0100)]
Let's be consistent.

All the sections are of the form '=head2 version - title', except the
one for v5.19.0, which used two dashes.

But no longer.