This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perl5.git
7 years agoperlfunc/open: clarify role of mode for undef filename
Aristotle Pagaltzis [Fri, 25 Nov 2016 01:04:52 +0000 (02:04 +0100)]
perlfunc/open: clarify role of mode for undef filename

7 years agoutf8.c: Fix EBCDIC detection of above-31 bit code points
Karl Williamson [Thu, 24 Nov 2016 17:54:23 +0000 (10:54 -0700)]
utf8.c: Fix EBCDIC detection of above-31 bit code points

This was failing on EBCDIC machines, and I couldn't figure out why.  I
didn't see any flaws in the logic.  It required special debugging code
to answer.  It turns out it was a bad declaration, and not logic at all.

The declaration should have been

    const U8 prefix[] = ...

instead it was

    const U8 * const prefix = ...

sizeof() the latter is 4, as it is looking at pointer size.  What was
intended was the size of the array this was initialized to, which was
longer.  What this led to was later in the routine, a comparison was
stopping too early.

7 years agoAPItest/t/utf8.t: White space only
Karl Williamson [Wed, 23 Nov 2016 03:30:56 +0000 (20:30 -0700)]
APItest/t/utf8.t: White space only

This indents the new block formed by the previous commit.  However,
since the indentation is getting too much, it also changes the indents
for all the nested for loops to 2 spaces to allow room on the line.

7 years agoSplit diagnostics for two UTF-8 malformations
Karl Williamson [Wed, 23 Nov 2016 00:47:35 +0000 (17:47 -0700)]
Split diagnostics for two UTF-8 malformations

Some UTF-8 sequences may have multiple malformations.  Commit
2b5e7bc2e60b4c4b5d87aa66e066363d9dce7930 tried to make sure that all
possible ones are raised, instead of abandoning searching after one is
found.  Since, I realized that there was yet another case of two
malformations that it returned only one or the other of.

An input buffer may be too short to fully express the code point it
purports to.  This can be determined by the first byte of the UTF-8
sequence indicating a longer sequence is requred than the space
available.  But also, that shortened sequence can have a premature
beginning of another character earlier than the shortness.  This commit
causes these to be both raised, instead of the previous behavior of
noting just one.

7 years agoAPItest/t/utf8.t: Partially refactor to use table data
Karl Williamson [Wed, 23 Nov 2016 01:14:45 +0000 (18:14 -0700)]
APItest/t/utf8.t: Partially refactor to use table data

This removes kludgy code that was trying, given a partial
character, to determine if there enough bytes present to guarantee that
the whole character must belong to a class of characters or not.  Now
the necessary length to make that determination has instead manually
been placed in a table, so it can be looked up.  In doing so, I
corrected one length that was failing on EBCDIC.

7 years agoAPItest/t/utf8.t: Fix test
Karl Williamson [Wed, 23 Nov 2016 01:07:31 +0000 (18:07 -0700)]
APItest/t/utf8.t: Fix test

It turns out that this test has two malformations, and should only have
one; a future commit will remove the masking of the 2nd one.

7 years agoAPItest/t/utf8.t: Comments only
Karl Williamson [Wed, 23 Nov 2016 01:01:21 +0000 (18:01 -0700)]
APItest/t/utf8.t: Comments only

7 years agoAPItest/t/utf8.t: Add some indentation to diagnositcs
Karl Williamson [Wed, 23 Nov 2016 00:55:10 +0000 (17:55 -0700)]
APItest/t/utf8.t: Add some indentation to diagnositcs

This is so they don't interrupt reading the output when there are
errors.

7 years agoutf8.c: Clarify warning message.
Karl Williamson [Tue, 22 Nov 2016 20:15:18 +0000 (13:15 -0700)]
utf8.c: Clarify warning message.

This warning was changed recently in the 5.25 series, and has not been
in a stable release.

7 years agoAPItest/t/utf8.t: Simplify expression slightly
Karl Williamson [Mon, 21 Nov 2016 21:59:47 +0000 (14:59 -0700)]
APItest/t/utf8.t: Simplify expression slightly

7 years agoAPItest/t/handy.t: Output details if test fails
Karl Williamson [Sun, 20 Nov 2016 14:56:40 +0000 (07:56 -0700)]
APItest/t/handy.t: Output details if test fails

There should be no warnings generated, but if there are, we want to see
what they were.

7 years agoadd comments explaining the point of SVf_PROTECT
David Mitchell [Thu, 24 Nov 2016 14:42:27 +0000 (14:42 +0000)]
add comments explaining the point of SVf_PROTECT

The flag was added by v5.21.4-17-ga623f89, but outside of the commit
message itself, there didn't seem to be any explanation for this flag.

7 years agoPOSIX.pm: shut up g++ compiler warning
David Mitchell [Thu, 24 Nov 2016 13:52:30 +0000 (13:52 +0000)]
POSIX.pm: shut up g++ compiler warning

g++ is too stupid to know that strtoul(..,&unparsed,...) will modify
unparsed. So initialise it to NULL.

POSIX.xs: In function ‘void XS_POSIX_strtoul(PerlInterpreter*, CV*)’:
POSIX.xs:3468:17: warning: ‘unparsed’ may be used uninitialized in this function [-Wmaybe-uninitialized]
                 if (unparsed)

7 years agoadd sv_set_undef() API function
David Mitchell [Thu, 24 Nov 2016 09:40:44 +0000 (09:40 +0000)]
add sv_set_undef() API function

This function is equivalent to sv_setsv(sv, &PL_sv_undef), but more
efficient.

Also change the obvious places in the core to use the new idiom.

7 years agoavoid premature free of referent in list assign
David Mitchell [Tue, 22 Nov 2016 16:41:54 +0000 (16:41 +0000)]
avoid premature free of referent in list assign

RT #130132

My recent commit v5.25.6-266-ga083329 made it so that perl could
sometimes avoid mortalising the referent when assigning to a reference
(e.g. for $ref1 = $ref2, where $$ref1 has a ref count of 1).

Unfortunately it turns out that list assign relied on this behaviour
to avoid premature freeing, e.g.

    ($ref1, $x) = ($y, $$ref1);

where $$ref1 needs to continue to live for at least the rest of the
assign.

This commit fixes it by mortalising the referent in pp_assign when
required.

7 years agoThis one goes up to 11
Chris 'BinGOs' Williams [Thu, 24 Nov 2016 11:49:29 +0000 (11:49 +0000)]
This one goes up to 11

7 years agoembed.fnc: Remove inappropriate pure attributes
Karl Williamson [Tue, 22 Nov 2016 18:30:28 +0000 (11:30 -0700)]
embed.fnc: Remove inappropriate pure attributes

In looking at the diffs from f6e4c377437f9b2ded79fb55f66983a6d4f761f9,
just committed, I realized that some of the functions marked pure,
really have side effects, if only initialization if not called
previously.  Still, the compiler could optimize things so it is wrong.
I then did a manual audit of embed.fnc, and removed the pure attribute
of the functions that I found that have some potential side effects.

7 years agoMake (P)ure funcs in embed.fnc imply (R)eturn must be checked
Andy Lester [Tue, 22 Nov 2016 13:17:45 +0000 (06:17 -0700)]
Make (P)ure funcs in embed.fnc imply (R)eturn must be checked

embed.fnc defines that a pure function is one that has no effects other
than its return value.  Therefore, calling such a function without using
the return value must be an error.

This patch makes a "P" "pure function" flag also imply the "R" "return
value must be checked" flag.

7 years agoConfigure: also zero out high bytes of 80-bit ldnan
Niko Tyni [Sat, 19 Nov 2016 07:45:45 +0000 (09:45 +0200)]
Configure: also zero out high bytes of 80-bit ldnan

These are currently zero anyway, but things are probably not guaranteed
to stay so.

7 years agoConfigure: fix garbage filtering with 80-bit long doubles
Niko Tyni [Fri, 18 Nov 2016 16:36:34 +0000 (18:36 +0200)]
Configure: fix garbage filtering with 80-bit long doubles

The test had several problems that resulted in the excess
bytes not getting zeroed out. This caused random contents in
$Config{longdblinfbytes}, observed on Debian with GCC 6.2.0 (but not
5.4.1).

Bug-Debian: https://bugs.debian.org/844752

7 years agoRecommend the quicker "make test_prep" for t/TEST usage.
Matthew Horsfall [Mon, 21 Nov 2016 14:07:21 +0000 (09:07 -0500)]
Recommend the quicker "make test_prep" for t/TEST usage.

7 years agoBump Module::CoreList version
Chad Granum [Sun, 20 Nov 2016 22:05:26 +0000 (14:05 -0800)]
Bump Module::CoreList version

7 years agoBump the perl version in various places for 5.25.8
Chad Granum [Sun, 20 Nov 2016 22:02:47 +0000 (14:02 -0800)]
Bump the perl version in various places for 5.25.8

7 years agonew perldelta
Chad Granum [Sun, 20 Nov 2016 21:30:09 +0000 (13:30 -0800)]
new perldelta

7 years agoUpdate epigraphs and release schedule
Chad Granum [Sun, 20 Nov 2016 21:29:08 +0000 (13:29 -0800)]
Update epigraphs and release schedule

7 years agoupdate t/porting/known_pod_issues.dat v5.25.7
Chad Granum [Sun, 20 Nov 2016 20:10:44 +0000 (12:10 -0800)]
update t/porting/known_pod_issues.dat

7 years agoUpdate perlhist.pod for 5.25.7
Chad Granum [Sun, 20 Nov 2016 19:21:53 +0000 (11:21 -0800)]
Update perlhist.pod for 5.25.7

7 years agoFinalize perldelta for 5.25.7
Chad Granum [Sun, 20 Nov 2016 19:17:09 +0000 (11:17 -0800)]
Finalize perldelta for 5.25.7

Following release manager doc

7 years agoUpdate Module::CoreLiast for 5.25.7
Chad Granum [Sun, 20 Nov 2016 18:51:39 +0000 (10:51 -0800)]
Update Module::CoreLiast for 5.25.7

7 years agoFix Module-CoreList version info for 5.25.7
Chad Granum [Sun, 20 Nov 2016 18:49:18 +0000 (10:49 -0800)]
Fix Module-CoreList version info for 5.25.7

7 years agoFinal manual updates to perldelta
Chad Granum [Sun, 20 Nov 2016 15:52:19 +0000 (07:52 -0800)]
Final manual updates to perldelta

This will still likeyl get minor changes in the rest of the release
process, but the pre-release editing is done.

7 years agoCorrect one POD formatting error in perldelta.
James E Keenan [Sun, 20 Nov 2016 17:28:15 +0000 (12:28 -0500)]
Correct one POD formatting error in perldelta.

This commit satisfies 'podchecker pod/perldelta.pod', but there remain
problems detected during t/porting/podcheck.t.

7 years agoperldelta fixes from khw
Karl Williamson [Sun, 20 Nov 2016 00:33:07 +0000 (17:33 -0700)]
perldelta fixes from khw

The ones I removed are so minor as to not be worth mentioning.

7 years agoPerldelta updates in prep for tomorrows release
Chad Granum [Sat, 19 Nov 2016 15:37:20 +0000 (07:37 -0800)]
Perldelta updates in prep for tomorrows release

7 years agoExtUtils::ParseXS: Rmv impediment to compiling under C++11
Karl Williamson [Fri, 18 Nov 2016 21:54:09 +0000 (14:54 -0700)]
ExtUtils::ParseXS: Rmv impediment to compiling under C++11

C++11 changed from earlier versions to require space between the end of
a string literal and a macro, so that a feature can unambiguously be
added to the language.  Starting in g++ 6.2, the compiler emits a
deprecation warning when there isn't a space (presumably so that future
versions can support C++11).

Although not required by the C++11 change, this patch also makes sure
there is space after a macro call, before a string literal.  This makes
the macro stand out, and is easier to read.

Code and modules included with the Perl core need to be compilable using
C++.  This is so that perl can be embedded in C++ programs. (Actually,
only the hdr files need to be so compilable, but it would be hard to
test that just the hdrs are compilable.)  So we need to accommodate
changes to the C++ language.

7 years agoData-Dumper: Rmv impediment to compiling under C++11
Karl Williamson [Fri, 18 Nov 2016 21:41:17 +0000 (14:41 -0700)]
Data-Dumper: Rmv impediment to compiling under C++11

C++11 changed from earlier versions to require space between the end of
a string literal and a macro, so that a feature can unambiguously be
added to the language.  Starting in g++ 6.2, the compiler emits a
deprecation warning when there isn't a space (presumably so that future
versions can support C++11).

Although not required by the C++11 change, this patch also makes sure
there is space after a macro call, before a string literal.  This makes
the macro stand out, and is easier to read.  As part of this, useless ""
following the macro are removed.

This patch also changes the affected lines to not exceed 79 columns, as
specified by perlhack.

Code and modules included with the Perl core need to be compilable using
C++.  This is so that perl can be embedded in C++ programs. (Actually,
only the hdr files need to be so compilable, but it would be hard to
test that just the hdrs are compilable.)  So we need to accommodate
changes to the C++ language.

7 years agoStorable: Rmv impediment to compiling under C++11
Karl Williamson [Fri, 18 Nov 2016 20:34:03 +0000 (13:34 -0700)]
Storable: Rmv impediment to compiling under C++11

C++11 changed from earlier versions to require space between the end of
a string literal and a macro, so that a feature can unambiguously be
added to the language.  Starting in g++ 6.2, the compiler emits a
deprecation warning when there isn't a space (presumably so that future
versions can support C++11).

Although not required by the C++11 change, this patch also makes sure
there is space after a macro call, before a string literal.  This makes
the macro stand out, and is easier to read.

This patch also changes the affected lines to not exceed 79 columns, as
specified by perlhack.

Code and modules included with the Perl core need to be compilable using
C++.  This is so that perl can be embedded in C++ programs. (Actually,
only the hdr files need to be so compilable, but it would be hard to
test that just the hdrs are compilable.)  So we need to accommodate
changes to the C++ language.

7 years agothreads.xs: Rmv impediment to compiling under C++11
Karl Williamson [Sat, 19 Nov 2016 12:32:57 +0000 (05:32 -0700)]
threads.xs: Rmv impediment to compiling under C++11

C++11 changed from earlier versions to require space between the end of
a string literal and a macro, so that a feature can unambiguously be
added to the language.  Starting in g++ 6.2, the compiler emits a
deprecation warning when there isn't a space (presumably so that future
versions can support C++11).

This patch also changes the affected line to not exceed 79 columns, as
specified by perlhack.

Code and modules included with the Perl core need to be compilable using
C++.  This is so that perl can be embedded in C++ programs. (Actually,
only the hdr files need to be so compilable, but it would be hard to
test that just the hdrs are compilable.)  So we need to accommodate
changes to the C++ language.

7 years agoTime-HiRes: Remove impediment to compiling under C++11
Karl Williamson [Fri, 18 Nov 2016 20:20:50 +0000 (13:20 -0700)]
Time-HiRes: Remove impediment to compiling under C++11

C++11 changed from earlier versions to require space between the end of
a string literal and a macro, so that a feature can unambiguously be
added to the language.  Starting in g++ 6.2, the compiler emits a
deprecation warning when there isn't a space (presumably so that future
versions can support C++11).

Although not required by the C++11 change, this patch also makes sure
there is space after a macro call, before a string literal.  This makes
the macro stand out, and is easier to read.

This patch also changes any affected lines that exceed 79 columns, as
specified by perlhack.

Code and modules included with the Perl core need to be compilable using
C++.  This is so that perl can be embedded in C++ programs. (Actually,
only the hdr files need to be so compilable, but it would be hard to
test that just the hdrs are compilable.)  So we need to accommodate
changes to the C++ language.

7 years agoCwd: Remove impediment to compiling under C++11
Karl Williamson [Fri, 18 Nov 2016 20:05:27 +0000 (13:05 -0700)]
Cwd: Remove impediment to compiling under C++11

C++11 changed from earlier versions to require space between the end of
a string literal and a macro, so that a feature can unambiguously be
added to the language.  Starting in g++ 6.2, the compiler emits a
warning when there isn't a space (presumably so that future versions can
support C++11).  This commit fixes Cwd

This patch also updates the Changes file with information missing from
the previous change to the module.

Code and modules included with the Perl core need to be compilable using
C++.  This is so that perl can be embedded in C++ programs. (Actually,
only the hdr files need to be so compilable, but it would be hard to
test that just the hdrs are compilable.)  So we need to accommodate
changes to the C++ language.

7 years agoMerge branch 'perlre-tidy' into blead
Aaron Crane [Sat, 19 Nov 2016 13:28:02 +0000 (13:28 +0000)]
Merge branch 'perlre-tidy' into blead

This branch makes assorted cleanups to pod/perlre.pod. In particular, it no
longer claims that long-established, stable regex constructs like (?:pat)
might stop working in the future.

7 years agoperlre: don't impugn the stability of all (?…) constructs
Aaron Crane [Sat, 19 Nov 2016 13:15:18 +0000 (13:15 +0000)]
perlre: don't impugn the stability of all (?…) constructs

Previously, the documentation suggested that any or all of these constructs
might disappear or be significantly changed without notice:

    (?#comment)
    (?m)
    (?^m)
    (?:group)
    (?m-s:group)
    (?^m:group)
    (?|branch|reset)
    (?=pos lookahead)
    (?!neg lookahead)
    (?<=pos lookbehind)
    (?<!neg lookbehind)
    (?<named>capture)
    (?'named'capture)
    \k<named_backref>
    \k'named_backref'
    (?{ code })
    (??{ postponed regex })
    (?1)
    (?-2)
    (?+2)
    (?R)
    (?0)
    (?&named_subpattern)
    (?(condition)consequent|alternate), including (?(DEFINE)defs)
    (?>independent subpattern)
    (?[ [ext] + [char] - [cls] ])

Of those features, the last one (extended bracketed character classes) is
specifically experimental in our formal sense; but it's not realistic to
think that future versions of Perl might break any of the others — many of
which date back as far as 5.000. Furthermore, even if that were likely
enough to be worth pointing out, it would be better to do so on each of the
affected constructs, rather than with an easier-to-miss blanket notice at
the top of the section.

Therefore, this change removes the blanket notice, and adds a note of
experimental status to the mention of extended bracketed character classes,
linking to our policy definition of what that means.

7 years agoperlre: summarise full syntax for (?(cond)then|else) constructs
Aaron Crane [Sat, 19 Nov 2016 13:10:51 +0000 (13:10 +0000)]
perlre: summarise full syntax for (?(cond)then|else) constructs

In the conditional-execution constructs, the condition is always syntactically
surrounded by a single pair of parens. The various constructs therefore show
that pair of parens in all cases; this seems like a good thing. In addition,
the summary for these constructs as a group also shows the parens; this also
seems like a good thing. But it's not immediately obvious that the two sets
of parens are the same.

Rather than trying to clarify the situation using complicated prose, just
show an example of the full syntax for each conditional construct.

7 years agoperlre: minor wordsmithing, POD formatting tweaks, etc
Aaron Crane [Sat, 19 Nov 2016 13:07:07 +0000 (13:07 +0000)]
perlre: minor wordsmithing, POD formatting tweaks, etc

7 years agoperlre: regularise list items
Aaron Crane [Sat, 19 Nov 2016 13:01:50 +0000 (13:01 +0000)]
perlre: regularise list items

- Only one list item per construct (and change inbound links)

- Consistently list forms with C<< <name> >> before those with C<< 'name' >>

7 years agoDocument the package for $REGMARK and $REGERROR
Aaron Crane [Sat, 19 Nov 2016 12:54:42 +0000 (12:54 +0000)]
Document the package for $REGMARK and $REGERROR

7 years agoChange white space to avoid C++ deprecation warning
Karl Williamson [Thu, 17 Nov 2016 13:21:54 +0000 (06:21 -0700)]
Change white space to avoid C++ deprecation warning

C++11 requires space between the end of a string literal and a macro, so
that a feature can unambiguously be added to the language.  Starting in
g++ 6.2, the compiler emits a warning when there isn't a space
(presumably so that future versions can support C++11).  Unfortunately
there are many such instances in the perl core.  This commit fixes
those, including those in ext/, but individual commits will be used for
the other modules, those in dist/ and cpan/.

This commit also inserts space at the end of a macro before a string
literal, even though that is not deprecated, and removes useless ""
literals following a macro (instead of inserting a blank).  The result
is easier to read, making the macro stand out, and be clearer as to the
intention.

Code and modules included with the Perl core need to be compilable using
C++.  This is so that perl can be embedded in C++ programs. (Actually,
only the hdr files need to be so compilable, but it would be hard to
test that just the hdrs are compilable.)  So we need to accommodate
changes to the C++ language.

7 years agoUse test.pl functions in t/op/groups.t
Dagfinn Ilmari Mannsåker [Fri, 18 Nov 2016 14:13:22 +0000 (14:13 +0000)]
Use test.pl functions in t/op/groups.t

The test file was already loading test.pl, but not using any functions
other than skip_all(_if_miniperl).  This ports the rest of the test to
using note(), skip() and ok().

Diff is best read with -w and --color-words or --word-diff.

7 years agot/op/groups.t: Add missing "nok 1"
Dan Collins [Fri, 30 Sep 2016 14:35:18 +0000 (10:35 -0400)]
t/op/groups.t: Add missing "nok 1"

For: RT #116775

7 years agoRemove code commented out since July 1996.
James E Keenan [Thu, 17 Nov 2016 23:01:13 +0000 (18:01 -0500)]
Remove code commented out since July 1996.

7 years agoAPItest/t/utf8.t: Fix failing EBCDIC tests
Karl Williamson [Thu, 17 Nov 2016 03:18:59 +0000 (20:18 -0700)]
APItest/t/utf8.t: Fix failing EBCDIC tests

I keep not getting this completely correct, hence
1069c57cb1f4e6b94f8695843243749e9511303e
162256f303e3b2f3936976e692650c18c9cad0a6

But I'm hopeful this is the final answer.  We should be operating on I8
strings in this function, translating into I8 at the beginning and
translating  back to UTF-EBCDIC at the end (except UTF8SKIP has
purposely been built for speed to not use the transform, so it operates
on UTF-EBCDIC.

7 years agoAPItest/t/utf8.t: Fill in missing die() reason
Karl Williamson [Thu, 17 Nov 2016 03:17:48 +0000 (20:17 -0700)]
APItest/t/utf8.t: Fill in missing die() reason

I forgot to complete this before the initial commit, so that the reason
for dieing was empty.

7 years agoop/bop.t: Fix test failing on EBCDIC
Karl Williamson [Thu, 17 Nov 2016 03:15:54 +0000 (20:15 -0700)]
op/bop.t: Fix test failing on EBCDIC

This recently added test did not take into account character set
differences.

7 years agoRemove spurious executable bit from Porting/pod_lib.pl
Dagfinn Ilmari Mannsåker [Thu, 17 Nov 2016 09:21:07 +0000 (09:21 +0000)]
Remove spurious executable bit from Porting/pod_lib.pl

7 years agoAccount for possibility of DOS file endings.
James E Keenan [Mon, 14 Nov 2016 22:22:22 +0000 (17:22 -0500)]
Account for possibility of DOS file endings.

Although our source code (including this file) is supposed to have only Unix
line endings, cloning, etc., can result in particular users having DOS line
endings.  Let's allow '\r\n' to avoid spurious testing or installation
problems.

For: RT #130088, as recommended by Mark E Renzulli (UTRC).

7 years agoTest descriptions should be one line or ./TEST chokes on them
Matthew Horsfall [Wed, 16 Nov 2016 13:31:00 +0000 (08:31 -0500)]
Test descriptions should be one line or ./TEST chokes on them

7 years agooptimise $ref1 = $ref2 better
David Mitchell [Tue, 15 Nov 2016 08:27:48 +0000 (08:27 +0000)]
optimise $ref1 = $ref2 better

When assigning to a ref, the old referent is mortalised if its refcount
is 1, to avoid a premature free on things like $r = $$r or $r = $r->[0].

For the shortcut case where $ref1 and $ref2 are simple refs (no magic etc)
it's possible to do the assign then SvREFCNT_dec() the old value without
having to mortalise it. Which is faster.

Even when it doesn't have to be mortalised (RC > 1) this commit makes it
slightly faster as it no longer calls sv_unref_flags().

Conversely, this commit also makes the short-cut integer assign code path
infinitesimally slower.

7 years agoperf/benchmarks: tidy scalar assign benchmarks
David Mitchell [Tue, 15 Nov 2016 08:22:48 +0000 (08:22 +0000)]
perf/benchmarks: tidy scalar assign benchmarks

rename them from expr::assign::* to expr::sassign::* so as to more easily
distinguish them from expr::aassign::, and move them to the correct place
in the file

7 years agoReport indented here-doc line errors correctly
Matthew Horsfall [Tue, 15 Nov 2016 12:41:51 +0000 (07:41 -0500)]
Report indented here-doc line errors correctly

7 years agoCleanup PERL_VERSION checks in .c files
Nicolas R [Sun, 13 Nov 2016 09:16:23 +0000 (02:16 -0700)]
Cleanup PERL_VERSION checks in .c files

This commit is removing code not exercised by blead
or any later versions using PERL_VERSION.
This is a noop, mainly cleaning code.

7 years agoRevert "Do not try to fchown() to uid -1 and gid -1."
Tony Cook [Tue, 15 Nov 2016 03:42:52 +0000 (14:42 +1100)]
Revert "Do not try to fchown() to uid -1 and gid -1."

This reverts commit c4f643b9fca4c4487ef74e4e6cd5b61a26025698, which
fixed a failure introduced by commit
f95ba548a286b17c260cc168715a9d0d441b14a6 which was reverted in
dd1dbff095629118e73a48a2a6008f03418a07f6.

(uid_t)(-1) and (gid_t)(-1) are perfectly valid parameters to
chown()/fchown() back to POSIX.1-2001 at least.

7 years agoavoid a declaration conflict on El Capitan with recent XCode
Tony Cook [Mon, 14 Nov 2016 23:15:42 +0000 (10:15 +1100)]
avoid a declaration conflict on El Capitan with recent XCode

OS X El Capitan doesn't implement the clock_gettime() or clock_getrez()
APIs, but recent versions of XCode, which are released to El Capitan
do include updated headers that declare those functions.

This causes errors like:

HiRes.xs:810:12: error: static declaration of 'clock_gettime' follows non-static
      declaration
static int clock_gettime(clockid_t clock_id, struct timespec *ts) {
           ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include/time.h:177:5: note:
      previous declaration is here
int clock_gettime(clockid_t __clock_id, struct timespec *__tp);
    ^
HiRes.xs:844:12: error: static declaration of 'clock_getres' follows non-static
      declaration
static int clock_getres(clockid_t clock_id, struct timespec *ts) {
           ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include/time.h:174:5: note:
      previous declaration is here
int clock_getres(clockid_t __clock_id, struct timespec *__res);
    ^
2 errors generated.

To avoid that, define the emulation functions with our own name
and use a macro to map the standard names to our implemnentations.

7 years agoFinish removing POSIX deprecated fcns
Karl Williamson [Mon, 14 Nov 2016 21:52:45 +0000 (22:52 +0100)]
Finish removing POSIX deprecated fcns

Commit 47ed9d9e89922a8e165d6dfc5737772cc5ee7a45 removed various
deprecated functions, as scheduled in this release, but failed to
include everything that should have gotten removed.

Spotted by Abigail.

7 years agoFix error message for unclosed \N{ in regcomp
Dagfinn Ilmari Mannsåker [Mon, 14 Nov 2016 19:05:31 +0000 (20:05 +0100)]
Fix error message for unclosed \N{ in regcomp

An unclosed \N{ that made it through to the regex engine rather than
being handled by the lexer would erroneously trigger the error for
"\N{NAME} must be resolved by the lexer".

This separates the check for the missing trailing } and issues the
correct error message for this.

7 years agotoke.c: remove obsolete comment
Lukas Mai [Mon, 14 Nov 2016 14:23:17 +0000 (15:23 +0100)]
toke.c: remove obsolete comment

7 years agoop.h: add parens around macro expansion
Lukas Mai [Mon, 14 Nov 2016 14:21:55 +0000 (15:21 +0100)]
op.h: add parens around macro expansion

7 years agot/porting/regen.t: be even more helpful when tests fail
Aaron Crane [Mon, 14 Nov 2016 14:24:30 +0000 (15:24 +0100)]
t/porting/regen.t: be even more helpful when tests fail

My code here was wrong; it wasn't reporting anything useful when some
dependencies of special regen scripts changed.

7 years agoDocument that symbols should be removed from metaconfig.h
Dagfinn Ilmari Mannsåker [Mon, 14 Nov 2016 14:13:58 +0000 (15:13 +0100)]
Document that symbols should be removed from metaconfig.h

7 years agoRemove all symbols from metaconfig.h
Dagfinn Ilmari Mannsåker [Mon, 14 Nov 2016 14:08:03 +0000 (15:08 +0100)]
Remove all symbols from metaconfig.h

Except BOOTSTRAP_CHARSET, which was removed from Configure in commit
1d38f63fe5, they're all used in the code, so metaconfig pulls them in
anyway.

7 years agoSilence deprecation warnings in tests
Matthew Horsfall [Mon, 14 Nov 2016 13:52:36 +0000 (08:52 -0500)]
Silence deprecation warnings in tests

7 years agoFixup Unicode::UCD pod/version and regen dependent files
Matthew Horsfall [Mon, 14 Nov 2016 13:41:24 +0000 (08:41 -0500)]
Fixup Unicode::UCD pod/version and regen dependent files

7 years agoAdd perldelta for Indented Here-docs
Matthew Horsfall [Mon, 14 Nov 2016 13:03:33 +0000 (08:03 -0500)]
Add perldelta for Indented Here-docs

7 years agoDocument Indented Here-docs
Matthew Horsfall [Fri, 11 Nov 2016 11:35:32 +0000 (06:35 -0500)]
Document Indented Here-docs

7 years agoAdd indented here-docs.
Matthew Horsfall [Fri, 11 Nov 2016 09:58:18 +0000 (04:58 -0500)]
Add indented here-docs.

This adds a new modifier '~' to here-docs that tells the parser
that it should look for /^\s*$DELIM\n/ as the closing delimiter.

These syntaxes are all supported:

  <<~EOF;
  <<~\EOF;
  <<~'EOF';
  <<~"EOF";
  <<~`EOF`;
  <<~ 'EOF';
  <<~ "EOF";
  <<~ `EOF`;

The '~' modifier will strip, from each line in the here-doc, the
same whitespace that appears before the delimiter.

Newlines will be copied as is, and lines that don't include the
proper beginning whitespace will cause perl to croak.

Some examples:

  if (1) {
    print <<~EOF;
      Hello there
      EOF
  }

prints "Hello there\n";

The following:

  if (1) {
    print <<~EOF;
     Hello There
      EOF
  }

croaks with:

  Indentation on line 1 of here-doc doesn't match delimiter at - line 2.

7 years agoRemove "Warning: perl appears in your path"
David Mitchell [Mon, 14 Nov 2016 12:44:12 +0000 (12:44 +0000)]
Remove "Warning: perl appears in your path"

This install warning is more or less obsolete, since most platforms
already *will* have a /usr/bin/perl or similar provided by the OS.

We agreed to remove it in this thread:

    http://nntp.perl.org/group/perl.perl5.porters/240000

7 years ago/t/perf/benchmarks: move expr::index:: to func::
David Mitchell [Mon, 14 Nov 2016 10:49:25 +0000 (10:49 +0000)]
/t/perf/benchmarks: move expr::index:: to func::

'index' is a perl function, so it should really be in the 'func'
top-level namespace  of benchmarks

7 years agoAdditional warning of Name.pl going away
H.Merijn Brand [Mon, 14 Nov 2016 12:15:25 +0000 (13:15 +0100)]
Additional warning of Name.pl going away

7 years agoUnicode::UCD documentation for reading Name.pl as encouraged practice
H.Merijn Brand [Mon, 14 Nov 2016 11:37:18 +0000 (12:37 +0100)]
Unicode::UCD documentation for reading Name.pl as encouraged practice

7 years agoeliminate OPpRUNTIME private PMOP flag
David Mitchell [Mon, 14 Nov 2016 10:35:39 +0000 (10:35 +0000)]
eliminate OPpRUNTIME private PMOP flag

This flag was added in 5.004 and even then it didn't seem to be used for
anything. It gets set and unset in various places, but is never tested.
I'm not even sure what it was intended for.

7 years agoclarify what the SVf_AMAGIC means
David Mitchell [Mon, 14 Nov 2016 09:22:09 +0000 (09:22 +0000)]
clarify what the SVf_AMAGIC means

7 years agoImprove error for missing tie() pacakge/method
Dagfinn Ilmari Mannsåker [Sun, 13 Nov 2016 14:10:38 +0000 (15:10 +0100)]
Improve error for missing tie() pacakge/method

This brings the error messages in line with the ones used for normal
method calls, despite not using call_method().

7 years agomake the sysread()/syswrite/() etc :utf8 handle warnings default
Tony Cook [Mon, 14 Nov 2016 00:17:42 +0000 (11:17 +1100)]
make the sysread()/syswrite/() etc :utf8 handle warnings default

as they should be for deprecation warnings

7 years agoS_scan_subst() - remove extraneous code
David Mitchell [Sun, 13 Nov 2016 15:03:39 +0000 (15:03 +0000)]
S_scan_subst() - remove extraneous code

My recent commit 6432a58 left an extraneous extra line in that sub
that was added while working up the patch then was no longer needed,
and I forgot to remove it.

Spotted by Hugo - thanks!

7 years agoreduce cost of SvVALID()
David Mitchell [Sun, 13 Nov 2016 14:59:32 +0000 (14:59 +0000)]
reduce cost of SvVALID()

Now that SvVALID() no longer just checks an SV flag, but instead checks
for the existence of a certain type of magic, avoid using this more
expensive macro when its not really needed.

Also, and an extra flag test to SvVALID() to make it fail quicker.

7 years agoCertain variables are not longer allowed; document this.
Abigail [Sun, 13 Nov 2016 13:33:46 +0000 (14:33 +0100)]
Certain variables are not longer allowed; document this.

Use of single character variables, with the variable name a non
printable character in the range \x80-\xFF is no longer allowed.
This patch removes the documentation which says this feature is
deprecated, and now states it was allowed in the past.

7 years agoRemove obsolete comment
Dagfinn Ilmari Mannsåker [Sun, 13 Nov 2016 13:36:01 +0000 (14:36 +0100)]
Remove obsolete comment

- "Don't merge yet" - too late
- "as it's likely to get a len parameter" - added in 44130a26
- "and possibly even a U32 hash" - that'd be a new function

7 years agoDefined on aggregates is no longer allowed.
Abigail [Sun, 13 Nov 2016 13:08:38 +0000 (14:08 +0100)]
Defined on aggregates is no longer allowed.

Perlfunc was still reporting it as deprecated, and that it will
be deleted in the future.

7 years agoDeprecations are to be marked with a D.
Abigail [Sun, 13 Nov 2016 12:48:17 +0000 (13:48 +0100)]
Deprecations are to be marked with a D.

"%s() is deprecated on :utf8 handles" us a deprecation message, and
as such, such be marked "(D deprecated)" and not "(W deprecated)".

7 years agoeliminate SVpbm_VALID flag
David Mitchell [Sat, 12 Nov 2016 14:48:52 +0000 (14:48 +0000)]
eliminate SVpbm_VALID flag

This flag is set on an SV to indicate that it has PERL_MAGIC_bm
(fast Boyer-Moore) magic attached. Instead just directly check whether
it has such magic.

This frees up the 0x40000000 bit for anything except AVs and HVs

7 years agoeliminate SVpbm_TAIL/SvTAIL_on()/SvTAIL_off()
David Mitchell [Sat, 12 Nov 2016 13:19:58 +0000 (13:19 +0000)]
eliminate SVpbm_TAIL/SvTAIL_on()/SvTAIL_off()

(but keep SvTAIL())

This flag is only set on SVs that have Boyer-Moore magic attached.
Such SVs already re-purpose the unused IVX slot of that  SV to store
BmUSEFUL. This commit repurposes the unused NVX slot to store this
boolean value instead.

Now that flag bit (0x80000000) is only used with AVs, HVs, RVs and
scalar SVs with IOK.

7 years agoOnly test SvTAIL when SvVALID
David Mitchell [Sat, 12 Nov 2016 11:21:43 +0000 (11:21 +0000)]
Only test SvTAIL when SvVALID

Only use the SvTAIL() macro when we've already confirmed that
the SV is SvVALID() - this is in preparation for removing the
SVpbm_TAIL flag in the next commit

7 years agoS_setup_longest(): SvTAIL() used where always 0
David Mitchell [Sat, 12 Nov 2016 11:02:24 +0000 (11:02 +0000)]
S_setup_longest(): SvTAIL() used where always 0

SvTAIL() isn't set on an SV until fbm_compile() has been called,
so there's no point testing it before calling fbm_compile()

7 years agoEliminate SVrepl_EVAL and SvEVALED()
David Mitchell [Thu, 10 Nov 2016 21:38:30 +0000 (21:38 +0000)]
Eliminate SVrepl_EVAL and SvEVALED()

This flag is only used to indicate that the SV holding the text of the
replacement part of a s/// has seen at least one /e.

Instead, set the IVX field in the SV to a true value.
(We already set the NVX field on that SV to indicate a multi-src-line
substitution).

This is to reduce the number of odd special cases for the SVpbm_VALID flag.

7 years agoremove DOES's usage of SvSCREAM
David Mitchell [Thu, 10 Nov 2016 20:44:16 +0000 (20:44 +0000)]
remove DOES's usage of SvSCREAM

Currently the SvSCREAM flag is set on a temporary SV whose string value
is "isa", but where for the purposes of printing

    Can't call method "XXX"

its name is treated as "DOES" rather than "isa".

Instead, set the temp SV's PVX buffer to point to a special static
string (PL_isa_DOES) whose value is "isa", but the where the error
reporting code can compare the address with PL_isa_DOES and if so, print
"DOES" instead.

This is to reduce the number of odd special cases for the SvSCREAM flag.

7 years agoremove eval's usage of SvSCREAM
David Mitchell [Thu, 10 Nov 2016 14:44:10 +0000 (14:44 +0000)]
remove eval's usage of SvSCREAM

Currently the SvSCREAM flag is set on the sv pointed to by
cx->blk_eval.cur_text, to indicate that it is ref counted.

Instead, use a spare bit in the blk_u16 field of the eval context.
This is to reduce the number of odd special cases for the SvSCREAM flag.

7 years agoop_dump() - remove extra indentation from PMOP
David Mitchell [Sat, 12 Nov 2016 08:05:53 +0000 (08:05 +0000)]
op_dump() - remove extra indentation from PMOP

When dumping a PMOP, it displays the PMOP-specific fields with
an extra set of braces and level of indentation, e.g.

    {
        TYPE = match  ===> 1
        FLAGS = (VOID,SLABBED)
        PRIVATE = (RTIME)
        {
            PMf_PRE /abc/ (RUNTIME)
            PMFLAGS = (SCANFIRST,ALL)
        }
    }

This is visually confusing, because child ops are shown in the same way.
This commit removes the extra indentation:

    {
        TYPE = match  ===> 1
        FLAGS = (VOID,SLABBED)
        PRIVATE = (RTIME)
        PMf_PRE /abc/ (RUNTIME)
        PMFLAGS = (SCANFIRST,ALL)
    }

7 years agoperlguts: add pTHX_ to magic method examples
David Mitchell [Thu, 10 Nov 2016 13:58:36 +0000 (13:58 +0000)]
perlguts: add pTHX_ to magic method examples

These functions all take an interpreter arg these days.

7 years agodump.c: don't display an ARRAY's ARYLEN field
David Mitchell [Thu, 10 Nov 2016 13:52:23 +0000 (13:52 +0000)]
dump.c: don't display an ARRAY's ARYLEN field

Originally xav_arylen was an AV field and was displayed by sv_dump.
In 2005, this ield was removed, and replaced by PERL_MAGIC_arylen_p
magic when needed.

A side effect of this is that sv_dump on a magical AV adds
PERL_MAGIC_arylen_p magic to the av as a side-effect.
Which is undesirable.

This commit just omits displaying 'ARYLEN =' altogether. Any arylen magic
will already be displayed as part of dumping the AV, so it's redundant.

7 years agoTest2: __LINE__ and (caller)[2] may be different under Data::Dumper
Aaron Crane [Sat, 12 Nov 2016 15:06:51 +0000 (16:06 +0100)]
Test2: __LINE__ and (caller)[2] may be different under Data::Dumper

The __LINE__ token is compiled as an op_const pointing to an SvPV containing
the stringification of the line number. But (caller)[2] yields an SvIV that
directly represents the line number.

Data::Dumper now uses its XS implementation by default, even when its
Deparse option is enabled; previously, Deparse forced use of the pure-Perl
implementation.

The XS and pure-Perl implementations of Data::Dumper differ slightly: the
pure-Perl implementation always dumps defined non-reference scalars with
quotes, while the XS implementation uses a quote-less representation for
small integers. (The precise differences have changed over time, however.)

Test-Simple/t/Test2/modules/API/Context.t uses the minimal testing library
in Test-Simple/t/tools.pl to test itself, and t/tools.pl in turn implements
is_deeply() by doing the equivalent of is(Dumper($got), Dumper($expected)).
Finally, it does is_deeply() on structures containing a line number, but the
"got" structure contains the result of (caller)[2], while the "expected"
structure contains __LINE__. So now that the dumps of those structures are
different, the test fails.

Fix this by doing arithmetic on the __LINE__, thus forcing it to be an IV.

7 years agot/op/caller.t: add a TODO test for RT #129239
Lukas Mai [Fri, 21 Oct 2016 13:18:38 +0000 (15:18 +0200)]
t/op/caller.t: add a TODO test for RT #129239