platform/upstream/perl.git
10 years agoGet switches.t to pass under miniperl
Father Chrysostomos [Wed, 4 Dec 2013 13:56:08 +0000 (05:56 -0800)]
Get switches.t to pass under miniperl

10 years agoDo not clobber @INC completely in buildcustomize.pl
Father Chrysostomos [Wed, 4 Dec 2013 13:46:40 +0000 (05:46 -0800)]
Do not clobber @INC completely in buildcustomize.pl

buildcustomize.pl (for miniperl) replaces @INC (usually qw(lib .))
with the whole list of build directories we need followed by
qw(lib .).

runperl from test.pl is such that this:

    runperl(switches => [ "-Irun/flib" ], ...)

turns into:

    /path/to/perl.git/miniperl "-I../lib" -Irun/flib

The end result is that -Irun/flib gets stripped out and clobbered, and
switchM.t fails under minitest.

10 years agoAdd DO NOT EDIT notice to buildcustomize.pl
Father Chrysostomos [Wed, 4 Dec 2013 13:28:20 +0000 (05:28 -0800)]
Add DO NOT EDIT notice to buildcustomize.pl

10 years agoperlapi, sv.c: Comments and API documentation
Karl Williamson [Fri, 6 Dec 2013 21:23:43 +0000 (14:23 -0700)]
perlapi, sv.c: Comments and API documentation

10 years agoperlretut: Spelling
Karl Williamson [Fri, 6 Dec 2013 21:03:51 +0000 (14:03 -0700)]
perlretut: Spelling

10 years agoperlrebackslash: Add clarifying note about \X
Karl Williamson [Fri, 6 Dec 2013 20:56:51 +0000 (13:56 -0700)]
perlrebackslash: Add clarifying note about \X

10 years agoperlhacktips: Note sprintf glibc bug and workarounds
Karl Williamson [Thu, 12 Sep 2013 03:41:32 +0000 (21:41 -0600)]
perlhacktips: Note sprintf glibc bug and workarounds

http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2013-09/msg00506.htmlP

10 years agoutf8.c: White-space only
Karl Williamson [Fri, 6 Dec 2013 05:19:09 +0000 (22:19 -0700)]
utf8.c: White-space only

Rearrange this multi-line conditional to be easier to read.

10 years agoutf8.h: Add parameter checking to some macros in DEBUGGING builds
Karl Williamson [Tue, 3 Dec 2013 04:55:55 +0000 (21:55 -0700)]
utf8.h: Add parameter checking to some macros in DEBUGGING builds

This change should catch some wrong calls to these macros.  The meat of
the macros is extracted out into two internal-only macros, and the other
macros are rearranged to call these.

10 years agoperlapi: Grammar nits
Karl Williamson [Thu, 5 Dec 2013 06:56:34 +0000 (23:56 -0700)]
perlapi: Grammar nits

"The" referring to a parameter here does not look right to me, a native
English speaker.

10 years agoutf8.c: Remove hard-coded names.
Karl Williamson [Thu, 5 Dec 2013 06:53:14 +0000 (23:53 -0700)]
utf8.c: Remove hard-coded names.

The names of these hashes stored in some disk files is retrievable by a
standardized lookup.  There is no need to have them hard-coded in C
code.  This is one less opportunity for the file and the code to get out
of sync.

10 years agoregcomp.c: Rmv inaccurate and tangential comment
Karl Williamson [Thu, 5 Dec 2013 06:01:30 +0000 (23:01 -0700)]
regcomp.c: Rmv inaccurate and tangential comment

This comment contained inaccuracies and referred to behavior that has
been removed from the core for years.  isPRINT() is sufficiently
documented elsewhere to not need to have its use justified here.

I considered moving part of it to perlebcdic, but it's not generally
true: it's not true for one of Perl's supported EBCDIC code pages, for
example.

10 years agomktables: Add comments to output tables
Karl Williamson [Thu, 5 Dec 2013 05:46:08 +0000 (22:46 -0700)]
mktables: Add comments to output tables

10 years ago[perl #120694] Fix ->SUPER::foo and AUTOLOAD
Father Chrysostomos [Thu, 5 Dec 2013 00:00:48 +0000 (16:00 -0800)]
[perl #120694] Fix ->SUPER::foo and AUTOLOAD

Commit aae438050a20 (5.17.4) broke ->SUPER::foo with AUTOLOAD by look-
ing up AUTOLOAD from the current package, rather than the current
package’s superclass.

Instead of keeping track of whether it was doing a SUPER lookup via a
::SUPER prefix on the package name, that commit changed method lookup
to pass a GV_SUPER flag around (to fix another bug) and to pass the
current stash, rather than __PACKAGE__::SUPER.  But it did not update
gv_autoload_pvn to pass that flag through to gv_fetchmeth_pvn when
actually looking up the method.

10 years agoregexec.c: No statements before declarations
Karl Williamson [Thu, 5 Dec 2013 04:24:38 +0000 (21:24 -0700)]
regexec.c: No statements before declarations

Commit b99851e1941e002dd4816ee6c76fd49bbee1d7f3 moved a statement to
before the declarations in its block.  Mea culpa.  It turns out that I
missed the warnings that were shown for -W=declaration-after-statement.
I'm henceforth changing that to -Werror=declaration-after-statement.

10 years agoperllocale: Add info about locale testing.
Karl Williamson [Thu, 5 Dec 2013 02:50:04 +0000 (19:50 -0700)]
perllocale: Add info about locale testing.

10 years agoperllocale: Nit, and clarification
Karl Williamson [Thu, 5 Dec 2013 02:47:19 +0000 (19:47 -0700)]
perllocale: Nit, and clarification

10 years agoPATCH: [perl #120675] Unexpected tainting via regex using locale
Karl Williamson [Wed, 4 Dec 2013 17:06:04 +0000 (10:06 -0700)]
PATCH: [perl #120675] Unexpected tainting via regex using locale

Tainting should only be turned on if something that could be tainted is
actually tried.  Hence in a [bracketed character class], if the
character being matched is something like

    "a" =~ /([a-z])/l;

tainting isn't turned on because the match doesn't actually depend on
the locale definition.  That is, it would match regardless of the
locale.  Similarly,

    "A" =~ /([a-z])/l;

shouldn't turn on tainting because it shouldn't match no matter what
locale is in effect.  However, until this commit, this worked only
because of a compilte time optimization.  The following (from the
ticket) isn't optimized and didn't work until this commit:

    "foo.bar_baz" =~ /^(.*)[._](.*?)$/';

The [._] was causing tainting even though there is nothing in the
pattern that is locale-dependent.

This commit just moves the tainting to code branches where the locale
actually does matter.  It was just turning it on for any bracketed
character class where the target character didn't match any of the
explicit characters in the class.

10 years agomktables: Clean up relict usage
Karl Williamson [Tue, 3 Dec 2013 06:23:50 +0000 (23:23 -0700)]
mktables: Clean up relict usage

The 'status' of a table generated by mktables was split into two
concepts; these lines should have been changed to reflect that split,
but weren't.  This didn't affect what actually gets generated.
concept

10 years agomktables: Default those tables whose names begin with '_' to internal
Karl Williamson [Tue, 3 Dec 2013 05:44:36 +0000 (22:44 -0700)]
mktables: Default those tables whose names begin with '_' to internal

Some tables that mktables generates are for specialized internal core
use, and should not be accessible through Unicode::UCD nor listed in
perluniprops.  The creation code for _Perl_Any_Folds was moved by commit
8d88896d10ee81fb95a9494ca771f9d2b14f5fc7, but it wasn't a clean move and
the line that caused it to be marked as internal was accidentally removed.
This commit changes things to default to internal-only if the name
begins with an underscore, overridable by an explicit setting.  Thus the
line that got omitted is no longer necessary, and future mistakes like
this won't have any effect.  This is the only property currently
affected by this change.

10 years agoperluniprops: Nit
Karl Williamson [Tue, 3 Dec 2013 05:20:51 +0000 (22:20 -0700)]
perluniprops: Nit

This uses the singular, but might be output applying to more than one.

10 years agoperlapi: Nits
Karl Williamson [Tue, 3 Dec 2013 05:00:31 +0000 (22:00 -0700)]
perlapi: Nits

10 years agoutf8.h: Fix grammar in comment
Karl Williamson [Tue, 3 Dec 2013 04:54:37 +0000 (21:54 -0700)]
utf8.h: Fix grammar in comment

10 years agolib/locale.t: Only output debug message if relevant
Karl Williamson [Tue, 3 Dec 2013 02:28:52 +0000 (19:28 -0700)]
lib/locale.t: Only output debug message if relevant

This message telling people to set an environment variable was output
even if the variable was already set; this is potentially confusing

10 years agoperllocale.pod: clarify tainting of $1 et al
David Mitchell [Wed, 4 Dec 2013 17:05:16 +0000 (17:05 +0000)]
perllocale.pod: clarify tainting of $1 et al

[perl #120675]

The docs weren't clear that *any* locale info used in a regex taints *all*
of $1, $2,...

10 years agotoke.c: Pass GV_NOTQUAL for override lookup
Father Chrysostomos [Wed, 4 Dec 2013 12:24:32 +0000 (04:24 -0800)]
toke.c: Pass GV_NOTQUAL for override lookup

We know in this code path that the name is unqualified, so tell
gv_fetchpvn_flags to skip the parser that looks for package
separators.

10 years agoUpdate CPAN-Meta to CPAN version 2.133380
Chris 'BinGOs' Williams [Wed, 4 Dec 2013 08:46:07 +0000 (08:46 +0000)]
Update CPAN-Meta to CPAN version 2.133380

  [DELTA]

2.133380  2013-12-03 23:01:07 America/New_York

  [FIXED]

  - Improved bad version handling during META conversion

  - When downgrading multiple licenses to version 1.x META formats, if all
    the licenses are open source, the downgraded license will be
    "open_source", not "unknown"

10 years agoUpdate Time-Piece to CPAN version 1.24
Chris 'BinGOs' Williams [Wed, 4 Dec 2013 08:21:39 +0000 (08:21 +0000)]
Update Time-Piece to CPAN version 1.24

  [DELTA]

1.24      2013-12-03
        - add repository metadata (thanks, David Steinbrunner)

10 years agoAdd test for previously uncovered case.
James E Keenan [Wed, 4 Dec 2013 02:56:13 +0000 (03:56 +0100)]
Add test for previously uncovered case.

Explicitly assigned $File::Find::untaint_pattern.

10 years agoStandardize dir_path() and file_path() in package Testing.
James E Keenan [Sun, 1 Dec 2013 18:24:06 +0000 (19:24 +0100)]
Standardize dir_path() and file_path() in package Testing.

The versions of dir_path() and file_path() previously found in find.t and
taint.t differed only in VMS-specific provisions in taint.t.  Move the
taint.t-versions to the package and use them in both files.

10 years agolib/locale.t: Test /il matching
Karl Williamson [Sun, 1 Dec 2013 18:25:34 +0000 (11:25 -0700)]
lib/locale.t: Test /il matching

Case-insensitive matching was essentially being skipped here.  This was
because some locales were broken on some platforms which caused locale.t
to always fail somewhere.  However, the previous commit has changed that
so if just a few locales are bad, the tests are marked as TODOs.  Thus
we can make the /il match tests robust.

10 years agolib/locale.t: Make another test TODO if it fails
Karl Williamson [Tue, 3 Dec 2013 01:28:34 +0000 (18:28 -0700)]
lib/locale.t: Make another test TODO if it fails

Many platforms have a few locales whose casing functionality is buggy.
However if only a few locales have failures, it probably means that Perl
is ok; and its the platform's locale definitions that are bad.  Earlier,
commit 6d5d702a337e9161f8eb85180a83c4469a8f7ed7 enhanced locale.t, if
only a few locales fail, to mark some tests which were showing these
kinds of bugs as TODOs.  This allowed robust tests to be added to
locale.t which previously were ommitted so as to not cause the tests to
fail if any locale on any platform was bad.  Not having these tests
allowed real Perl bugs to creep in.

This commit adds the /il match testing to the list of these tests.
Currently, it is set to hardly catch anything; and this allowed
another real bug to be introduced into Perl.

This commit was prompted by bugs in Darwin with ISO8859-4 and ISO8859-13
locales.

10 years agolib/locale.t: Use lexical instead of $_ in a block
Karl Williamson [Tue, 3 Dec 2013 01:06:10 +0000 (18:06 -0700)]
lib/locale.t: Use lexical instead of $_ in a block

This is because $_ will be used in a future commit for something else

10 years agolib/locale.t: Add some debugging info
Karl Williamson [Sun, 1 Dec 2013 18:07:44 +0000 (11:07 -0700)]
lib/locale.t: Add some debugging info

10 years agolib/locale.t: Add debug verbosity level
Karl Williamson [Sun, 1 Dec 2013 17:55:47 +0000 (10:55 -0700)]
lib/locale.t: Add debug verbosity level

Several prints were commented out (by using an 'if 0').  Instead convert
them to use the function that displays characters using only ASCII
printables, and subject to output when the PERL_DEBUG_FULL_TEST is more
than 1.

10 years agolib/locale.t: Shorten function name
Karl Williamson [Sun, 1 Dec 2013 17:47:41 +0000 (10:47 -0700)]
lib/locale.t: Shorten function name

This is just so that future commits won't have to wrap so many lines to
fit in 79 columns

10 years agoutf8.c: Use U8 instead of UV in several places
Karl Williamson [Sun, 1 Dec 2013 17:43:39 +0000 (10:43 -0700)]
utf8.c: Use U8 instead of UV in several places

These temporaries are all known to fit into 8 bits; by using a U8 it
should be more obvious to an optimizing compiler, and so the bounds
checking need not be done.

10 years agoFix broken locale case-insensitive matching
Karl Williamson [Sat, 30 Nov 2013 22:26:07 +0000 (15:26 -0700)]
Fix broken locale case-insensitive matching

Commit 68067e4e501e2ae1c0fb44558b6aa5c0a80a4143 inadvertently
broke regular expression /i matching under locale.  The tests for this
were defective, so the breakage was not caught.  A later commit will fix
the tests, but this commit restores the functionality.

It also casts the input parameter to some functions to be U8 to make
sure that optimizing compilers can omit bounds checks

10 years agoperlapi: May want to use savesharedpv on threaded Win32
Karl Williamson [Tue, 3 Dec 2013 04:46:37 +0000 (21:46 -0700)]
perlapi: May want to use savesharedpv on threaded Win32

Adds a note to savepv (and similar) that on threaded Windows
that you may need to use the saveshared version because the memory is
deallocated when the thread ends.

10 years agodoio.c: Remove EBCDIC dependency
Karl Williamson [Fri, 29 Nov 2013 17:27:47 +0000 (10:27 -0700)]
doio.c: Remove EBCDIC dependency

For non-EBCDIC this file used \012 instead of \n.  This may have been a
MAC OS Classic hack, which we no longer support.

10 years agoregcomp.c: Slight optimization
Karl Williamson [Wed, 27 Nov 2013 19:46:42 +0000 (12:46 -0700)]
regcomp.c: Slight optimization

A swash is accessed either through its inversion list or its hash (only
large swashes actually have hashes; this is usually transparent).  At
this point in regcomp.c, we only will be looking at the inversion list;
by telling swash_init function that via the flag, later accesses
automatically have a level of indirection removed.

10 years agoperlop: Add note about (?[])
Karl Williamson [Wed, 27 Nov 2013 17:19:22 +0000 (10:19 -0700)]
perlop: Add note about (?[])

10 years agoCheck unlink on directory for all users, not just root.
Craig A. Berry [Sun, 1 Dec 2013 23:16:47 +0000 (17:16 -0600)]
Check unlink on directory for all users, not just root.

For cross-platform consistency, it makes more sense to reject
unlink attempts on directories in the same way for all users
rather than only for root.  geteuid() always returns zero on
Windows, never returns zero on VMS, and is a poor indicator
of privilege on modern unixen, so the code really hasn't been
working as intended on all platforms anyway.

10 years agoMake unlink on directory as root set errno.
Evan Zacks [Tue, 26 Nov 2013 14:56:11 +0000 (09:56 -0500)]
Make unlink on directory as root set errno.

If unlink is called on an existing directory while running as root without -U
(PL_unsafe), the unlink call fails but does not set $!, because unlink(2) is
not actually called in this case.

If unlink is called as a user (or as root with -U), unlink(2) is invoked, so
attempting to remove a directory would set errno to EISDIR as expected. If
running as root without -U (PL_unsafe is false), lstat and S_ISDIR are called
instead. If the lstat succeeds and S_ISDIR returns true, the argument is
skipped without warning and without setting $!, meaning Perl's unlink can
return failure while leaving the previous value of errno in place.

This commit sets errno to EISDIR for this case.

10 years agoUpdate Locale-Codes to CPAN version 3.28
Chris 'BinGOs' Williams [Mon, 2 Dec 2013 12:56:23 +0000 (12:56 +0000)]
Update Locale-Codes to CPAN version 3.28

10 years agoMerge branch 'dirnames' into blead
Steve Hay [Mon, 2 Dec 2013 09:12:24 +0000 (09:12 +0000)]
Merge branch 'dirnames' into blead

10 years agoPage number for caretx.c Tolkien quote
Father Chrysostomos [Mon, 2 Dec 2013 06:40:19 +0000 (22:40 -0800)]
Page number for caretx.c Tolkien quote

Tom Christiansen kindly provided it in <30867.1385946564@chthon>.

10 years agosv.c: Rewrite COW logic
Father Chrysostomos [Sun, 1 Dec 2013 20:16:09 +0000 (12:16 -0800)]
sv.c: Rewrite COW logic

for readability, maintainability, and my sanity.

The comment about swipe and COW having ‘much in common’ notwithstand-
ing (actually they only shared two lines of code), I separated those
two code paths, splitting the horribly complex ‘if’ condition into
two.  I also made the code slightly more repetitive, resulting in
fewer #ifdefs and more clarity.

10 years agoExtract subroutines used to test File-Find into separate package.
James E Keenan [Sun, 1 Dec 2013 17:35:54 +0000 (18:35 +0100)]
Extract subroutines used to test File-Find into separate package.

t/porting/manifest.t and pod_rules.t:  Add comments describing how to handle a
MANIFEST which is not sorted properly (per recommendation by Nicholas Clark).

10 years agoStandardize subroutine definitions between tests.
James E Keenan [Sun, 1 Dec 2013 15:43:47 +0000 (16:43 +0100)]
Standardize subroutine definitions between tests.

In taint.t, replace touch() with create_file_ok() and MkDir() with mkdir_ok().
Make definition of wanted_File_Dir() identical in both test files.

This is a step on the road to eliminating repeated code.

10 years agoUpdate Unicode-Collate to CPAN version 1.03
Chris 'BinGOs' Williams [Sun, 1 Dec 2013 15:21:38 +0000 (15:21 +0000)]
Update Unicode-Collate to CPAN version 1.03

  [DELTA]

1.03  Sun Dec  1 21:45:46 2013
    - XS: now unpack_U() uses unpack('U*') in pure perl.
      avoid XS for the internal "utf8" encoding of perl.

10 years agodon't check format args on taint_proper
David Mitchell [Sun, 1 Dec 2013 11:16:52 +0000 (11:16 +0000)]
don't check format args on taint_proper

My recent commit 5d37acd6b65eb enabled (among other things)
format-arg checking of taint_proper(). This was not a good idea since
taint_proper() adds extra args before it actually calls a printf-style
function. This was masked since on some gcc systems, a NULLOK format arg
disables this check.

10 years agoUpdate ExtUtils-MakeMaker to CPAN version 6.84
Chris 'BinGOs' Williams [Sat, 30 Nov 2013 22:55:42 +0000 (22:55 +0000)]
Update ExtUtils-MakeMaker to CPAN version 6.84

  [DELTA]

6.84 Sat Nov 30 15:22:35 GMT 2013

    No changes from 6.83_06

6.83_06 Fri Nov 29 21:50:51 GMT 2013
    Doc fixes:
    * Correct the documentation for MAGICXS

6.83_05 Mon Nov 25 22:51:11 GMT 2013
    New Features:
    * Added MAGICXS attribute to explicitly enable automagic
      XS building.

    Bug fixes:
    * RT#90780 fix Macro `BOOTSTRAP' redefined warnings
    * Only enable automatic OBJECT generation if MAGICXS is true

6.83_04 Sun Nov 17 11:41:43 GMT 2013
    New Features:
    * OBJECT can now be specified as an array
    * build C_FILES/O_FILES/OBJECT automatically from XS

6.83_03 Fri Nov 15 09:44:26 GMT 2013
    Bug fixes:
    * Don't recurse into stale dist dirs

6.83_02 Tue Nov 12 11:11:34 GMT 2013
    Misc:
    * Enable bootstrapping to work on v5.10.x again

6.83_01 Tue Nov  5 11:43:50 GMT 2013
    Misc:
    * disable make parallelism for pure_all target

10 years agosv.c: Clarify COW comments further
Father Chrysostomos [Sat, 30 Nov 2013 20:56:56 +0000 (12:56 -0800)]
sv.c: Clarify COW comments further

I was getting confused even when I wrote these comments.

10 years agoFix stdin inheritance for system and backticks on VMS.
Craig A. Berry [Sat, 30 Nov 2013 14:47:09 +0000 (08:47 -0600)]
Fix stdin inheritance for system and backticks on VMS.

The documentation to LIB$SPAWN says that standard input will be
inherited from the parent if not specified, and we've been
depending on that.  But it seems not to actually work that way
as a simple

    $ perl -e "system('edit foo.tmp');"

was failing due to the input not being a terminal.  So set up the
input explicitly using the same mechanism we've always used for
output and error.

Except when SYS$INPUT is a "directory," which probably means it's
a channel open on a volume that holds a command procedure.

10 years agoregen pod issues
Father Chrysostomos [Sat, 30 Nov 2013 14:43:00 +0000 (06:43 -0800)]
regen pod issues

10 years agosv.c: Fix Darwin g++ build
Father Chrysostomos [Sat, 30 Nov 2013 14:16:57 +0000 (06:16 -0800)]
sv.c: Fix Darwin g++ build

10 years ago[Merge] Swiping PADTMPs’ string buffers
Father Chrysostomos [Sat, 30 Nov 2013 13:55:54 +0000 (05:55 -0800)]
[Merge] Swiping PADTMPs’ string buffers

This branch allows PADTMPs’ string buffers to be stolen, benefiting
programs that use long strings by avoiding a few copies.

10 years agoPeek.t: Update skip version
Father Chrysostomos [Sat, 30 Nov 2013 13:55:40 +0000 (05:55 -0800)]
Peek.t: Update skip version

I did not have this branch ready in time for 5.19.6.

10 years agoIncrease $constant::VERSION to 1.30
Father Chrysostomos [Sat, 30 Nov 2013 02:58:36 +0000 (18:58 -0800)]
Increase $constant::VERSION to 1.30

10 years agosv.c: String copy comments
Father Chrysostomos [Wed, 20 Nov 2013 14:19:05 +0000 (06:19 -0800)]
sv.c: String copy comments

This layout, which goes back to 765f542df2 in 2002, I find a bit con-
fusing.  The comments help.  (Though rewriting it might be better.)
 Granted, back in 2002 there wasn’t nearly as much code in any of
the branches.

10 years agoAllow PADTMPs’ strings to be swiped
Father Chrysostomos [Thu, 14 Nov 2013 02:10:49 +0000 (18:10 -0800)]
Allow PADTMPs’ strings to be swiped

While copy-on-write does speed things up, it is not perfect.  Take
this snippet for example:

$a = "$b$c";
$a .= $d;

The concatenation operator on the rhs of the first line has its own
scalar that it reuses every time that operator is called (its target).
When the assignment happens, $a and that target share the same string
buffer, which is good, because we didn’t have to copy it.  But because
it is shared between two scalars, the concatenation on the second line
forces it to be copied.

While copy-on-write may be fast, string swiping surpasses it, because
it has no later bookkeeping overhead.  If we allow stealing targets’
strings, then $a = "$b$c" no longer causes $a to share the same string
buffer as the target; rather, $a steals that buffer and leaves the tar-
get undefined.  The result is that neither ‘$a =’ nor ‘$a .= $d’ needs
to copy any strings.  Only the "$b$c" will copy strings (unavoidably).

This commit only applies that to long strings, however.  This is why:

Simply swiping the string from any swipable TARG (which I tried at
first) resulted in a significant slowdown.  By swiping the string from
a TARG that is going to be reused (as opposed to a TEMP about to be
freed, which is where swipe was already happening), we force it to
allocate another string next time, greatly increasing the number
of malloc calls.  malloc overhead exceeds the overhead of copying
short strings.

I tried swiping TARGs for short strings only when the buffer on the
lhs was not big enough for a copy (or there wasn’t one), but simple
benchmarks with mktables show that even checking SvLEN(dstr) is enough
to slow things down, since the speed-up this provides is minimal where
short strings are involved.

Then I tried checking just the string length, and saw a consistent
speed increase.  So that’s what this patch uses.  Programs using short
strings will not benefit.  Programs using long strings may see a 1.5%
increase in speed, due to fewer string copies.

10 years agoop.c: Turn on read-only flag for folded constants
Father Chrysostomos [Wed, 13 Nov 2013 13:52:00 +0000 (05:52 -0800)]
op.c: Turn on read-only flag for folded constants

They are marked PADTMP, which causes them to be copied in any contexts
where readonliness makes a difference, so marking them as read-only
does not change the behaviour.  What it does is allow a future commit
to implement string swiping for PADTMPs.

10 years agoconstant.pm: Make elements of list consts read-only
Father Chrysostomos [Wed, 13 Nov 2013 04:40:11 +0000 (20:40 -0800)]
constant.pm: Make elements of list consts read-only

Now that Internals::SvREADONLY turns on the PADTMP flag for all the
elements, the read-only flag on the elements themselves will not
actually make the returned elements read-only, because PADTMPs get
copied in all cases where readonliness matters.  What this does is
prevent the original SV from being modified, allowing for more opti-
misations in perl’s internals (e.g., string buffers being stolen from
PADTMPs not marked read-only).

The order of the statements needs to be rearranged, otherwise we end
up setting the flag on a temporary copy of each element due to ‘for’.

10 years agosilence -Wformat-nonliteral in pp_formline
David Mitchell [Sat, 30 Nov 2013 12:20:50 +0000 (12:20 +0000)]
silence -Wformat-nonliteral in pp_formline

10 years agorevert pp_formline -Wformat-nonliteral fix
David Mitchell [Sat, 30 Nov 2013 12:16:17 +0000 (12:16 +0000)]
revert pp_formline -Wformat-nonliteral fix

Revert the part of 5d37acd6b65eb421e938a3fde62cc1edde467dae that was
intended to silence non-literal format warnings. It's giving compiler
errors on AIX due (I suspect) to overlong macro expansions.

The next commit will fix the warning in a more prosaic fashion

10 years agoUpdate HTTP-Tiny to CPAN version 0.039
Chris 'BinGOs' Williams [Fri, 29 Nov 2013 21:07:00 +0000 (21:07 +0000)]
Update HTTP-Tiny to CPAN version 0.039

  [DELTA]

0.039     2013-11-27 19:48:29 America/New_York

    [FIXED]

    - Temporary file creating during mirror() is now opened with O_EXCL
      for added security

10 years agofix -Wsign-compare in core
David Mitchell [Fri, 29 Nov 2013 17:44:12 +0000 (17:44 +0000)]
fix -Wsign-compare in core

There were a few places that were doing

    unsigned_var = cond ? signed_val : unsigned_val;

or similar. Fixed by suitable casts etc.

The four in utf8.c were fixed by assigning to an intermediate
unsigned var; this has the happy side-effect of collapsing
a large macro expansion, where toUPPER_LC() etc evaluate their arg
multiple times.

10 years agoMove Cwd and List-Util: UNIX followup
David Mitchell [Fri, 29 Nov 2013 16:12:20 +0000 (16:12 +0000)]
Move Cwd and List-Util: UNIX followup

the previous commit worked on win32; this commit makes it work under UNIX
too.

Basically Configure determines a list of "logical" extension names
such as "IPC/SysV",  based on physical dirs under cpan/ etc such as
"IPC-SysV".

In this case, keep the original logical names "Cwd" and "List/Util",
even though the physical paths have been changed to "PathTools" and
"Scalar/List/Utils".

10 years agoRevert part of 2efab60d9
Father Chrysostomos [Fri, 29 Nov 2013 00:05:30 +0000 (16:05 -0800)]
Revert part of 2efab60d9

As Karl Williamson pointed out in <5296C04E.10103@khwilliamson.com>,
sv_setpv will do SvOK_off if Strerror returns null, so this SvOK check
is not redundant.

10 years agoGCC_DIAG_IGNORE() only with >= 4.6
David Mitchell [Thu, 28 Nov 2013 20:13:50 +0000 (20:13 +0000)]
GCC_DIAG_IGNORE() only with >= 4.6

The new GCC_DIAG_IGNORE() pragma I added a few commits ago was only
supposed to be enabled on gcc 4.6+; my code inadvertently did it on
4.2+

10 years agoDocument how to build perl for WinCE using EVC4
Steve Hay [Thu, 28 Nov 2013 18:20:18 +0000 (18:20 +0000)]
Document how to build perl for WinCE using EVC4

These notes are largely copied from those supplied by Daniel Dragan
<bulk88@hotmail.com> in [perl #120365] after verification by the committer.

10 years agosilence -Wformat-nonliteral compiler warnings
David Mitchell [Thu, 28 Nov 2013 16:46:15 +0000 (16:46 +0000)]
silence -Wformat-nonliteral compiler warnings

Due to the security risks associated with user-supplied formats
being passed to C-level printf() style functions (eg %n),
gcc has a -Wformat-nonliteral warning that complains whenever such a
function is passed a non-literal format string.

This commit silences all such warnings in core and ext/.

The main changes are

1) the 'f' (format) flag in embed.fnc is now handled slightly more
cleverly. Rather than just applying to functions whose last arg is '...'
(and where the format arg is assumed to be the previous arg), it
can now handle non-'...' functions: arg checking is disabled, but format
checking is sill done: it works by assuming that an arg called 'fmt',
'pat' or 'f' is the format string (and dies if fails to find exactly one
such arg).

2) with the new embed.fnc functionally, more functions have been marked
with the 'f' flag. When such a function passes its fmt arg onto an inner
printf-like function, we simply disable the warning for that call using
GCC_DIAG_IGNORE(-Wformat-nonliteral), since we know that the caller must
have already checked it.

3) In quite a few places the format string isn't literal, but it *is*
constant (e.g. PL_warn_uninit_sv). For those cases, again disable the
warning.

4) In pp_formline(), a particular format was was one of several different
literal strings depending on circumstances. Rather than assigning this
string to a temporary variable, incorporate the ?: branches directly in
the function call arg. gcc is clever enough to decide the arg is then
always literal.

10 years agoadd GCC_DIAG_IGNORE(), GCC_DIAG_RESTORE macros
David Mitchell [Wed, 27 Nov 2013 16:56:59 +0000 (16:56 +0000)]
add GCC_DIAG_IGNORE(), GCC_DIAG_RESTORE macros

These allow you to temporarily disable a specific gcc or clang warning;
e.g.

    GCC_DIAG_IGNORE(-Wmultichar);
    char b = 'ab';
    GCC_DIAG_RESTORE;

10 years agomark Perl_my_strftime with format attribute
David Mitchell [Tue, 26 Nov 2013 15:50:45 +0000 (15:50 +0000)]
mark Perl_my_strftime with format attribute

mark this function with

    __attribute__format__null_ok__(__strftime__,pTHX_1,0)

so that compiler checks and warnings about strftime-style format args
can be checked.

Rather than adding new flag(s) to embed.fnc, I just enhanced the f flag
to treat it as strftime-style rather than printf if the function name
matches /strftime/. This was quicker, and we're unlikely to have many
such functions.

10 years agoremove almost unreachable NULL sv arg code from sv_2*n_flags
Daniel Dragan [Fri, 15 Nov 2013 06:52:44 +0000 (01:52 -0500)]
remove almost unreachable NULL sv arg code from sv_2*n_flags

The NULL sv code being removed dates to commit e334a159a5 Perl 1.0 as
the pre-SV str_2ptr and str_2num calls. When SVs were intoduced in
commit 79072805bf Perl 5.0 alpha 2, the NULL sv code was copied to the new
SV functions. The functions were bulk marked non-NULL in commit f54cb97a39
during 5.9.3 development. The docs were corrected to say NULLOK support
in commit 53e8571218 during 5.11.0.

See the perldelta part of this patch for the rest of commit body.

10 years agomg.c: Remove redundant SvOK checks
Father Chrysostomos [Wed, 27 Nov 2013 15:18:59 +0000 (07:18 -0800)]
mg.c: Remove redundant SvOK checks

10 years agoUpdate Module-Build to CPAN version 0.4203
Chris 'BinGOs' Williams [Thu, 28 Nov 2013 00:06:04 +0000 (00:06 +0000)]
Update Module-Build to CPAN version 0.4203

  [DELTA]

0.4203 - Wed Nov 27 19:09:05 CET 2013

  [BUG FIXES]

  - Map recommends back to runtime recommends [Leon Timmermans]

  - Map restrictive license to restricted in meta 2.0 [Leon Timmermans]

10 years agoAdd deprecation for CGI.pm
Chris 'BinGOs' Williams [Wed, 27 Nov 2013 20:13:17 +0000 (20:13 +0000)]
Add deprecation for CGI.pm

10 years agoRevert "Squash COWs in the char* typemap"
Father Chrysostomos [Wed, 27 Nov 2013 15:13:15 +0000 (07:13 -0800)]
Revert "Squash COWs in the char* typemap"

This reverts commit 77ca9de6373481d905eed6af2904599353a658b3.

10 years agoRevert "Increase $XS::Typemap::VERSION to 0.13"
Father Chrysostomos [Wed, 27 Nov 2013 15:13:09 +0000 (07:13 -0800)]
Revert "Increase $XS::Typemap::VERSION to 0.13"

This reverts commit 3407f4a92d7d9731d099e0290b68d7e983ff2497.

10 years agoUpgrade File-Fetch from version 0.44 to 0.46
Steve Hay [Wed, 27 Nov 2013 08:37:23 +0000 (08:37 +0000)]
Upgrade File-Fetch from version 0.44 to 0.46

* Blacklist 'lftp' on DragonflyBSD

10 years agoUpdate CGI from version 3.63 to 3.64
Steve Hay [Wed, 27 Nov 2013 08:34:21 +0000 (08:34 +0000)]
Update CGI from version 3.63 to 3.64

    [BUG FIXES]
    - Avoid warning about "undefined variable in user_agent in some cases (RT#72882)

    [INTERNALS]
    - Avoiding warning about "unitialized value" in when calling user_agent() in some cases. (RT#72882, perl@max-maurer.de)
    - Update minimum required version in Makefile.PL to 5.8.1. It had already been
      updated to 5.8.1 in the CGI.pm module in 3.53.
    - Fix POD errors reported by newer pod2man (Thanks to jmdh)
    - Typo fixes, (dsteinbrunner).
    - use deprecate.pm on perls 5.19.0 and later. (rjbs).

    [DOCUMENTATION]
    - Update CGI::Cookie docs to reflect that HttpOnly is widely supported now.

10 years agoRespect 'use bytes' in returning $! and $^E
Karl Williamson [Thu, 17 Oct 2013 03:25:26 +0000 (21:25 -0600)]
Respect 'use bytes' in returning $! and $^E

This addresses some of the field problems caused by commit
1500bd919ffeae0f3252f8d1bb28b03b043d328e, but by no means all.
If the stringification of $^E or $! is done in the scope of 'use bytes',
the UTF-8 flag on the result is now never set.  In such scope, the
behavior is then the same as it was prior to that commit.  The actual
behavior will change before v5.20 ships.

10 years ago$^E should have same handling as $! for Win32 and OS/2
Karl Williamson [Thu, 17 Oct 2013 03:21:52 +0000 (21:21 -0600)]
$^E should have same handling as $! for Win32 and OS/2

Commit 1500bd919ffeae0f3252f8d1bb28b03b043d328e changed the handling of
$! to look for UTF-8 messages.  This issue is also present in Win32 for
$^E.  The two should have uniform treatment, so this commit causes the
actual same code to be executed for both.  OS/2 is also subject to
locale issues, and so it also is changed here to use the same code, so
that future changes will apply to it automatically.

VMS doesn't use locales, so it retains its current behavior.

Note that 1500bd919 has created some field problems, so that the changes
it introduced will be further changed or reverted.  The current commit
just makes sure that whatever those further changes are will be
automatically propagated to all necessary platforms.

10 years agomg.c: Extract code into a function.
Karl Williamson [Thu, 17 Oct 2013 03:09:00 +0000 (21:09 -0600)]
mg.c: Extract code into a function.

This is in preparation for the same code to be used in additional
places.  There should be no logic changes.

10 years agomg.c: White-space only
Karl Williamson [Tue, 10 Sep 2013 02:09:13 +0000 (20:09 -0600)]
mg.c: White-space only

Outdent this code as a result of removing outer blocks

10 years agomg.c: Use $! code for $^E on platforms where are same
Karl Williamson [Tue, 10 Sep 2013 02:04:39 +0000 (20:04 -0600)]
mg.c: Use $! code for $^E on platforms where are same

Only a few platforms have $^E distinguished from $!.  On all others they
should behave identically.  Previous commits, have caused these to get
out-of-sync.  This causes them to share their code on platforms where
they mean the same thing, so this won't happen again.

10 years agomg.c: Reorder if else clauses
Karl Williamson [Tue, 10 Sep 2013 01:39:07 +0000 (19:39 -0600)]
mg.c: Reorder if else clauses

This is to allow two cases in the switch statement to be combined in the
next commit.  There should be no effective logic change

10 years agomg.c: Reorder cases in a switch()
Karl Williamson [Tue, 10 Sep 2013 01:05:53 +0000 (19:05 -0600)]
mg.c: Reorder cases in a switch()

This is just cut and paste with no other changes; it is in preparation
for combining two cases in a future commit

10 years agohandy.h: Slightly refactor READ_XDIGIT macro
Karl Williamson [Sat, 23 Nov 2013 17:04:57 +0000 (10:04 -0700)]
handy.h: Slightly refactor READ_XDIGIT macro

This adds comments as to how it works, factors out the mask to be
specified only once, and uses isDIGIT instead of isALPHA, as the former
is likely to be slightly more efficient (because isDIGIT doesn't have to
worry about there being non-ASCII digits, and isALPHA does have to worry
about non-ASCII alphas).  The result is easier to understand what's
going on.

10 years agoExtend Intel C++ compiler support (a48cc4c427) to dmake builds
Steve Hay [Tue, 26 Nov 2013 09:06:30 +0000 (09:06 +0000)]
Extend Intel C++ compiler support (a48cc4c427) to dmake builds

10 years agobump DynaLoader version after previous commits
David Mitchell [Tue, 26 Nov 2013 14:04:17 +0000 (14:04 +0000)]
bump DynaLoader version after previous commits

10 years agodl_hpux.xs: fix PREINIT boundary
David Mitchell [Tue, 26 Nov 2013 13:55:59 +0000 (13:55 +0000)]
dl_hpux.xs: fix PREINIT boundary

my previous commit moved some var declarations from CODE: to PREINIT:;
but I was slightly overzealous and moved a non-declaration line too.

10 years agoDynaloader: use PREINIT to avoid compiler errors
David Mitchell [Tue, 26 Nov 2013 13:29:08 +0000 (13:29 +0000)]
Dynaloader: use PREINIT to avoid compiler errors

A recent change to the typmap definitions makes a var declaration
generate code. Move this declaration from CODE: to PREINIT: to avoid a
'Mixed declarations' compiler error.

This was spotted in dl_hpux.xs by bulk88, which I've blindly fixed.
From visual inspection there were also declarations in dl_vms.xs
that needed moving (although in that case it dosen't trigger the typemap
code emission).

10 years agoperlunicode: Nits
Karl Williamson [Tue, 26 Nov 2013 02:26:17 +0000 (19:26 -0700)]
perlunicode: Nits

User-defined \p{}, \P{} are valid on not just Unicode code points; and
use C<> around a code fragment

10 years agoperlrecharclass: Add statement about above-Unicode and (?[])
Karl Williamson [Tue, 26 Nov 2013 02:14:46 +0000 (19:14 -0700)]
perlrecharclass: Add statement about above-Unicode and (?[])

The extended bracketed character class does not raise warnings when
non-Unicode code points are matched against it.

10 years agoperluniprops: Tweaks
Karl Williamson [Tue, 26 Nov 2013 02:03:29 +0000 (19:03 -0700)]
perluniprops: Tweaks

Every time I read over something I wrote, I see some improvements in the
wording, and in this case the layout as well: a couple of lists are set
off by indententation

10 years agoperlapi: Refer to correct formal parameter name
Karl Williamson [Tue, 26 Nov 2013 01:24:17 +0000 (18:24 -0700)]
perlapi: Refer to correct formal parameter name

10 years agohandy.h: Remove duplicate line
Karl Williamson [Sat, 23 Nov 2013 16:55:04 +0000 (09:55 -0700)]
handy.h: Remove duplicate line

Two adjacent lines were identical.  Only one is needed.