This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perl5.git
7 years agoregen/mk_invlists.pl: White-space only
Karl Williamson [Mon, 28 Apr 2014 23:50:14 +0000 (17:50 -0600)]
regen/mk_invlists.pl: White-space only

The previous commit created a block around the code that is indented by
this commit.

7 years agoregen/mk_invlists.pl: Update to use EBCDIC utilities
Karl Williamson [Mon, 28 Apr 2014 23:37:49 +0000 (17:37 -0600)]
regen/mk_invlists.pl: Update to use EBCDIC utilities

This causes the generated charclass_invlists.h to be valid on all
supported platforms

7 years agoregen/unicode_constants.pl: White-space only
Karl Williamson [Mon, 28 Apr 2014 23:31:46 +0000 (17:31 -0600)]
regen/unicode_constants.pl: White-space only

The previous commit created a block around this code, which is now
appropriately indented

7 years agoregen/unicode_constants.pl: Update to use EBCDIC utilities
Karl Williamson [Mon, 28 Apr 2014 23:26:56 +0000 (17:26 -0600)]
regen/unicode_constants.pl: Update to use EBCDIC utilities

This causes the generated unicode_constants.h to be valid on all
supported platforms

7 years agoregen/mk_PL_charclass.pl: White-space only
Karl Williamson [Mon, 28 Apr 2014 23:19:07 +0000 (17:19 -0600)]
regen/mk_PL_charclass.pl: White-space only

The previous commit created a block around this code.

7 years agoregen/mk_PL_charclass.pl: Update to use EBCDIC utilities
Karl Williamson [Mon, 28 Apr 2014 23:08:57 +0000 (17:08 -0600)]
regen/mk_PL_charclass.pl: Update to use EBCDIC utilities

This causes the generated l1_char_class_tab.h to be valid on all
supported platforms

7 years agoMake many EBCDIC tables generated instead of hand-coded
Karl Williamson [Mon, 28 Apr 2014 22:57:16 +0000 (16:57 -0600)]
Make many EBCDIC tables generated instead of hand-coded

This causes the generated file ebcdic_tables.h to be #included by
utfebcdic.h instead of the hand-coded tables that were formerly there.
This makes it much easier to add or remove support for EBCDIC code
pages.

The UTF-EBCDIC-related tables for 037 and POSIX-BC are somewhat modified
from what they were before.  They were changed by hand minimally a long
time ago to prevent segfaults, but in so doing, they lost an important
sorting characteristic of UTF-EBCDIC.  The machine-generated versions
retain the sorting, while also not doing the segfaults. utfebcdic.h has
more detail about this, regarding tr16.

7 years agoAdd utilities for dealing with EBCDIC
Karl Williamson [Mon, 28 Apr 2014 22:43:49 +0000 (16:43 -0600)]
Add utilities for dealing with EBCDIC

This script is to be used by others in regen/ to aid in handling
ASCII/EBCIDC items.

7 years agoregcomp.c: Change ref to obsolete global var
Karl Williamson [Fri, 25 Apr 2014 16:56:22 +0000 (10:56 -0600)]
regcomp.c: Change ref to obsolete global var

This was changed in v5.19, but not found because we don't have an EBCDIC
smoker.  Spotted by Yaroslav Kuzmin.

7 years agoregen/unicode_constants.pl: White-space only
Karl Williamson [Thu, 17 Apr 2014 01:32:38 +0000 (19:32 -0600)]
regen/unicode_constants.pl: White-space only

Indent code in block formed by the previous commit

7 years agoregen/unicode_constants.pl: Rearrange code order
Karl Williamson [Thu, 17 Apr 2014 01:27:39 +0000 (19:27 -0600)]
regen/unicode_constants.pl: Rearrange code order

This just changes the ordering so we don't do UTF-8 calculations unless
needed.

7 years agohandy.h: Make macro more efficient on EBCDIC
Karl Williamson [Wed, 26 Jun 2013 21:49:13 +0000 (15:49 -0600)]
handy.h: Make macro more efficient on EBCDIC

The comments say it all

7 years agoCreate new testing helper file
Karl Williamson [Tue, 27 May 2014 03:05:21 +0000 (21:05 -0600)]
Create new testing helper file

This adds t/charset_tools.pl, and populates it with 2 functions removed
from t/test.pl.  The functions are changed very slightly to use the
variables $::IS_ASCII and $::IS_EBCDIC instead of recalculating this
information.

A new function byte_utf8a_to_utf8n() is also placed in charset_tools.
This takes the bytes that form a (ASCII-platform) UTF-8 string and
convert them to the bytes that form that string on the native platform,
hence just returns the input if run on an ASCII platform.

7 years agoUse already existing functions in some .t files
Karl Williamson [Tue, 27 May 2014 02:34:06 +0000 (20:34 -0600)]
Use already existing functions in some .t files

I invented 2 functions for use in .t files a while back that turn out to
be duplicates of (undocumented) functions that already existed suitable
for general use.  This commit changes to use those general functions and
removes the copies from t/test.pl.  (I plan to document these functions
later in 5.21.).  This is in preparation for moving some similar
functions from t/test.pl to a newly created test tools file, as it turns
out that these functions are useful in .t files that don't use
t/test.pl, but instead, e.g., Test::More.

7 years agoUpdate podcheck db to reflect fixed problem
Karl Williamson [Sat, 31 May 2014 15:58:16 +0000 (09:58 -0600)]
Update podcheck db to reflect fixed problem

7 years agoregen/mk_PL_charclass.pl: Rmv hard-coded char names
Karl Williamson [Sun, 17 Mar 2013 04:48:22 +0000 (22:48 -0600)]
regen/mk_PL_charclass.pl: Rmv hard-coded char names

Since this program was written, the abbreviated names of the control
characters have become available from charnames::viacode().  We change
to use these instead of hard-coding them in.

At the same time, this shortens the names for some of the other
characters in cases where it is easy to read the short ones.

It also changes to use mnemonics instead of hard-coded ordinals, like
using ASCII instead of x < 128.  This allows it to be run on an EBCDIC
platform.

7 years agoPATCH: [perl #121777] User-defined prop and packages
Karl Williamson [Wed, 7 May 2014 23:36:40 +0000 (17:36 -0600)]
PATCH: [perl #121777] User-defined prop and packages

The solution to this is to add the package name to the property name for
run-time lookup.

Thanks for Darin McBride for finding an inefficiency in an earlier
version of this patch.

7 years agoregcomp.c: Rmv temporary variable
Karl Williamson [Wed, 7 May 2014 22:41:51 +0000 (16:41 -0600)]
regcomp.c: Rmv temporary variable

This variable is unused after its first use, so can just be elminated.

7 years agolib/utf8_heavy.pl: Stack '?' and ':' ternaries
Karl Williamson [Wed, 7 May 2014 22:40:48 +0000 (16:40 -0600)]
lib/utf8_heavy.pl: Stack '?' and ':' ternaries

This is to make the code easier to read.

7 years agoUpgrade Encode from version 2.60_01 to 2.62
Steve Hay [Sat, 31 May 2014 12:50:42 +0000 (13:50 +0100)]
Upgrade Encode from version 2.60_01 to 2.62

The new version incorporates previous blead CUSTOMIZATIONS.

7 years agoRemove old Class-ISA remnants
Steve Hay [Sat, 31 May 2014 13:28:00 +0000 (14:28 +0100)]
Remove old Class-ISA remnants

7 years agoRemove Package-Constants remnant
Steve Hay [Sat, 31 May 2014 13:20:10 +0000 (14:20 +0100)]
Remove Package-Constants remnant

7 years agoRemove Module-Build remnants
Steve Hay [Sat, 31 May 2014 13:19:38 +0000 (14:19 +0100)]
Remove Module-Build remnants

7 years agoRemove CGI.pm remnants
Steve Hay [Sat, 31 May 2014 13:17:28 +0000 (14:17 +0100)]
Remove CGI.pm remnants

7 years agoUpgrade libnet from version 1.25 to 1.27
Steve Hay [Sat, 31 May 2014 11:43:56 +0000 (12:43 +0100)]
Upgrade libnet from version 1.25 to 1.27

This eliminates the need to have a CUSTOMIZED Makefile.PL. The other changes
(to modules and test scripts) are whitespace only.

7 years agoBelt and braces, add Module-CoreList version checks in porting too
Chris 'BinGOs' Williams [Sat, 31 May 2014 13:50:40 +0000 (14:50 +0100)]
Belt and braces, add Module-CoreList version checks in porting too

7 years agoAdded core-only version check to Module-CoreList
Chris 'BinGOs' Williams [Sat, 31 May 2014 11:12:47 +0000 (12:12 +0100)]
Added core-only version check to Module-CoreList

This should ensure that the versions of Module-CoreList modules
always match the version of perl.

Have to special-case skip for v5.21.1, because rjbs

7 years agoClarify "require <>"-message.
Norman Koch [Sat, 31 May 2014 01:31:29 +0000 (03:31 +0200)]
Clarify "require <>"-message.

Changed "<> should be quotes" to "<> at require-statement should be
quotes".  This way, when someone writes "require <Module>", it is way
easier to find the specific command that caused this.

7 years agoCorrect illegal use of >> in Exporter POD.
Todd Rinaldo [Mon, 14 Apr 2014 02:37:42 +0000 (21:37 -0500)]
Correct illegal use of >> in Exporter POD.

Discovered during POD unit tests on release of 5.70 to CPAN.
Also correct AUTHORS and checkAUTHORS.PL email to toddr@cpan.org.
Bump Exporter $VERSION to 5.71.

7 years agoregexec.c: Eliminate a malloc/free
Karl Williamson [Mon, 21 Apr 2014 02:06:04 +0000 (20:06 -0600)]
regexec.c: Eliminate a malloc/free

This uses an C automatic variable instead of a malloc and free.

7 years agoutf8.c: Move documentation next to its function
Karl Williamson [Mon, 5 May 2014 15:56:43 +0000 (09:56 -0600)]
utf8.c: Move documentation next to its function

Somehow this pod stuff was orphaned from the function it describes.

7 years agosv.c: Clarify comment
Karl Williamson [Mon, 5 May 2014 01:00:40 +0000 (19:00 -0600)]
sv.c: Clarify comment

I find reordering the text makes it easier to understand

7 years agoperlapi: Clarify some instances where NUL is or isn't permitted
Karl Williamson [Mon, 5 May 2014 00:58:51 +0000 (18:58 -0600)]
perlapi: Clarify some instances where NUL is or isn't permitted

Some functions that take a string/length pair can have embedded NULs and
don't have to be NUL terminated; others are the opposite.  This adds
text to clarify the issue.

7 years agoWrap various pod uses of NUL with C<>
Karl Williamson [Sun, 4 May 2014 23:09:22 +0000 (17:09 -0600)]
Wrap various pod uses of NUL with C<>

This makes the uses of this consistent in our pods.  Also changed one
use of the word 'buffer' into 'string', the latter being more
appropriate.

7 years agoregen/regcharclass.pl: Improve the generated code
Karl Williamson [Sat, 3 May 2014 21:38:27 +0000 (15:38 -0600)]
regen/regcharclass.pl: Improve the generated code

This is a small improvement when a consecutive group of U8 code points
begins at 0 or ends at 255.  These end points are physically impossible
of being exceeded, so there is no need to test for that end of the
range.  In several places this causes a mask operation to not be
generated.

7 years agoregcomp.c: Fix comment
Karl Williamson [Tue, 29 Apr 2014 03:50:52 +0000 (21:50 -0600)]
regcomp.c: Fix comment

7 years agoregcomp.c: Tighten up synthetic start class for Unicode characters
Karl Williamson [Tue, 29 Apr 2014 03:43:39 +0000 (21:43 -0600)]
regcomp.c: Tighten up synthetic start class for Unicode characters

When creating a synthetic start class (SSC) for EXACTFish nodes, in many
instances prior to this patch we punted and assumed any code point could
be matched.  This patch actually goes to the trouble of figuring out
what Unicode code points could possibly match, and uses those.  The only
time it punts now is when the node starts with a string of multiple
characters that together could be the fold of a single one.  It's too
complicated getting all the possibilities for these, as there could be
overlapping sequences that work.

7 years agoregcomp.c: Fix typo in comment
Karl Williamson [Tue, 29 Apr 2014 03:40:47 +0000 (21:40 -0600)]
regcomp.c: Fix typo in comment

7 years agoregcomp.c: Add assertion
Karl Williamson [Tue, 29 Apr 2014 03:10:48 +0000 (21:10 -0600)]
regcomp.c: Add assertion

This is because coverity thinks this could happen, and jhi and khw don't

7 years agoregcomp.c: Change a panic into an assert
Karl Williamson [Tue, 29 Apr 2014 03:08:19 +0000 (21:08 -0600)]
regcomp.c: Change a panic into an assert

This really should never happen, so might as well be an assert.

7 years agoregcomp.c: Move code into a function
Karl Williamson [Tue, 29 Apr 2014 02:55:50 +0000 (20:55 -0600)]
regcomp.c: Move code into a function

This is in preparation for it to be called from another place

7 years agoregcomp.c: Remove obsolete code
Karl Williamson [Tue, 29 Apr 2014 01:53:39 +0000 (19:53 -0600)]
regcomp.c: Remove obsolete code

Commit cd209d9d0a3b8eec779c744b3a98c9101e3f1a21 changed things so that
this code (as its comments suggest) is now obsolete.

7 years agoregcomp.c, regexec.c: Move common code to a function
Karl Williamson [Tue, 29 Apr 2014 01:48:40 +0000 (19:48 -0600)]
regcomp.c, regexec.c: Move common code to a function

There are other cases where this functionality will be needed as well.

7 years agoregen/regcharclass_multi_char_folds.pl: Add some comments
Karl Williamson [Tue, 29 Apr 2014 01:44:28 +0000 (19:44 -0600)]
regen/regcharclass_multi_char_folds.pl: Add some comments

7 years agoregen/regcharclass.pl: Don't generate macro twice
Karl Williamson [Tue, 29 Apr 2014 01:42:32 +0000 (19:42 -0600)]
regen/regcharclass.pl: Don't generate macro twice

Until this patch, this could happen if both 'safe' and 'fast' are
specified with a cp macro.

7 years agoOptimize /[a-z]/ and /[A-Z]/
Karl Williamson [Sun, 27 Apr 2014 16:53:00 +0000 (10:53 -0600)]
Optimize /[a-z]/ and /[A-Z]/

These bracketed character classes can easily be optimized into smaller
probably faster regops that match identically.

7 years ago/x in patterns now includes all \p{PatWS}
Karl Williamson [Sun, 27 Apr 2014 16:26:58 +0000 (10:26 -0600)]
/x in patterns now includes all \p{PatWS}

This brings Perl regular expressions more into conformance with Unicode.
/x now accepts 5 additional characters as white space.  Use of these
characters as literals under /x has been deprecated since 5.18, so now
we are free to change what they mean.

This commit eliminates the static function that processes the old
whitespace definition (and a generated macro that was used only for
this), using the already existing one for the new definition.  It
refactors slightly the static function that skips comments to mesh
better with the needs of its callers, and calls it in one place where
before the code was essentially duplicated.

p5p discussion starting in
http://nntp.perl.org/group/perl.perl5.porters/214726 convinced me that
the (?[ ]) comments should be terminated the same way as regular /x
comments, and this was also done in this commit.  No prior notice is
necessary as this is an experimental feature.

7 years agoDeprecate NBSP in \N{...} names
Karl Williamson [Sat, 26 Apr 2014 17:27:52 +0000 (11:27 -0600)]
Deprecate NBSP in \N{...} names

This is currently allowed, but is non-graphic, and is indistinguishable
from a regular space.  I was the one who initially allowed it, and did
so out of ignorance of the negative consequences of doing so.  There is
no other precedent for including it.

7 years agoFix bug where charnames xlator doesn't return utf8
Karl Williamson [Sat, 26 Apr 2014 17:07:11 +0000 (11:07 -0600)]
Fix bug where charnames xlator doesn't return utf8

A user-supplied charnames translator for \N{} processing doesn't have to
return in UTF-8.  Prior to this patch, the code in toke.c assumed it
did.

7 years agoFatalize deprecated \N{} definitions
Karl Williamson [Thu, 24 Apr 2014 14:35:08 +0000 (08:35 -0600)]
Fatalize deprecated \N{} definitions

Having a sequence of multiple spaces in a charnames alias name
definition or having trailing spaces in it have been deprecated since
5.18, and it is now time to make them fatal.

7 years agocharnames: Eliminate need to sync code in two places
Karl Williamson [Thu, 24 Apr 2014 02:33:12 +0000 (20:33 -0600)]
charnames: Eliminate need to sync code in two places

This refactors the code so that it doesn't have to be kept in sync
with other code.

7 years agoFatalize splitting '(?' and '(*' in regexes
Karl Williamson [Wed, 23 Apr 2014 18:40:30 +0000 (12:40 -0600)]
Fatalize splitting '(?' and '(*' in regexes

Inserting spaces or comments between the '(' and '?' or '*' has been
deprecated since v5.18.0.

7 years agoutfebcdic.h: Comment changes only
Karl Williamson [Tue, 22 Apr 2014 03:02:44 +0000 (21:02 -0600)]
utfebcdic.h: Comment changes only

Clarifications and typo fix.

7 years agohandy.h: Comments, white-space only
Karl Williamson [Tue, 22 Apr 2014 02:05:57 +0000 (20:05 -0600)]
handy.h: Comments, white-space only

7 years agohandy.h: Use some common macros for ASCII/EBCDIC
Karl Williamson [Tue, 22 Apr 2014 02:00:16 +0000 (20:00 -0600)]
handy.h: Use some common macros for ASCII/EBCDIC

It turns out that the EBCDIC definitions can be made the same as the
ASCII ones, so this moves the ASCII definitions to the spot where other
ones common to the 2 platforms reside, and removes the EBCDIC ones.  In
other words it combines separate definitions into common ones.

7 years agoregexec.c: Fix some EBCDIC problems
Karl Williamson [Tue, 25 Jun 2013 03:14:37 +0000 (21:14 -0600)]
regexec.c: Fix some EBCDIC problems

We were testing for UTF-8 invariant, when we should have been testing
for ASCII.  This is a problem only on EBCDIC platforms, where they mean
two different sets of code points.

7 years agoUnicode::UCD.pm: Pod clarifications and nits
Karl Williamson [Sun, 31 Mar 2013 03:13:38 +0000 (21:13 -0600)]
Unicode::UCD.pm: Pod clarifications and nits

7 years agodquote_static.c: Clarify code
Karl Williamson [Mon, 21 Apr 2014 18:11:40 +0000 (12:11 -0600)]
dquote_static.c: Clarify code

We output the message when there is a printable ASCII character, so use
that as the test instead of complementing the test for a control.  This
makes the code somewhat clearer.

7 years ago"\cX" where X is non-printable is now fatal
Karl Williamson [Wed, 9 Apr 2014 01:27:59 +0000 (19:27 -0600)]
"\cX" where X is non-printable is now fatal

It had been deprecated, scheduled to be removed in 5.22.

7 years agoRevert "DEBUG_X_TEST are only for DEBUGGING."
Jarkko Hietaniemi [Fri, 30 May 2014 02:37:11 +0000 (22:37 -0400)]
Revert "DEBUG_X_TEST are only for DEBUGGING."

This reverts commit efbe0e532ca914af071ffbd40bfc8932fab1ecf9.

7 years agoUndo 63b558ddd980cd36bcbd8a7465a3412e886ba75e.
Jarkko Hietaniemi [Fri, 30 May 2014 02:01:06 +0000 (22:01 -0400)]
Undo 63b558ddd980cd36bcbd8a7465a3412e886ba75e.

(For some odd reason assert() cannot be found and Jenkins becomes apoplectic.)

7 years agoDEBUG_X_TEST are only for DEBUGGING.
Jarkko Hietaniemi [Fri, 30 May 2014 01:53:44 +0000 (21:53 -0400)]
DEBUG_X_TEST are only for DEBUGGING.

7 years agoMove #include <assert.h> before ASSUME/NOT_REACHED.
Jarkko Hietaniemi [Fri, 30 May 2014 01:47:57 +0000 (21:47 -0400)]
Move #include <assert.h> before ASSUME/NOT_REACHED.

7 years agoUse NOT_REACHED for the impossible case.
Jarkko Hietaniemi [Fri, 30 May 2014 01:24:47 +0000 (21:24 -0400)]
Use NOT_REACHED for the impossible case.

The default case really is impossible because all the valid
enums values are already covered in the switch.

The NOT_REACHED; is for the compiler (from perl.h),
the /* NOTREACHED */ is for static analyzers.

7 years agoperlre: Clarify /x eol can't be escaped
Karl Williamson [Mon, 19 May 2014 22:36:33 +0000 (16:36 -0600)]
perlre: Clarify /x eol can't be escaped

7 years agot/run/locale.t: Skip some tests for some shells
Karl Williamson [Tue, 13 May 2014 23:31:39 +0000 (17:31 -0600)]
t/run/locale.t: Skip some tests for some shells

Some sh programs don't accept changes of environment variables like
LC_ALL to invalid values.  For these the tests aren't testing what they
think they are, so change them to just return the expected value, so
they will pass.  This effectively skips the tests when run on these
shells.  See http://nntp.perl.org/group/perl.perl5.porters/214503

7 years agot/run/locale.t: Rmv obsolete complicated idiom
Karl Williamson [Tue, 13 May 2014 23:08:24 +0000 (17:08 -0600)]
t/run/locale.t: Rmv obsolete complicated idiom

See http://nntp.perl.org/group/perl.perl5.porters/213369

7 years agot/test.pl: Use existing variable instead of recalculating
Karl Williamson [Tue, 6 May 2014 22:26:05 +0000 (16:26 -0600)]
t/test.pl: Use existing variable instead of recalculating

If the current platform is ascii is available already in a variable.
Use that instead of inventing a different paradigm.

7 years agoXS-APItest/t/handy.t: Change output message
Karl Williamson [Fri, 15 Mar 2013 17:50:35 +0000 (11:50 -0600)]
XS-APItest/t/handy.t: Change output message

On EBCDIC platforms, the output is not in terms of \N{U+}; change text
to \x{ }

7 years agomktables: Add comment
Karl Williamson [Sat, 22 Feb 2014 23:36:28 +0000 (16:36 -0700)]
mktables: Add comment

7 years agoPATCH: [perl #121630]: perlpod clarification
Karl Williamson [Mon, 28 Apr 2014 20:10:37 +0000 (14:10 -0600)]
PATCH: [perl #121630]: perlpod clarification

7 years agot/lib/charnames/alias: Add comment
Karl Williamson [Thu, 24 Apr 2014 15:30:07 +0000 (09:30 -0600)]
t/lib/charnames/alias: Add comment

7 years agot/re/charset.t: Fix comment, test names
Karl Williamson [Tue, 22 Apr 2014 03:27:37 +0000 (21:27 -0600)]
t/re/charset.t: Fix comment, test names

Some of the test names have hard-coded values that are wrong.  This uses
a calculated value.

7 years agoRevert "mktables: Remove obsolete sort constraint"
Karl Williamson [Wed, 30 Apr 2014 02:18:42 +0000 (20:18 -0600)]
Revert "mktables: Remove obsolete sort constraint"

This reverts commit cf13ddc5efb78ce6d588441978947303e5baf1d8,
and adds a comment as to why.

7 years agomktables: Add regenerated header to file
Karl Williamson [Wed, 28 May 2014 03:23:34 +0000 (21:23 -0600)]
mktables: Add regenerated header to file

This file is generated by mktables, so any changes made to it are lost.
Add the standard header for such files to it.

7 years agoRemove deprecated 'PL_sv_objcount'
Karl Williamson [Wed, 9 Apr 2014 00:46:25 +0000 (18:46 -0600)]
Remove deprecated 'PL_sv_objcount'

This was scheduled to be removed in 5.20, but was forgotten.

7 years agoutf8.c: Silence compiler warning
Karl Williamson [Fri, 30 May 2014 00:43:21 +0000 (18:43 -0600)]
utf8.c: Silence compiler warning

This was brought to my attention by Jarkko Hietaniemi.  The compiler was
complaining that a variable could be used uninitialized.  In practice
this doesn't happen, as it would only happen on bad data, and Perl
itself generates the data used.  (I suppose if the data got corrupted,
it could happen.)  This commit initializes the value unconditionally,
which allows a conditional setting of it to be removed.

7 years agoutf8.c: Move static function to embed.fnc
Karl Williamson [Fri, 30 May 2014 00:41:58 +0000 (18:41 -0600)]
utf8.c: Move static function to embed.fnc

This automatically generates assertions for pointer arguments, etc.

7 years agoUnify the "fall-through" lint annotation.
Jarkko Hietaniemi [Fri, 30 May 2014 00:41:22 +0000 (20:41 -0400)]
Unify the "fall-through" lint annotation.

Used by linters (static checkers), and also good for human readers.

Even though "FALL THROUGH" seems to be the most common, e.g BSD lint
manual only knows "FALLTHROUGH" (or "FALLTHRU").

7 years agoOnly prototype should_warn_nl under PERL_CORE.
Craig A. Berry [Thu, 29 May 2014 22:08:37 +0000 (17:08 -0500)]
Only prototype should_warn_nl under PERL_CORE.

Otherwise the prototype is seen in places where the function
itself is not defined, which is illegal for inline functions.

Follow-up to 7cb3f9598b37fc.

7 years agoGive caretx.c an explicit rule in vms/descrip_mms.template.
Craig A. Berry [Thu, 29 May 2014 21:46:19 +0000 (16:46 -0500)]
Give caretx.c an explicit rule in vms/descrip_mms.template.

Without an explicit rule it gets build with CFLAGS rather than
CORECFLAGS, which could make it miss important things, such as
PERL_CORE being defined.

7 years agoActually define SS_NOPRIV.
Craig A. Berry [Thu, 29 May 2014 21:44:11 +0000 (16:44 -0500)]
Actually define SS_NOPRIV.

Because in cd52bc19d9de6bc we made it just like all the others
except for the fact that the others already existed and this
one didn't.

7 years agoFurther simplify the sockatmark().
Jarkko Hietaniemi [Thu, 29 May 2014 21:36:41 +0000 (17:36 -0400)]
Further simplify the sockatmark().

(And do not assign the fd in PREINIT.)

7 years agoBuild fixes for Win32 after the Coverity smoke.
Jarkko Hietaniemi [Thu, 29 May 2014 20:56:28 +0000 (16:56 -0400)]
Build fixes for Win32 after the Coverity smoke.

(for 375ed12a42c6092b1af1d8e395bf3dadd9a66e48)

7 years agoGet rid of "grep empty(sub)expression" noise.
Jarkko Hietaniemi [Thu, 29 May 2014 19:16:47 +0000 (15:16 -0400)]
Get rid of "grep empty(sub)expression" noise.

In OS X (and assumedly *BSD) Configure output starts with:

grep empty(sub)expression

apparently because plain 'grep' understands the 'os\(/\|\)2'
somewhat differently (BRE vs ERE, RTFM re_format(7))

Cure: redirect the stderr of grep to stdout (which is then promptly
redirected to /dev/null).  The grep will still fail, and not take
the OS/2 (or DJGPP) branch.

7 years agoWe cannot assert(sv) since sv can be validly null
Jarkko Hietaniemi [Thu, 29 May 2014 19:14:34 +0000 (15:14 -0400)]
We cannot assert(sv) since sv can be validly null
(see the top of the function), but we can test it.

7 years agoDevel::PPPort 3.24 from CPAN.
Jarkko Hietaniemi [Thu, 29 May 2014 18:17:18 +0000 (14:17 -0400)]
Devel::PPPort 3.24 from CPAN.

7 years agoNo more x2p.
Jarkko Hietaniemi [Thu, 29 May 2014 17:56:35 +0000 (13:56 -0400)]
No more x2p.

7 years agoVersion bumping thanks to the Coverity deluge.
Jarkko Hietaniemi [Thu, 29 May 2014 17:52:25 +0000 (13:52 -0400)]
Version bumping thanks to the Coverity deluge.

7 years agoFollowup to 316ebaf (aka perl #121894).
Jarkko Hietaniemi [Thu, 29 May 2014 17:24:36 +0000 (13:24 -0400)]
Followup to 316ebaf (aka perl #121894).

Adding asserts to more spots.

Fix for Coverity perl5 CIDs 28962,28968,28969:
CID ...: Dereference after null check (FORWARD_NULL)
var_deref_op: Dereferencing null pointer p->q

7 years agoBump version for Devel::Peek
Karl Williamson [Thu, 29 May 2014 17:33:10 +0000 (11:33 -0600)]
Bump version for Devel::Peek

Commit 316ebaf2966c5b6fd47a9d1dc6fb64fcbd262379 changed this module
without changing the version number

7 years agofcntl receiving -1 from fileno, fcntl failing.
Jarkko Hietaniemi [Thu, 29 May 2014 16:36:28 +0000 (12:36 -0400)]
fcntl receiving -1 from fileno, fcntl failing.

(Also very few spots of negative numgroups for getgroups(),
and fgetc() return, but almost all checking is for fcntl.)

(merged fix for perl #121743 and perl #121745: hopefully
picked up all the fixes-to-fixes from the ticket...)

Fix for Coverity perl5 CIDs 28990..29003,29005..29011,29013,
45354,45363,49926:

Argument cannot be negative (NEGATIVE_RETURNS) fd is
passed to a parameter that cannot be negative.

and CIDs 29004, 29012:
Argument cannot be negative (NEGATIVE_RETURNS)
num_groups is passed to a parameter that cannot be negative

and because of CIDs 29005 and 29006 also CID 28924.

In the first set of issues a fd is retrieved from PerlIO_fileno, and
that is then used in places like fstat(), fchown(), dup(), etc.,
without checking whether the fd is valid (>=0).

In the second set of issues a potentially negative
number is potentially passed to getgroups().

The CIDs 29005 and 29006 were a bit messy: fixing them needed also
resolving CID 28924 where the return value of fstat() was ignored,
and for completeness adding two croak calls (with perldiag updates):
a bit of a waste since it's suidperl code.

7 years agoInsert asserts to paths suspected by Coverity.
Jarkko Hietaniemi [Thu, 29 May 2014 15:37:56 +0000 (11:37 -0400)]
Insert asserts to paths suspected by Coverity.

Coverity suspects paths like this:

(1)

  p = foo();
  if (!p) p = bar();
  baz(p->q);

since it cannot prove that p is always non-NULL at the dereference.

(2) Or simply something like:

  mg = mg_find(...);
  foo(mg->blah);

Since mg_find() can fail returning NULL.

Adding assert() calls before the dereferences.  Testing with -DDEBUGGING.
Hopefully there are regular smokes doing the same.

[perl #121894]

Fix for Coverity perl5 CIDs 28950,28952..28955,28964,28967,28970..28795,49921:
CID ...: Dereference after null check (FORWARD_NULL)
var_deref_op: Dereferencing null pointer p->q

(TODO: Coverity perl5 CIDs 28962,28968,28969: the same issue, but would
conflict with already in-flight changes, prepare catch-up patch later.)
---
 dist/Data-Dumper/Dumper.xs | 1 +
 dump.c                     | 1 +
 ext/Devel-Peek/Peek.xs     | 1 +
 ext/XS-APItest/APItest.xs  | 1 +
 mg.c                       | 2 ++
 mro.c                      | 4 +++-
 op.c                       | 4 ++++
 perlio.c                   | 1 +
 pp_hot.c                   | 5 +++--
 regcomp.c                  | 3 +++
 regexec.c                  | 5 ++++-
 universal.c                | 2 +-
 util.c                     | 4 +++-
 13 files changed, 28 insertions(+), 6 deletions(-)

diff --git a/dist/Data-Dumper/Dumper.xs b/dist/Data-Dumper/Dumper.xs
index 12c4ebd..23e0cf4 100644
--- a/dist/Data-Dumper/Dumper.xs
+++ b/dist/Data-Dumper/Dumper.xs
@@ -641,6 +641,7 @@ DD_dump(pTHX_ SV *val, const char *name, STRLEN namelen, SV *retval, HV *seenhv,
      else {
        sv_pattern = val;
      }
+     assert(sv_pattern);
      rval = SvPV(sv_pattern, rlen);
      rend = rval+rlen;
      slash = rval;
diff --git a/dump.c b/dump.c
index 59be3e0..c2d72fd 100644
--- a/dump.c
+++ b/dump.c
@@ -471,6 +471,7 @@ Perl_sv_peek(pTHX_ SV *sv)
   finish:
     while (unref--)
  sv_catpv(t, ")");
+    /* XXX when is sv ever NULL? */
     if (TAINTING_get && SvTAINTED(sv))
  sv_catpv(t, " [tainted]");
     return SvPV_nolen(t);
diff --git a/ext/Devel-Peek/Peek.xs b/ext/Devel-Peek/Peek.xs
index 679efa5..b20fa94 100644
--- a/ext/Devel-Peek/Peek.xs
+++ b/ext/Devel-Peek/Peek.xs
@@ -450,6 +450,7 @@ PPCODE:
 BOOT:
 {
     CV * const cv = get_cvn_flags("Devel::Peek::Dump", 17, 0);
+    assert(cv);
     cv_set_call_checker(cv, S_ck_dump, (SV *)cv);

     XopENTRY_set(&my_xop, xop_name, "Dump");
diff --git a/ext/XS-APItest/APItest.xs b/ext/XS-APItest/APItest.xs
index a51924d..18ba381 100644
--- a/ext/XS-APItest/APItest.xs
+++ b/ext/XS-APItest/APItest.xs
@@ -2096,6 +2096,7 @@ newCONSTSUB(stash, name, flags, sv)
                break;
         }
         EXTEND(SP, 2);
+        assert(mycv);
         PUSHs( CvCONST(mycv) ? &PL_sv_yes : &PL_sv_no );
         PUSHs((SV*)CvGV(mycv));

diff --git a/mg.c b/mg.c
index 76912bd..7f3339a 100644
--- a/mg.c
+++ b/mg.c
@@ -1675,6 +1675,7 @@ Perl_magic_clearisa(pTHX_ SV *sv, MAGIC *mg)
     same function. */
  mg = mg_find(mg->mg_obj, PERL_MAGIC_isa);

+    assert(mg);
     if (SvTYPE(mg->mg_obj) == SVt_PVAV) { /* multiple stashes */
  SV **svp = AvARRAY((AV *)mg->mg_obj);
  I32 items = AvFILLp((AV *)mg->mg_obj) + 1;
@@ -3437,6 +3438,7 @@ Perl_magic_copycallchecker(pTHX_ SV *sv, MAGIC *mg, SV *nsv,

     sv_magic(nsv, &PL_sv_undef, mg->mg_type, NULL, 0);
     nmg = mg_find(nsv, mg->mg_type);
+    assert(nmg);
     if (nmg->mg_flags & MGf_REFCOUNTED) SvREFCNT_dec(nmg->mg_obj);
     nmg->mg_ptr = mg->mg_ptr;
     nmg->mg_obj = SvREFCNT_inc_simple(mg->mg_obj);
diff --git a/mro.c b/mro.c
index 1b37ca7..ccf4bf4 100644
--- a/mro.c
+++ b/mro.c
@@ -638,12 +638,14 @@ Perl_mro_isa_changed_in(pTHX_ HV* stash)
                       hv_storehek(mroisarev, namehek, &PL_sv_yes);
                 }

-                if((SV *)isa != &PL_sv_undef)
+                if ((SV *)isa != &PL_sv_undef) {
+                    assert(namehek);
                     mro_clean_isarev(
                      isa, HEK_KEY(namehek), HEK_LEN(namehek),
                      HvMROMETA(revstash)->isa, HEK_HASH(namehek),
                      HEK_UTF8(namehek)
                     );
+                }
             }
         }
     }
diff --git a/op.c b/op.c
index 796cb03..79621ce 100644
--- a/op.c
+++ b/op.c
@@ -2907,6 +2907,7 @@ S_my_kid(pTHX_ OP *o, OP *attrs, OP **imopsp)
      S_cant_declare(aTHX_ o);
  } else if (attrs) {
      GV * const gv = cGVOPx_gv(cUNOPo->op_first);
+     assert(PL_parser);
      PL_parser->in_my = FALSE;
      PL_parser->in_my_stash = NULL;
      apply_attrs(GvSTASH(gv),
@@ -2929,6 +2930,7 @@ S_my_kid(pTHX_ OP *o, OP *attrs, OP **imopsp)
     else if (attrs && type != OP_PUSHMARK) {
  HV *stash;

+        assert(PL_parser);
  PL_parser->in_my = FALSE;
  PL_parser->in_my_stash = NULL;

@@ -10229,6 +10231,7 @@ Perl_ck_split(pTHX_ OP *o)
  op_append_elem(OP_SPLIT, o, newDEFSVOP());

     kid = kid->op_sibling;
+    assert(kid);
     scalar(kid);

     if (!kid->op_sibling)
@@ -10902,6 +10905,7 @@ Perl_cv_set_call_checker(pTHX_ CV *cv, Perl_call_checker ckfun, SV *ckobj)
  MAGIC *callmg;
  sv_magic((SV*)cv, &PL_sv_undef, PERL_MAGIC_checkcall, NULL, 0);
  callmg = mg_find((SV*)cv, PERL_MAGIC_checkcall);
+ assert(callmg);
  if (callmg->mg_flags & MGf_REFCOUNTED) {
      SvREFCNT_dec(callmg->mg_obj);
      callmg->mg_flags &= ~MGf_REFCOUNTED;
diff --git a/perlio.c b/perlio.c
index d4c43d0..e6ff9e4 100644
--- a/perlio.c
+++ b/perlio.c
@@ -2225,6 +2225,7 @@ PerlIOBase_dup(pTHX_ PerlIO *f, PerlIO *o, CLONE_PARAMS *param, int flags)
  PerlIO_funcs * const self = PerlIOBase(o)->tab;
  SV *arg = NULL;
  char buf[8];
+ assert(self);
  PerlIO_debug("PerlIOBase_dup %s f=%p o=%p param=%p\n",
       self ? self->name : "(Null)",
       (void*)f, (void*)o, (void*)param);
diff --git a/pp_hot.c b/pp_hot.c
index 2cccc48..9c9d1e9 100644
--- a/pp_hot.c
+++ b/pp_hot.c
@@ -3078,6 +3078,7 @@ S_method_common(pTHX_ SV* meth, U32* hashp)
  const HE* const he = hv_fetch_ent(stash, meth, 0, *hashp);
  if (he) {
      gv = MUTABLE_GV(HeVAL(he));
+     assert(stash);
      if (isGV(gv) && GvCV(gv) &&
  (!GvCVGEN(gv) || GvCVGEN(gv)
                   == (PL_sub_generation + HvMROMETA(stash)->cache_gen)))
@@ -3085,9 +3086,9 @@ S_method_common(pTHX_ SV* meth, U32* hashp)
  }
     }

+    assert(stash || packsv);
     gv = gv_fetchmethod_sv_flags(stash ? stash : MUTABLE_HV(packsv),
-              meth, GV_AUTOLOAD | GV_CROAK);
-
+                                 meth, GV_AUTOLOAD | GV_CROAK);
     assert(gv);

     return isGV(gv) ? MUTABLE_SV(GvCV(gv)) : MUTABLE_SV(gv);
diff --git a/regcomp.c b/regcomp.c
index eaee604..3d49827 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -2007,6 +2007,7 @@ S_make_trie(pTHX_ RExC_state_t *pRExC_state, regnode *startbranch,
     });

     re_trie_maxbuff = get_sv(RE_TRIE_MAXBUF_NAME, 1);
+    assert(re_trie_maxbuff);
     if (!SvIOK(re_trie_maxbuff)) {
         sv_setiv(re_trie_maxbuff, RE_TRIE_MAXBUF_INIT);
     }
@@ -14920,6 +14921,7 @@ S_set_ANYOF_arg(pTHX_ RExC_state_t* const pRExC_state,
  av_store(av, 0, (runtime_defns)
  ? SvREFCNT_inc(runtime_defns) : &PL_sv_undef);
  if (swash) {
+     assert(cp_list);
      av_store(av, 1, swash);
      SvREFCNT_dec_NN(cp_list);
  }
@@ -16609,6 +16611,7 @@ S_dumpuntil(pTHX_ const regexp *r, const regnode *start, const regnode *node,
         last= plast;

     while (PL_regkind[op] != END && (!last || node < last)) {
+        assert(node);
  /* While that wasn't END last time... */
  NODE_ALIGN(node);
  op = OP(node);
diff --git a/regexec.c b/regexec.c
index 362390b..ffab4f2 100644
--- a/regexec.c
+++ b/regexec.c
@@ -7010,6 +7010,8 @@ no_silent:
                 sv_commit = &PL_sv_yes;
             sv_yes_mark = &PL_sv_no;
         }
+        assert(sv_err);
+        assert(sv_mrk);
         sv_setsv(sv_err, sv_commit);
         sv_setsv(sv_mrk, sv_yes_mark);
     }
@@ -7620,6 +7622,7 @@ Perl__get_regclass_nonbitmap_data(pTHX_ const regexp *prog,
                     *only_utf8_locale_ptr = ary[2];
                 }
                 else {
+                    assert(only_utf8_locale_ptr);
                     *only_utf8_locale_ptr = NULL;
                 }

@@ -7641,7 +7644,7 @@ Perl__get_regclass_nonbitmap_data(pTHX_ const regexp *prog,
      }
      else if (doinit && ((si && si != &PL_sv_undef)
                                  || (invlist && invlist != &PL_sv_undef))) {
-
+ assert(si);
  sw = _core_swash_init("utf8", /* the utf8 package */
        "", /* nameless */
        si,
diff --git a/universal.c b/universal.c
index a29696d..65e02df 100644
--- a/universal.c
+++ b/universal.c
@@ -67,7 +67,7 @@ S_isa_lookup(pTHX_ HV *stash, const char * const name, STRLEN len, U32 flags)
     if (our_stash) {
  HEK *canon_name = HvENAME_HEK(our_stash);
  if (!canon_name) canon_name = HvNAME_HEK(our_stash);
-
+ assert(canon_name);
  if (hv_common(isa, NULL, HEK_KEY(canon_name), HEK_LEN(canon_name),
        HEK_FLAGS(canon_name),
        HV_FETCH_ISEXISTS, NULL, HEK_HASH(canon_name))) {
diff --git a/util.c b/util.c
index b90abe5..cd0afb6 100644
--- a/util.c
+++ b/util.c
@@ -850,15 +850,17 @@ Perl_fbm_instr(pTHX_ unsigned char *big, unsigned char *bigend, SV *littlestr, U

     {
  const MAGIC *const mg = mg_find(littlestr, PERL_MAGIC_bm);
- const unsigned char * const table = (const unsigned char *) mg->mg_ptr;
  const unsigned char *oldlittle;

+ assert(mg);
+
  --littlelen; /* Last char found by table lookup */

  s = big + littlelen;
  little += littlelen; /* last char */
  oldlittle = little;
  if (s < bigend) {
+     const unsigned char * const table = (const unsigned char *) mg->mg_ptr;
      I32 tmp;

    top2:
--
1.8.5.2 (Apple Git-48)

7 years agobump version on NDBM_File
David Mitchell [Thu, 29 May 2014 15:28:12 +0000 (16:28 +0100)]
bump version on NDBM_File

7 years agoO_BINARY versus O_TEXT.
Jarkko Hietaniemi [Thu, 29 May 2014 15:18:24 +0000 (11:18 -0400)]
O_BINARY versus O_TEXT.

O_BINARY and O_TEXT can be either different (mostly in Windowsy platforms,
and in some hybrids, and then they can be either effective or no-ops);
or equal (in UNIXy platforms, no-ops).  If they are no-ops, and especially
if one or both of them are zeros, one cannot even test for them (bit-and),
without introducing dead/non-sensical code.

[perl #121739]

Fix for Coverity perl5 CID 28948:
Logically dead code (DEADCODE)
dead_error_line: Execution cannot reach this statement mode[ix++] = 'b';

7 years agoStrengthen the ix zero min-clamping to panic.
Jarkko Hietaniemi [Thu, 29 May 2014 15:09:48 +0000 (11:09 -0400)]
Strengthen the ix zero min-clamping to panic.

Currently the ix cannot ever be less than zero (detected by Coverity).
Furthermore, it probably should never get less than zero, so panic if
that ever happens.

[perl #121897]

Fix for Coverity perl5 CID 28946:
at_least: At condition ix < 0, the value of ix must be at least 0.
dead_error_condition: The condition ix < 0 cannot be true.
Logically dead code (DEADCODE)
dead_error_line: Execution cannot reach this statement ix = 0;

7 years agoMakefile.SH: Module::Build is no longer there, stop copying it
Brian Fraser [Thu, 29 May 2014 11:47:31 +0000 (13:47 +0200)]
Makefile.SH: Module::Build is no longer there, stop copying it

This only affected 'make test' for cross-compilation builds; in
those, we try to copy files relevant to 'make test' to the target
system.

Since Module::Build is no longer part of the core, no need to
try to copy it over.

7 years agomake regen for uconfig.h
Brian Fraser [Thu, 29 May 2014 11:28:00 +0000 (13:28 +0200)]
make regen for uconfig.h

7 years agoFix for [perl #121963] 5.20.0-RC1 can't compile on Android
Brian Fraser [Thu, 29 May 2014 10:58:52 +0000 (12:58 +0200)]
Fix for [perl #121963] 5.20.0-RC1 can't compile on Android

On some native android builds, this was causing warnings and
possibly build errors before Config.pm was generated.

7 years agoSH_PATH should be $targetsh, not $sh
Brian Fraser [Thu, 29 May 2014 10:54:59 +0000 (12:54 +0200)]
SH_PATH should be $targetsh, not $sh

Due to a small oversight, this was reverted in the last metaconfig
update, and was preventing backticks/system/exec/two-arg-pipe-open
from working in some Android devices.