David Mitchell [Thu, 4 Apr 2013 16:29:53 +0000 (17:29 +0100)]
Eliminate PL_reg_state.re_reparsing, part 1
PL_reg_state.re_reparsing is a hacky flag used to allow runtime
code blocks to be included in patterns. Basically, since code blocks
are now handled by the perl parser within literal patterns, runtime
patterns are handled by taking the (assembled at runtime) pattern,
and feeding it back through the parser via the equivalent of
eval q{qr'the_pattern'},
so that run-time (?{..})'s appear to be literal code blocks.
When this happens, the global flag PL_reg_state.re_reparsing is set,
which modifies lexing and parsing in minor ways (such as whether \\ is
stripped).
Now, I'm in the slow process of trying to eliminate global regex state
(i.e. gradually removing the fields of PL_reg_state), and also a change
which will be coming a few commits ahead requires the info which this flag
indicates to linger for longer (currently it is cleared immediately after
the call to scan_str().
For those two reasons, this commit adds a new mechanism to indicate this:
a new flag to eval_sv(), G_RE_REPARSING (which sets OPpEVAL_RE_REPARSING
in the entereval op), which sets the EVAL_RE_REPARSING bit in PL_in_eval.
Its still a yukky global flag hack, but its a *different* global flag hack
now.
For this commit, we add the new flag(s) but keep the old
PL_reg_state.re_reparsing flag and assert that the two mechanisms always
match. The next commit will remove re_reparsing.
David Mitchell [Thu, 28 Mar 2013 15:29:14 +0000 (15:29 +0000)]
re_op_compile(): reapply debugging statements
These were temporarily removed a few commits ago to make rebasing easier.
(And since the code's been simplified in the conflicting branch, not so
many debug statements had to be added back as were in the original).
David Mitchell [Thu, 28 Mar 2013 14:11:16 +0000 (14:11 +0000)]
Handle overloading properly in compile-time regex
[perl #116823]
In re_op_compile(), there were two different code paths for compile-time
patterns (/foo(?{1})bar/) and runtime (/$foo(?{1})bar/).
The code in question is where the various components of the pattern
are concatenated into a single string, for example, 'foo', '(?{1})' and
'bar' in the first pattern.
In the run-time branch, the code assumes that each component (e.g. the
value of $foo) can be absolutely anything, and full magic and overload
handling is applied as each component is retrieved and appended to the
pattern string.
The compile-time branch on the other hand, was a lot simpler because it
"knew" that each component is just a simple constant SV attached to an
OP_CONST op. This turned out to be an incorrect assumption, due to
overload::constant qr overloading; here, a simple constant part of a
compile-time pattern, such as 'foo', can be converted into whatever the
overload function returns; in particular, an object blessed into an
overloaded class. So the "simple" SVs that get attached to OP_CONST ops
can in fact be complex and need full magic, overloading etc applied to
them.
The quickest solution to this turned out to be, for the compile-time case,
extract out the SV from each OP_CONST and assemble them into a temporary
SV** array; then from then onwards, treat it the same as the run-time case
(which expects an array of SVs).
David Mitchell [Thu, 28 Mar 2013 13:08:42 +0000 (13:08 +0000)]
re-indent after last change
(only whitespace changes)
David Mitchell [Thu, 28 Mar 2013 12:07:18 +0000 (12:07 +0000)]
re_op_compile(): unify 1-op and N-op branches
When assembling a compile-time pattern from a list of OP_CONSTs (and
possibly embedded code-blocks), there were separate code paths for a
single arg (a lone OP_CONST) and a list of OP_CONST / DO's.
Unify the branches into single loop.
This will make a subsequent commit easier, where we will need to do more
processing of each "constant".
Re-indenting has been left to the commit that follows this.
David Mitchell [Mon, 25 Mar 2013 17:23:12 +0000 (17:23 +0000)]
re_op_compile(): simplify a code snippet
and eliminate one local var.
David Mitchell [Mon, 25 Mar 2013 17:19:23 +0000 (17:19 +0000)]
re-indent code after previous commit
(whitespace changes only)
David Mitchell [Mon, 25 Mar 2013 17:06:47 +0000 (17:06 +0000)]
regex and overload: unifiy 1 and N arg branches
When compiling a regex, something like /a$b/ that parses two two args,
was treated in a different code path than /$a/ say, which is only one arg.
In particular the 1-arg code path, where it handled "" overloading, didn't
check for a loop (where the ""-sub returns the overloaded object itself) -
the N-arg branch did handle that. By unififying the branches, we get that
fix for free, and ensure that any future fixes don't have to be applied to
two separate branches.
Re-indented has been left to the commit that follows this.
David Mitchell [Thu, 28 Mar 2013 15:08:27 +0000 (15:08 +0000)]
re_op_compile(): temp remove some debugging code
These four DEBUG_PARSE_r()'s were recently added to a block I code
which I have just been extensively reworking in a separate branch.
Temporarily remove these statements to allow my branch to be rebased;
I'll re-add them (or similar) afterwards.
Aaron Crane [Thu, 11 Apr 2013 15:28:39 +0000 (16:28 +0100)]
pod/perlsec.pod: fix typo and tweak wording
Craig A. Berry [Thu, 11 Apr 2013 03:25:35 +0000 (22:25 -0500)]
Fix post-install instructions in README.vms.
perl_setup.com gets installed, so we might as well run it from
where we have it rather than copying it somewhere.
And we really shouldn't be recommending putting things in sys$share,
even as a second choice.
James E Keenan [Wed, 10 Apr 2013 10:54:02 +0000 (11:54 +0100)]
Provide proper link to original Dylan paper.
Patch submitted by Dmitry Karasik++. For: RT #117519
Craig A. Berry [Sat, 6 Apr 2013 15:45:04 +0000 (10:45 -0500)]
Directory rename no longer needed on VMS.
As of 5.18.0, Perl on VMS can (at last) be built in and installed
from a directory having dots in the name, so it is no longer
necessary to rename the top-level source directory before building.
The pertinent instructions have been removed from README.vms, so
we also no longer need to update the version number that was
embedded in those instructions.
Craig A. Berry [Sat, 6 Apr 2013 03:14:16 +0000 (22:14 -0500)]
Assorted updates to README.vms
Karl Williamson [Fri, 5 Apr 2013 18:37:56 +0000 (12:37 -0600)]
perlop.pod: Fix typo that yields wrong info
Jan Dubois [Thu, 4 Apr 2013 21:12:04 +0000 (14:12 -0700)]
S_* functions should be STATIC
Karl Williamson [Fri, 29 Mar 2013 18:29:46 +0000 (12:29 -0600)]
handy.h: Remove docs for non-existent macro
In commit
3c3ecf18c35ad7832c6e454d304b30b2c0fef127, I mistakenly added
documentation for a non-existent macro. It turns out that only the
variants listed for that macro exist, and not the base macro. Since we
are in code freeze, the solution has to be not to change code by adding
the base macro, but to delete the documentation, or change it to refer
to just the existing versions. In order to not cause an entry that is
anomalous to the others, for this release, I'm just getting rid of the
documentation.
Yves Orton [Fri, 29 Mar 2013 11:27:46 +0000 (12:27 +0100)]
improve hash related documentation in perlfunc and perlsec to reflect new hash randomization logic
Yves Orton [Fri, 29 Mar 2013 11:03:08 +0000 (12:03 +0100)]
Fix perlfunc.pod to reflect changes to split " " logic
Andy Dougherty [Wed, 27 Mar 2013 19:54:05 +0000 (15:54 -0400)]
Remove the non-inline function S_croak_memory_wrap from inline.h.
This appears to resolve these three related tickets:
[perl #116989] S_croak_memory_wrap breaks gcc warning flags detection
[perl #117319] Can't include perl.h without linking to libperl
[perl #117331] Time::HiRes::clock_gettime not implemented on Linux (regression?)
This patch changes S_croak_memory_wrap from a static (but not inline)
function into an ordinary exported function Perl_croak_memory_wrap.
This has the advantage of allowing programs (particuarly probes, such
as in cflags.SH and Time::HiRes) to include perl.h without linking
against libperl. Since it is not a static function defined within each
compilation unit, the optimizer can no longer remove it when it's not
needed or inline it as needed. This likely negates some of the savings
that motivated the original commit
380f764c1ead36fe3602184804292711.
However, calling the simpler function Perl_croak_memory_wrap() still
does take less set-up than the previous version, so it may still be a
slight win. Specific cross-platform measurements are welcome.
Andy Dougherty [Thu, 28 Mar 2013 00:11:34 +0000 (20:11 -0400)]
makedef.pl shouldn't prepend Perl_ to symbols already starting with Perl_.
In the next patch, I have Perl_croak_memory_wrap defined in embed.fnc with
the 'nroX' flags, since this is a private function used by public macros.
I used the long form of the name Perl_croak_memory_wrap everywhere, and
used the 'o' flag so that embed.h wouldn't contain a useless #define
croak_memory_wrap Perl_croak_memory_wrap. Unfortunately, makedef.pl
(used by the Win32 build process) didn't know what to do with that entry
and created an entry Perl_Perl_croak_memory_wrap. Changing makedef.pl
to use the 'o' flag to decide whether to add the Perl_ prefix resulted
in over 50 other symbols changing in the output of makedef.pl. I don't
know if the changes are correct or if the 'o' flag is in error on those
entries in embed.fnc, but I don't have time to check them all out.
This patch just stops makedef.pl from adding a Perl_ prefix if there is
already one there.
Chris 'BinGOs' Williams [Wed, 27 Mar 2013 16:53:12 +0000 (16:53 +0000)]
Exporter on CPAN is 5.68 make blead reflect this
Yves Orton [Wed, 27 Mar 2013 12:20:08 +0000 (13:20 +0100)]
eliminate the only internal uses of HvFILL
The usages are as far as I know incorrect anyway. We resize
the hash bucket array based on the number of keys it holds,
not based on the number of buckets that are used, so this
usage was wrong anyway.
Another bug that this revealed is that the old code would allow
HvMAX(hv) to fall to 0, even though every other part of the
core expects it to have a minimum of 7 (meaning 8 buckets).
As part of this we change the hard coded 7 to a defined constant
PERL_HASH_DEFAULT_HvMAX.
After this patch there remains one use of HvFILL in core, that used
for scalar(%hash) which I plan to remove in a later patch.
Yves Orton [Wed, 27 Mar 2013 10:17:25 +0000 (11:17 +0100)]
prevent SEGV from buffer read overrun, and refactor away duplicated code
The split patch introduced a buffer read overrun error in sv_dump() when
stringifying empty strings. This bug was always existant but was probably
never triggered because we almost always have at least one extflags set,
so it never got an empty buffer to show. Not so with the new compflags. :-(
Yves Orton [Mon, 25 Mar 2013 22:15:00 +0000 (23:15 +0100)]
fix comment, reindent and add parenthesis for clarity
I had to stare at this expression and make sure there wasn't
anything tricky for too long, so I added parens, and reindented
it.
Yves Orton [Mon, 25 Mar 2013 22:23:40 +0000 (23:23 +0100)]
rework split() special case interaction with regex engine
This patch resolves several issues at once. The parts are
sufficiently interconnected that it is hard to break it down
into smaller commits. The tickets open for these issues are:
RT #94490 - split and constant folding
RT #116086 - split "\x20" doesn't work as documented
It additionally corrects some issues with cached regexes that
were exposed by the split changes (and applied to them).
It effectively reverts
5255171e6cd0accee6f76ea2980e32b3b5b8e171
and
cccd1425414e6518c1fc8b7bcaccfb119320c513.
Prior to this patch the special RXf_SKIPWHITE behavior of
split(" ", $thing)
was only available if Perl could resolve the first argument to
split at compile time, meaning under various arcane situations.
This manifested as oddities like
my $delim = $cond ? " " : qr/\s+/;
split $delim, $string;
and
split $cond ? " ", qr/\s+/, $string
not behaving the same as:
($cond ? split(" ", $string) : split(/\s+/, $string))
which isn't very convenient.
This patch changes this by adding a new flag to the op_pmflags,
PMf_SPLIT which enables pp_regcomp() to know whether it was called
as part of split, which allows the RXf_SPLIT to be passed into run
time regex compilation. We also preserve the original flags so
pattern caching works properly, by adding a new property to the
regexp structure, "compflags", and related macros for accessing it.
We preserve the original flags passed into the compilation process,
so we can compare when we are trying to decide if we need to
recompile.
Note that this essentially the opposite fix from the one applied
originally to fix #94490 in
5255171e6cd0accee6f76ea2980e32b3b5b8e171.
The reverted patch was meant to make:
split( 0 || " ", $thing ) #1
consistent with
my $x=0; split( $x || " ", $thing ) #2
and not with
split( " ", $thing ) #3
This was reverted because it broke C<split("\x{20}", $thing)>, and
because one might argue that is not that #1 does the wrong thing,
but rather that the behavior of #2 that is wrong. In other words
we might expect that all three should behave the same as #3, and
that instead of "fixing" the behavior of #1 to be like #2, we should
really fix the behavior of #2 to behave like #3. (Which is what we did.)
Also, it doesn't make sense to move the special case detection logic
further from the regex engine. We really want the regex engine to decide
this stuff itself, otherwise split " ", ... wouldn't work properly with
an alternate engine. (Imagine we add a special regexp meta pattern that behaves
the same as " " does in a split /.../. For instance we might make
split /(*SPLITWHITE)/ trigger the same behavior as split " ".
The other major change as result of this patch is it effectively
reverts commit
cccd1425414e6518c1fc8b7bcaccfb119320c513, which
was intended to get rid of RXf_SPLIT and RXf_SKIPWHITE, which
and free up bits in the regex flags structure.
But we dont want to get rid of these vars, and it turns out that
RXf_SEEN_LOOKBEHIND is used only in the same situation as the new
RXf_MODIFIES_VARS. So I have renamed RXf_SEEN_LOOKBEHIND to
RXf_NO_INPLACE_SUBST, and then instead of using two vars we use
only the one. Which in turn allows RXf_SPLIT and RXf_SKIPWHITE to
have their bits back.
Yves Orton [Mon, 25 Mar 2013 22:06:22 +0000 (23:06 +0100)]
simplify regcomp.c by using vars to avoid repeated macros
Use two temporary variables to simplify the logic, and maybe
speed up a nanosecond or two.
Also chainsaw some long dead logic. (I #ifdef'ed it out years ago)
Yves Orton [Mon, 25 Mar 2013 19:08:56 +0000 (20:08 +0100)]
Improve how regcomp.pl handles multibits
In preparation for future changes.
Brian Fraser [Mon, 25 Mar 2013 04:46:43 +0000 (01:46 -0300)]
Silence "smartmatch is experimental" warnings in autodie
Brian Fraser [Tue, 26 Mar 2013 00:17:51 +0000 (21:17 -0300)]
perldelta for the new warnings
Brian Fraser [Mon, 25 Mar 2013 04:22:35 +0000 (01:22 -0300)]
Make smartmatch, given & when experimental
Brian Fraser [Mon, 25 Mar 2013 05:10:08 +0000 (02:10 -0300)]
t/porting/dual-life.t: Drop dependency on smartmatch
Brian Fraser [Sat, 23 Mar 2013 20:45:10 +0000 (17:45 -0300)]
t/re/regexp_unicode_prop.t: Drop dependency on given/when
Brian Fraser [Sat, 23 Mar 2013 20:42:34 +0000 (17:42 -0300)]
Porting/core-cpan-diff: Drop dependency on smartmatch
Brian Fraser [Sat, 23 Mar 2013 20:42:00 +0000 (17:42 -0300)]
Porting/checkpodencoding.pl: Drop dependency on smartmatch
Brian Fraser [Sat, 23 Mar 2013 20:40:54 +0000 (17:40 -0300)]
File::Glob: Drop dependency on given/when
Karl Williamson [Tue, 26 Mar 2013 19:30:02 +0000 (13:30 -0600)]
perlapi: Document some macros
Nicholas Clark [Mon, 25 Mar 2013 12:06:09 +0000 (13:06 +0100)]
xs_init() must pass a static char* when creating &DynaLoader::boot_DynaLoader.
newXS() assumes that the passed pointer to the filename is in static storage,
or otherwise will outlive the PVCV that it is about to create, and hence that
it's safe to copy the pointer, not the value, to CvFILE. Hence xs_init()
must not use an auto array to "store" the filename, as that will be on the
stack, and becomes invalid as soon as xs_init() returns. The analogous bug
fix was made in universal.c by commit
157e3fc8c802010d in Feb 2006.
Spotted by compiling for ithreads with gcc 4.8.0's ASAN and running
dist/B-Deparse/t/deparse.t
Nicholas Clark [Mon, 25 Mar 2013 10:56:40 +0000 (11:56 +0100)]
In In S_scan_heredoc(), avoid memNE() reading beyond the end of s.
If the heredoc terminator we are searching for is longer than the bytes
remaining in s, then the memNE() would read beyond initialised memory.
Hence change the loop bounds to avoid this case, and change the failure case
below to reflect the revised end-of-loop condition.
It doesn't matter that the loop no longer increments shared->herelines,
because the failure case calls S_missingterm(), which croaks.
Nicholas Clark [Mon, 25 Mar 2013 09:53:33 +0000 (10:53 +0100)]
In S_scan_heredoc(), the explicit test for '\n' duplicates the strNE().
PL_tokenbuf always starts with '\n', so a separate test of *s against '\n'
is duplicate work. Hence remove it, to make the code simpler and clearer.
Nicholas Clark [Mon, 25 Mar 2013 09:20:05 +0000 (10:20 +0100)]
PerlIO_find_layer should not be using memEQ() off the end of the layer name.
PerlIO_find_layer was using memEQ() to compare the name of the desired layer
with each layer in the array of known layers. However, it was always using
the length of the desired layer for the comparison, whatever the length of
the name it was comparing it with, resulting in out-of-bounds reads.
Craig A. Berry [Mon, 25 Mar 2013 01:49:38 +0000 (20:49 -0500)]
Copyright update for vms/vms.c.
Happy 20th Anniversary, Charles.
Craig A. Berry [Mon, 25 Mar 2013 01:39:38 +0000 (20:39 -0500)]
Make vms.c's Perl_flex_fstat preserve errno on success.
The CRTL's fstat() sets errno to EVMSERR and vaxc$errno to RMS$_IOP
when called on a proccess-permanent file (i.e., stdin, stdout, or
stderr). That error generally means a rewind operation on a file
that cannot be rewound. It's odd that fstat is doing such a thing,
but we can at least protect ourselves from the effects of it by
saving errno and restoring it on a successful call.
This cures a couple of test failures and TODOs in t/io/errno.t.
Craig A. Berry [Mon, 25 Mar 2013 01:31:59 +0000 (20:31 -0500)]
Revert "Restore errno after VMS hack in S_sv_gets_read_record."
This reverts commit
d46f021e36854e800770363f716e7b4a846102ef.
This can be done more universally (and from the point of view of
sv.c, less obtrusively) in Perl_flex_fstat in vms/vms.c.
Yves Orton [Sun, 24 Mar 2013 10:48:12 +0000 (11:48 +0100)]
improve how Devel::Peek::Dump handles iterator information
* If the hash is not OOK omit any iterator status information
instead of showing -1/NULL
* If the hash is OOK then add the RAND value from the iterator
and if the LASTRAND is not the same show it too
* Tweak tests to test the above.
Yves Orton [Sun, 24 Mar 2013 10:47:22 +0000 (11:47 +0100)]
Add a commented out warning and a way for diag.t to ignore it
Yves Orton [Sun, 24 Mar 2013 10:46:22 +0000 (11:46 +0100)]
improve iterator randomization
Max Maischein [Sun, 24 Mar 2013 10:35:43 +0000 (11:35 +0100)]
Add epigraph for 5.17.10
David Mitchell [Sat, 23 Mar 2013 23:08:59 +0000 (23:08 +0000)]
fix Peek.t to work with NEW COW
David Mitchell [Sat, 23 Mar 2013 23:05:18 +0000 (23:05 +0000)]
Revert "fix Peek.t to work with NEW COW"
This reverts commit
2b656fcc48f28912136698c28b3bd916c42d74f8.
I accidentally included the changes I was reviewing from a patch of
Reini's
David Mitchell [Sat, 23 Mar 2013 21:29:26 +0000 (21:29 +0000)]
regcomp.c: silence compiler warning
add a cast before doing a printf "%x" on a pointer
David Mitchell [Sat, 23 Mar 2013 21:17:01 +0000 (21:17 +0000)]
add descriptions to require.t test output
This is particularly important as in several places, the ok or not ok
message is generated in different ways depending on whether a require
successfully executed and printed "ok" for example.
David Mitchell [Sat, 23 Mar 2013 20:32:00 +0000 (20:32 +0000)]
fix Peek.t to work with NEW COW
Ricardo Signes [Sat, 23 Mar 2013 20:34:03 +0000 (16:34 -0400)]
fix a missed s/deprecated/experimental/ for my $_
Craig A. Berry [Sat, 23 Mar 2013 01:39:37 +0000 (20:39 -0500)]
Restore errno after VMS hack in S_sv_gets_read_record.
In
596a6cbd6bcaa8e6a4 I added a somewhat desperate hack to detect
if a file is record-oriented so that we preserve record semantics
when PL_rs has beeen set. I did it by calling fstat(), which is
already a pretty icky thing to be doing on every record read, but
it turns out things are even worse becaseu fstat() sets errno in
some conditions where it's successful, specifically when the file
is a Process-Permanent File (PPF), i.e., standard input or output.
So save errno before the fstat and restore it before doing the
read so if the read fails we get a proper errno. This gets
t/io/errno.t passing.
Side note: instead of fstat() here, we probably need to store a
pointer to the FAB (File Access Block) in the PerlIO struct so all
the metadata about the file is always accessible. This would
require setting up completion routines in PerlIOUnix_open and
PerlIOStdio_open.
Chris 'BinGOs' Williams [Fri, 22 Mar 2013 13:01:16 +0000 (13:01 +0000)]
constant is 1.27 on CPAN
Chris 'BinGOs' Williams [Fri, 22 Mar 2013 13:00:07 +0000 (13:00 +0000)]
Module-CoreList is 2.85 on CPAN
Max Maischein [Fri, 22 Mar 2013 09:42:10 +0000 (10:42 +0100)]
Bump version to5.17.11
Max Maischein [Fri, 22 Mar 2013 08:18:58 +0000 (09:18 +0100)]
New perldelta
Max Maischein [Fri, 22 Mar 2013 07:53:18 +0000 (08:53 +0100)]
Merge branch 'release-5.17.10' into blead
Max Maischein [Thu, 21 Mar 2013 21:06:38 +0000 (22:06 +0100)]
Remove empty POD sections, fix link in pod
Max Maischein [Thu, 21 Mar 2013 20:36:21 +0000 (21:36 +0100)]
add new release to perlhist
Max Maischein [Thu, 21 Mar 2013 20:29:32 +0000 (21:29 +0100)]
Update corelist for 5.17.10
Max Maischein [Thu, 21 Mar 2013 20:29:20 +0000 (21:29 +0100)]
Update perldelta for 5.17.10
Max Maischein [Thu, 21 Mar 2013 20:20:52 +0000 (21:20 +0100)]
Bump version number in INSTALL
Max Maischein [Thu, 21 Mar 2013 19:51:11 +0000 (20:51 +0100)]
Update Net::Ping from 2.40 to 2.41
This is necessary to make tests pass on Windows (XP and onward).
Patrik Hägglund [Sat, 2 Feb 2013 19:21:05 +0000 (20:21 +0100)]
PATCH [perl #106212] Add PL_perlio_mutex to atfork_lock/unlock
Using threads + fork() on Linux, and IO operations in the threads, the
PL_perlio_mutex may be left in a locked state at the call of fork(),
potentially leading to deadlock in the child process at subsequent IO
operations. (Threads are pre-empted and not continued in the child
process after the fork.)
Therefore, ensure that the PL_perlio_mutex is unlocked in the child
process, right after fork(), by using atfork_lock/unlock.
(The RT text gives ways to reproduce the problem, but are not easily
added to Perl's test suite)
Karl Williamson [Thu, 21 Mar 2013 18:02:38 +0000 (12:02 -0600)]
Add Patrik Hägglund to AUTHORS
Nicholas Clark [Thu, 21 Mar 2013 08:24:08 +0000 (09:24 +0100)]
Merge in the changes that deprecate the use of @*, &*, ** and %*.
Use of $* already generated a deprecation warning.
This resolves RT #116943.
Nicholas Clark [Wed, 20 Mar 2013 15:47:16 +0000 (16:47 +0100)]
Add a deprecation warning for all uses of @*, %*, &* and **.
All compile-time uses of the ** typeglob now warn.
Nicholas Clark [Wed, 20 Mar 2013 08:23:49 +0000 (09:23 +0100)]
Change the warning for $* to add ", and will become a syntax error".
The intent is that $*, @*, %*, &* and ** stop being parsed as punctuation
variables, freeing up the syntax for other use (possibly "splats").
Nicholas Clark [Wed, 20 Mar 2013 11:00:11 +0000 (12:00 +0100)]
Generate the deprecation warnings for all uses $* or $#.
Previously it would fail to be generated if another variable using the same
typeglob was seen first (e.g. @* before $*), and would not be generated for
the second and subsequent uses.
It's hard to fix the failure to generate warnings at all without also
generating them every time, and warning every time is consistent with the
warnings that $[ used to generate.
Nicholas Clark [Wed, 20 Mar 2013 10:40:42 +0000 (11:40 +0100)]
Additional tests for the deprecation warnings when using $* or $#.
Nicholas Clark [Wed, 20 Mar 2013 13:26:56 +0000 (14:26 +0100)]
Change tie_fetch_count.t to use *] instead of **.
The test is not sensitive to which typeglob is used.
Nicholas Clark [Wed, 20 Mar 2013 12:54:22 +0000 (13:54 +0100)]
Change B::Deparse's test to test interpolation of @] instead of @*.
The test wasn't specifically relying on @*, so any unused punctuation
variable is equally good. $] isn't going away any time soon, hence @] is
unlikely to change.
David Golden [Wed, 20 Mar 2013 21:14:21 +0000 (17:14 -0400)]
update Perl::OSType from 1.002 to 1.003
Nicholas Clark [Tue, 19 Mar 2013 19:18:30 +0000 (20:18 +0100)]
Re-order intrpvar.h to minimise holes in the interpreter struct.
Commit
19bc2726ec6be805 created 32 bytes of holes (on LP64 systems).
Brad Gilbert [Mon, 4 Mar 2013 18:36:56 +0000 (12:36 -0600)]
Make utf8 downgrading in constant.pm, version dependent
The reason for this change is that the test
that determines when to do this caused the
utf8 module to always be loaded.
Aaron Trevena [Wed, 20 Mar 2013 15:00:08 +0000 (09:00 -0600)]
I18N-Langinfo/Langinfo.pm: Pod nit
Karl Williamson [Wed, 20 Mar 2013 15:03:57 +0000 (09:03 -0600)]
Add Aaron Trevena to AUTHORS
Paul Green [Tue, 19 Mar 2013 03:43:25 +0000 (23:43 -0400)]
Ensure only DOSish builds force O_BINARY=1 in the open path
Paul Green [Sun, 17 Mar 2013 17:48:00 +0000 (13:48 -0400)]
Update copyright statement for the Stratus VOS port
Paul Green [Sun, 17 Mar 2013 17:47:10 +0000 (13:47 -0400)]
Update pod/perlpord.pod to reflect recent VOS port changes
Paul Green [Sun, 17 Mar 2013 17:46:18 +0000 (13:46 -0400)]
Update README.vos to reflect recent changes
Paul Green [Sun, 17 Mar 2013 15:41:51 +0000 (11:41 -0400)]
Update VOS hints file to use dynamic linking and 64-bit stream files
Paul Green [Sun, 17 Mar 2013 15:39:17 +0000 (11:39 -0400)]
Assume that the host and target have the same executable suffix
Paul Green [Sun, 17 Mar 2013 15:35:47 +0000 (11:35 -0400)]
Remove VOS floating-point workaround; VOS bug long since fixed
Shirakata Kentaro [Tue, 19 Mar 2013 20:23:12 +0000 (14:23 -0600)]
PATCH: [perl #117181] pod: nitpick
Karl Williamson [Tue, 19 Mar 2013 19:05:44 +0000 (13:05 -0600)]
pod/perlfunc: Tweak new kill() wording
I forgot to mention in an earlier commit message that the impetus and
some of the text for the original change in commit
1ac81c06ff5e50e413e5fe9197f48f1c986af8be came from Felipe Gasper.
I'm sorry.
Nicholas Clark [Tue, 19 Mar 2013 10:53:38 +0000 (11:53 +0100)]
Merge in the changes that remove setjmp() from regcomp.c
The code now uses regular returns instead of setjmp() and longjmp() for
signalling the need for pattern compilation to restart. By avoiding this,
and the corresponding need to mark many variables as volatile, we make
the code less fragile, and Address Sanitizer is now happy.
Nicholas Clark [Mon, 4 Feb 2013 16:54:33 +0000 (17:54 +0100)]
Document the uses of NULL returns in the regex parsing code.
Nicholas Clark [Mon, 21 Jan 2013 19:58:49 +0000 (20:58 +0100)]
Revert "PATCH: regex longjmp flaws"
This reverts commit
595598ee1f247e72e06e4cfbe0f98406015df5cc.
The netbsd - 5.0.2 compiler pointed out that the recent changes to add
longjmps to speed up some regex compilations can result in clobbering a
few values. These depend on the compiled code, and so didn't show up in
other compiler's warnings. This patch reinitializes them after a
longjmp.
[With a lot of hand editing in regcomp.c, to propagate the changes through
subsequent commits.]
Nicholas Clark [Mon, 21 Jan 2013 19:32:01 +0000 (20:32 +0100)]
In Perl_re_op_compile(), tidy up after removing setjmp().
Remove volatile qualifiers. Remove the variable jump_ret. Move the
initialisation of restudied back to the declaration. This reverts several of
the changes made by commits
5d51ce98fae3de07 and
bbd61b5ffb7621c2.
However, I can't see a cleaner way to avoid code duplication when restarting
the parse than to approach I've taken here - the label redo_first_pass is
now inside an if (0) block, which is clear but ugly.
Nicholas Clark [Mon, 21 Jan 2013 16:15:30 +0000 (17:15 +0100)]
Replace the longjmp()s in Perl_re_op_compile() with goto.
The regex parse needs to be restarted if it turns out that it should be done
as UTF-8, not bytes. Using setjmp()/longjmp() complicates compilation
considerably, causing warnings about missing use of volatile, and hitting
code generation errors from clang's ASAN. Using goto is much clearer.
Nicholas Clark [Sat, 19 Jan 2013 10:06:10 +0000 (11:06 +0100)]
Move the longjmp() that implements REQUIRE_UTF8 up to Perl_re_op_compile().
With longjmp() and setjmp() now in the same function (and all tests passing),
it becomes easy to replace the pair with a goto. Still evil, but "the lesser
of two evils".
Nicholas Clark [Fri, 18 Jan 2013 16:21:03 +0000 (17:21 +0100)]
Add a flag RESTART_UTF8 to the reg*() routines in regcomp.c
Add a flag RESTART_UTF8 along with infrastructure to the reg*() routines to
permit the parse to be restarted without using longjmp(). However, it's not
used yet.
Nicholas Clark [Fri, 18 Jan 2013 10:32:44 +0000 (11:32 +0100)]
In S_regclass(), create listsv as a mortal, claiming a reference if needed.
The SV listsv is sometimes stored in an array generated near the end of
S_regclass(). In other cases it is not used, and it needs to be freed if
any of the warnings that S_regclass() can trigger turn out to be fatal.
The simplest solution to this problem is to declare it from the start as a
mortal, and claim a (new) reference to it if it is *not* to be freed. This
permits the removal of all other code related to ensuring that it is freed
at the right time, but not freed prematurely if a call to a warning returns.
Nicholas Clark [Thu, 17 Jan 2013 10:47:13 +0000 (11:47 +0100)]
Document when and why S_reg{,branch,piece,atom,class}() return NULL.
As documented in pod/perlreguts.pod, the call graph for regex parsing
involves several levels of functions in regcomp.c, sometimes recursing more
than once.
The top level compiling function, S_reg(), calls S_regbranch() to parse each
single branch of an alternation. In turn, that calls S_regpiece() to parse
a simple pattern followed by quantifier, which calls S_regatom() to parse
that simple pattern. S_regatom() can call S_regclass() to handle classes,
but can also recurse into S_reg() to handle subpatterns and some other
constructions. Some other routines call call S_reg(), sometimes using an
alternative pattern that they generate dynamically to represent their input.
These routines all return a pointer to a regnode structure, and take a
pointer to an integer that holds flags, which is also used to return
information.
Historically, it has not been clear when and why they return NULL, and
whether the return value can be ignored. In particular, "Jumbo regexp patch"
(commit
c277df42229d99fe, from Nov 1997), added code with two calls from
S_reg() to S_regbranch(), one of which checks the return value and generates
a LONGJMP node if it returns NULL, the other of which is called in void
context, and so both ignores any return value, or the possibility that it is
NULL.
After some analysis I have untangled the possible return values from these
5 functions (and related functions which call S_reg()).
Starting from the top:
S_reg() will return NULL and set the flags to TRYAGAIN at the end of pragma-
like constructions that it handles. Otherwise, historically it would return
NULL if S_regbranch() returned NULL. In turn, S_regbranch() would return
NULL if S_regpiece() returned NULL without setting TRYAGAIN. If S_regpiece()
returns TRYAGAIN, S_regbranch() loops, and ultimately will not return NULL.
S_regpiece() returns NULL with TRYAGAIN if S_regatom() returns NULL with
TRYAGAIN, but (historically) if S_regatom() returns NULL without setting
the flags to TRYAGAIN, S_regpiece() would to. Where S_regatom() calls
S_reg() it has similar behaviour when passing back return values, although
often it is able to loop instead on getting a TRYAGAIN.
Which gets us back to S_reg(), which can only *generate* NULL in conjunction
with TRYAGAIN. NULL without TRYAGAIN could only be returned if a routine it
called generated it. All other functions that these call that return regnode
structures cannot return NULL. Hence
1) in the loop of functions called, there is no source for a return value of
NULL without the TRYAGAIN flag being set
2) a return value of NULL with TRYAGAIN set from an inner function does not
propagate out past S_regbranch()
Hence the only return values that most functions can generate are non-NULL,
or NULL with TRYAGAIN set, and as S_regbranch() catches these, it cannot
return NULL. The longest sequence of functions that can return NULL (with
TRYAGAIN set) is S_reg() -> S_regatom() -> S_regpiece() -> S_regbranch().
Rapidly returning right round the loop back to S_reg() is not possible.
Hence code added by commit
c277df42229d99fe to handle a NULL return from
S_regbranch(), along with some other code is dead.
I have replaced all unreachable code with FAIL()s that panic.
Nicholas Clark [Fri, 18 Jan 2013 15:30:39 +0000 (16:30 +0100)]
Return orig_emit from S_regclass() when ret_invlist is true.
The return value isn't used (yet). Previously the code was returning END,
which is a macro for the regnode number for "End of program" which happens to
be 0. It happens that 0 is valid C for a NULL pointer, but using it in this
way makes the intent unclear. Not only is orig_emit a valid type, it's
semantically the correct thing to return, as it's most recently added node.
Nicholas Clark [Wed, 16 Jan 2013 20:58:02 +0000 (21:58 +0100)]
Test that UTF-8 in the look-ahead of (?(?=...)...) restarts the sizing parse.
S_reg() recurses to itself to parse various constructions used as the
conditionals in conditional matching. Look-aheads and look-behinds can turn
out to need to be sized as UTF-8, which can cause the inner S_reg() to use
the macro REQUIRE_UTF8 is used to restart the parse. Test that this is
handled correctly.