This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Tony Cook [Mon, 25 Jul 2022 04:53:39 +0000 (14:53 +1000)]
make store_hook() handle regular expression objects
Previously this would complain it didn't know the object type
when preparing to call STORABLE_freeze.
Tony Cook [Tue, 19 Jul 2022 05:58:35 +0000 (15:58 +1000)]
improve error reporting by store_hook() on an unknown type
This produced an opaque message when it was asked to freeze an
object of an unsupported type. Changes:
- replace the opaque internal object type number with the typical perl name of the
type ("GLOB" instead of "8")
- include the class of the object being frozen to identify which class needs work
- include name of the function we're trying to call to do the freeze,
if possible
Yves Orton [Mon, 24 Oct 2022 07:45:55 +0000 (09:45 +0200)]
allow porting/corelist.t to be run from root
James E Keenan [Mon, 4 Jul 2022 21:02:01 +0000 (21:02 +0000)]
Test case where different functions are declared
In the first sample .xs file supplied for this branch, a function named
'dbh' was declared twice, once inside an 'ifdef', once outside. This
led me to think that that dual use of the string 'dbh' was the problem
EUPXS was stumbling upon.
However, that appears to be incorrect. If we supply a second sample .xs
file in which we use two different function names, we still get the
undesired warning.
James E Keenan [Mon, 4 Jul 2022 15:12:17 +0000 (15:12 +0000)]
Add TODO-ed test for duplicate warning
E. Choroba [Mon, 4 Jul 2022 14:14:19 +0000 (14:14 +0000)]
Add test file contributed in GH 19661
Karl Williamson [Wed, 2 Nov 2022 19:39:55 +0000 (13:39 -0600)]
buildtoc: Add error check
If something goes wrong, this wouldn't have known it
Elvin Aslanov [Fri, 2 Sep 2022 15:09:18 +0000 (19:09 +0400)]
Update Data::Dumper synopsis
Add `my` to synopsis.
Committer: Data-Dumper: Update $VERSION in POD. The release date no
longer appears in the POD, so let's remove the comment admonishing us to
update it.
For: https://github.com/Perl/perl5/pull/20224
Yves Orton [Mon, 12 Sep 2022 09:30:15 +0000 (11:30 +0200)]
regen/regcomp.pl - add more detail on what the script does and list its inputs properly
Previously we were only showing one of the inputs that generates
regnodes.h, now we show all of them. Also add some paragraphs explaining
a bit more detail what the files contain and how we process.
Committer: Small grammatical correction, per
https://github.com/Perl/perl5/pull/20288#discussion_r968344745
Branislav Zahradník [Fri, 4 Nov 2022 18:39:08 +0000 (19:39 +0100)]
Generate opcode.h, opnames.h
Branislav Zahradník [Mon, 17 Oct 2022 05:43:07 +0000 (07:43 +0200)]
Refactor opcode.pl - with c99 array init index comments are not necessary
Branislav Zahradník [Sun, 16 Oct 2022 17:59:38 +0000 (19:59 +0200)]
Refactor opcode.pl - use c99 array initialization (using op enum)
Branislav Zahradník [Sun, 16 Oct 2022 16:46:11 +0000 (18:46 +0200)]
Refactor opcode.pl - use INIT() macro instead of #ifdef/#endif
Branislav Zahradník [Sun, 16 Oct 2022 17:48:56 +0000 (19:48 +0200)]
Refactor opcode.pl - let INIT() macro to accept expressions with comma(s)
Branislav Zahradník [Sun, 16 Oct 2022 15:00:51 +0000 (17:00 +0200)]
Refactor opcode.pl - B/Op_private.pm - move generator code to function
Branislav Zahradník [Sun, 16 Oct 2022 14:11:29 +0000 (16:11 +0200)]
Refactor opcode.pl - pp_proto.h - move generator code to function
Branislav Zahradník [Sun, 16 Oct 2022 10:51:48 +0000 (12:51 +0200)]
Refactor opcode.pl - opnames.h - unglobalize output handle
Branislav Zahradník [Sun, 16 Oct 2022 10:47:24 +0000 (12:47 +0200)]
Refactor opcode.pl - opnames.h - move epilogue into function
Branislav Zahradník [Sun, 16 Oct 2022 10:02:29 +0000 (12:02 +0200)]
Refactor opcode.pl - opnames.h - move opcode predicates into function
Branislav Zahradník [Sun, 16 Oct 2022 09:49:57 +0000 (11:49 +0200)]
Refactor opcode.pl - opnames.h - move enum generator into function
Branislav Zahradník [Sun, 16 Oct 2022 09:18:04 +0000 (11:18 +0200)]
Refactor opcode.pl - opcode.h - unglobalize output handle
Branislav Zahradník [Sun, 16 Oct 2022 09:01:03 +0000 (11:01 +0200)]
Refactor opcode.pl - opcode.h - move PL_opargs into function
Branislav Zahradník [Sun, 16 Oct 2022 07:40:31 +0000 (09:40 +0200)]
Refactor opcode.pl - opcode.h - move PL_check into function
Branislav Zahradník [Sun, 16 Oct 2022 07:28:17 +0000 (09:28 +0200)]
Refactor opcode.pl - opcode.h - move PL_ppaddr into function
Branislav Zahradník [Sun, 16 Oct 2022 06:34:08 +0000 (08:34 +0200)]
Refactor opcode.pl - opcode.h - move opnames into function
Branislav Zahradník [Sun, 16 Oct 2022 06:31:07 +0000 (08:31 +0200)]
Refactor opcode.pl - opcode.h - move defines into function
Branislav Zahradník [Sun, 16 Oct 2022 06:23:11 +0000 (08:23 +0200)]
Refactor opcode.pl - opcode.h - move prologue into function
Branislav Zahradník [Sun, 16 Oct 2022 06:36:37 +0000 (08:36 +0200)]
Refactor opcode.pl - required little bit newer perl
This is perl5 developer tool, it's safe to expect contributors have
something newer at their disposal.
Branislav Zahradník [Fri, 4 Nov 2022 18:07:41 +0000 (19:07 +0100)]
Refactor opcode.pl - untabify
AnFunctionArray [Fri, 4 Nov 2022 15:52:56 +0000 (17:52 +0200)]
Moved unused variable into debug scope
Moved declaration of object p.
For: Issue: https://github.com/Perl/perl5/issues/20485
p.r.: https://github.com/Perl/perl5/pull/20486
Yves Orton [Fri, 4 Nov 2022 08:19:59 +0000 (09:19 +0100)]
regcomp.c - remove always true condition
RX_PRECOMP() has for some time been an expression that
will always be true, thus there is not need to test it.
Graham Knop [Fri, 4 Nov 2022 05:13:03 +0000 (06:13 +0100)]
GitHub Actions: switch from ::set-output to $GITHUB_OUTPUT
The ::set-output command has been deprecated and replaced with the
$GITHUB_OUTPUT environment file. Convert the workflows to use the newer
output mechanism.
Reference: https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
Yves Orton [Fri, 4 Nov 2022 09:26:11 +0000 (10:26 +0100)]
scope.* - revert and rework SAVECOPWARNINGS change
We can't put PL_compiling or PL_curcop on the save stack as we don't
have a way to ensure they cross threads properly. This showed up as a
win32 t/op/fork.t failure in the thread based fork emulation layer.
This adds a new save type SAVEt_CURCOP_WARNINGS and macro
SAVECURCOPWARNINGS() to complement SAVEt_COMPILER_WARNINGS and
SAVECOMPILEWARNINGS(). By simply hard coding where the pointers should
be restored to we side step the issue of which thread we are in.
Thanks to Graham Knop for help identifying that one of my commits was
responsible.
Alexander Nikolov [Thu, 2 Jun 2022 19:01:42 +0000 (12:01 -0700)]
Replaced recppush/regcppop with memcpy
Basically tested with Intel VTune to be increasing the performance of
a perl regex matching program with multiple capture groups and
recursive patterns
[With minor whitespace edits by Yves.]
Tony Cook [Wed, 2 Nov 2022 23:06:40 +0000 (10:06 +1100)]
perldelta for
1a2b24d857d
Tony Cook [Thu, 20 Oct 2022 04:04:51 +0000 (15:04 +1100)]
change the return value of SSNEW to SSize_t
The normal savestack index is an I32, but that counts in ANY
(which are typically the larger of pointer or IV sizes), this
meant is the save stack was large, but still nowhere need it's
limit, the result of SSNEW() could overflow.
So make the result SSize_t and adjust SSPTR() to match.
SSPTR() asserts to ensure the supplied type is the same size as
SSize_t to ensure callers are updated to handle the new limit.
TAKAI Kousuke [Wed, 26 Oct 2022 14:59:10 +0000 (23:59 +0900)]
op.c: Add a cast to silence -Wsign-compare warning
In 32-bit build (where IV is not wider than U32), comparing
PL_eval_begin_nest_depth and max_nest_iv would generate a warning:
op.c:10817:42: warning: comparison of integer expressions of different signedness: ‘U32’ {aka ‘long unsigned int’} and ‘IV’ {aka ‘long int’} [-Wsign-compare]
10817 | if (PL_eval_begin_nest_depth >= max_nest_iv) {
| ^~
Yves Orton [Fri, 28 Oct 2022 21:28:06 +0000 (23:28 +0200)]
re/fold_grind.pl - rework so we don't double compile patterns
We were calling utf8::upgrade() on qr// objects, which works, in
that it stringifies the pattern, and then upgrades the string, and
the string can be used to match against. But it double compiles the
pattern, which is a bit unnecessary. For example
$pat= qr/\x{DF}/;
utf8::upgrade($pat); # $pat is now a string!
"ss"=~/$pat/; # and now $pat gets compiled again
works, but it does twice the work needed.
This was found by making utf8::upgrade() ignore refs.
Yves Orton [Tue, 1 Nov 2022 14:31:24 +0000 (15:31 +0100)]
cop.h - get rid of the STRLEN* stuff from cop_warnings
With RCPV strings we can use the RCPV_LEN() macro, and
make this logic a little less weird.
Yves Orton [Tue, 1 Nov 2022 14:03:41 +0000 (15:03 +0100)]
warnings.h - length guard cop_warnings bitvector checks
Yves Orton [Tue, 1 Nov 2022 13:22:45 +0000 (14:22 +0100)]
scope.* - more flexible ways to save warning bits
Tony Cook [Tue, 1 Nov 2022 22:49:25 +0000 (09:49 +1100)]
Tony Cook [Thu, 15 Sep 2022 04:40:18 +0000 (14:40 +1000)]
make win32_readlink() return PrintName instead of SubstituteName
While debugging socket stat()ing I noticed that sometimes the
name returned by win32_readlink() was a full pathname rather than
the name that the link was created as.
Changing this to use the PrintName values changed win32_readlink()
to return the create as name, which seems closer to the POSIX
readlink.
Tony Cook [Tue, 6 Sep 2022 05:01:54 +0000 (15:01 +1000)]
Win32 stat() didn't handle AF_UNIX socket files
Unfortunately both symbolic links and sockets can only be
"statted" by opening with FILE_FLAG_OPEN_REPARSE_POINT which
obviously doesn't follow symbolic links.
So to find if a chain of symbolic links points to a socket,
is a broken chain, or loops, we need to follow the chain
ourselves.
Tony Cook [Mon, 26 Sep 2022 05:13:02 +0000 (15:13 +1000)]
duplicate -F switches would overwrite PL_splitstr without freeing
Of course, it wasn't safe to free it before the previous patch,
but it is now.
Tony Cook [Mon, 26 Sep 2022 05:03:50 +0000 (15:03 +1000)]
We freed PL_splitstr in each thread, allocate it in each thread too
I also fixed const correctness for PL_splitstr, it was initialized
to " " which required it to be const, but the value is only looked
at when PL_minus_F is true, so it wasn't necessary.
So initialize it to NULL, and duplicate the value in threads.
Yves Orton [Tue, 1 Nov 2022 16:58:47 +0000 (17:58 +0100)]
t/comp/require.t - add tests for module_true being off
Or the file being empty, or various other cases. We missed
a case in the earlier work on module_true.
This also includes some tweaks to make the tests pass under strict
if needed.
Yves Orton [Tue, 1 Nov 2022 16:57:45 +0000 (17:57 +0100)]
t/comp/require.t - add a way to disable the sleep 20
it makes developing the test script quite annoying.
Yves Orton [Tue, 1 Nov 2022 16:02:14 +0000 (17:02 +0100)]
t/comp/require.t - test module_true with requiring empty files
Yves Orton [Tue, 1 Nov 2022 15:40:37 +0000 (16:40 +0100)]
pp_ctl.c - teach module_true how to deal with blocked requires
If require encounters an @INC hook that blocks the require it
ends up with a STUB node as the optree for the LEAVEEVAL. This was
causing the module_true logic to segfault. Guarding against the
OP_STUB node fixes the problem.
This affected the tests for IO::Socket::SSL. Thanks to Graham
Knopp for the reduced case, and James Keenan for reporting it
in https://github.com/Perl/perl5/issues/20468.
This should fix the problem.
Yves Orton [Mon, 31 Oct 2022 21:39:16 +0000 (22:39 +0100)]
locale.c - add comments about PERL_DESTRUCT_LEVEL avoiding "leaks"
Some of the locale data is deliberately not destroyed during shutdown.
Setting PERL_DESTRUCT_LEVEL=2 causes them to be cleaned up. If someone
ends up debugging under the address sanitizer and ends up at this logic
then the comments will help them avoid some frustration.
Paul "LeoNerd" Evans [Mon, 31 Oct 2022 23:34:06 +0000 (23:34 +0000)]
Also add a STRLEN member to ANY
Paul "LeoNerd" Evans [Mon, 31 Oct 2022 23:27:36 +0000 (23:27 +0000)]
Add Size_t and SSize_t members to ANY
Paul "LeoNerd" Evans [Mon, 31 Oct 2022 23:27:18 +0000 (23:27 +0000)]
Convert tabs to whitespaces in union any {} definition
Yves Orton [Mon, 31 Oct 2022 13:41:27 +0000 (14:41 +0100)]
op.c - use refcounted pv pointers for cop_warnings
this allows multiple ops to share the same underlying
warning bit vector. the vectors are not deduped, however
they are efficiently copied and shared.
Yves Orton [Mon, 31 Oct 2022 11:22:19 +0000 (12:22 +0100)]
regen/scope_types.pl - add tool to manage the scope type defines
In scope.c and scope.h there are various defines that must be coordinated
with the contents of an array, and comments and ids which might have to be
mass changed manually in some circumstances. As this is error prone this
patch adds a new regen script to ensure it is kept in sync and to make the
process of adding new types trivial. The data that drives the script is
kept in the scripts __DATA__ section.
Yves Orton [Mon, 31 Oct 2022 10:37:27 +0000 (11:37 +0100)]
scope_types.h - new header file for scope type data
Next patch this data will be autogenerated.
Yves Orton [Fri, 28 Oct 2022 19:14:23 +0000 (21:14 +0200)]
cop.h - add support for refcounted filenames in cops under threads
We have a weird bifurcation of the cop logic around threads. With
threads we use a char * cop_file member, without it we use a GV * and
replace cop_file with cop_filegv.
The GV * code refcounts filenames and more or less efficiently shares
the filename amongst many opcodes. However under threads we were
simplify copying the filenames into each opcode. This is because in
theory opcodes created in one thread can be destroyed in another. I say
in theory because as far as I know the core code does not actually do
this. But we have tests that you can construct a perl, clone it, and
then destroy the original, and have the copy work just fine, this means
that opcodes constructed in the main thread will be destroyed in the
cloned thread. This in turn means that you can't put SV derived
structures into the op-tree under threads. Which is why we can not use
the GV * stategy under threads.
As such this code adds a new struct/type RCPV, which is a refcounted
string using shared memory. This is implemented in such a way that code
that previously used a char * can continue to do so, as the refcounting
data is located a specific offset before the char * pointer itself.
This also allows the len data to embedded "into" the PV, which allows
us to expose macros to acces the length of what is in theory a null
terminated string.
struct rcpv {
UV refcount;
STRLEN len;
char pv[1];
};
typedef struct rcpv RCPV;
The struct is sized appropriately on creation in rcpv_new() so that the
pv member contains the full string plus a null byte. It then returns a
pointer to the pv member of the struct. Thus the refcount and length and
embedded at a predictable offset in front of the char *, which means we
do not have to change any types for members using this.
We provide three operations: rcpv_new(), rcpv_copy() and rcpv_free(),
which roughly correspond with newSVpv(), SvREFCNT_inc(), SvREFCNT_dec(),
and a handful of macros as well. We also expose SAVERCPVFREE which is
similar to SAVEGENERICSV but operates on pv's constructed with
rcpv_new().
Currently I have not restricted use of this logic to threaded perls. We
simply do not use it in unthreaded perls, but I see no reason we
couldn't normalize the code to use this in both cases, except possibly
that actually the GV case is more efficient.
Note that rcpv_new() does NOT use a hash table to dedup strings. Two
calls to rcpv_new() with the same arguments will produce two distinct
pointers with their own refcount data.
Refcounting the cop_file data was Tony Cook's idea.
Yves Orton [Mon, 31 Oct 2022 12:47:43 +0000 (13:47 +0100)]
mg.c/perl.c/scope.c - fixup mangled indentation and whitespace
Various code related to set_and_free_cop_warnings was terribly mangled
as far as whitespace goes. This patch cleans it up so it is readable and
correctly indented. Whitespace only changes.
Leon Timmermans [Tue, 2 Aug 2022 17:43:47 +0000 (19:43 +0200)]
Add tests for value magic
Leon Timmermans [Tue, 2 Aug 2022 17:43:37 +0000 (19:43 +0200)]
Test localization of ext magic
Leon Timmermans [Tue, 2 Aug 2022 16:11:04 +0000 (18:11 +0200)]
Simplify magic test
Leon Timmermans [Sat, 30 Jul 2022 14:39:41 +0000 (16:39 +0200)]
Add PERL_MAGIC_extvalue
A new magic type PERL_MAGIC_extvalue has been added. This is available
for use like PERL_MAGIC_ext, but is a value magic: upon localization the
new value will not be magical.
Yves Orton [Fri, 28 Oct 2022 11:22:14 +0000 (13:22 +0200)]
peep.c - add a comment/question to a comment
We optimize away certain nextstate ops, but it isn't clear if
it is possible for the ops to be there to switch hints or feature
flags. Tony thinks its fine however. So I have added the commentary
to the comment for future readers.
Yves Orton [Fri, 28 Oct 2022 11:21:50 +0000 (13:21 +0200)]
op.c - remove superfluous whitespace
Yves Orton [Fri, 28 Oct 2022 11:20:54 +0000 (13:20 +0200)]
dump.c - in op_dump show the hints and feature bits
I used to 'FEATS' instead of 'FEATURES' so the values line up
nicely.
Yves Orton [Fri, 28 Oct 2022 11:38:21 +0000 (13:38 +0200)]
perlfunc.pod - document module_true in the require entry
A brief note pointing people at the feature manpage.
chromatic [Thu, 27 Oct 2022 09:24:58 +0000 (11:24 +0200)]
Enable `use feature 'module_true'`
Per RFC 18, whenever `use feature 'module_true';` is enabled in a scope,
any file required with `require` has an implicit return value of true
and will not trigger the "did not return a true value" error condition.
This includes logic to use the OPf_SPECIAL flag for OP_RETURN listops to
indicate that the module_true feature is in effect when it executes.
This flag plays no role unless the OP_RETURN tail calls the pp_leaveeval
logic, so it doesn't affect normal sub returns.
Karl Williamson [Sun, 23 Oct 2022 03:39:52 +0000 (21:39 -0600)]
locale.c: Handle locale names with '@'
The XPG locale name standard says the codeset is the part of the name
after any dot, terminated by the end of string or an '@'.
Prior to this commit, the possibility of an '@' was not considered.
Yves Orton [Wed, 26 Oct 2022 07:04:09 +0000 (09:04 +0200)]
perly.y - add a diag_listed_as for Unimplemented
In
1557e6c32831defe4b25a924a88baf5f5e7bcbdd we added a perldiag entry
for 'Unimplemented', which was good. But in theory the message should
have been picked up by the diagnostics tests when it was introduced.
However, this error message is not constructed in the normal way, and
the string was not identified as a message. This adds the appropriate
comment in the appropirate place so that the diagnostics test will
notice it should it change in the future. This necessitated a
make perly_regen.
Yves Orton [Tue, 25 Oct 2022 17:29:25 +0000 (19:29 +0200)]
perly.* - update perly files with more recent bison
I want to modify perly with a comment. But that would leave us with
output files that are out of date in comparison with the input files.
My bison is later than the last used for perl, so running it
without my patch makes large changes. Therefore I have separated the
change into two pieces, the first just updates everything using my
more modern bison, the second runs bison again with the change I
actually made. This is the first of the pair, nothing changes here
except that which bison changed.
Karl Williamson [Sun, 23 Oct 2022 03:38:20 +0000 (21:38 -0600)]
locale.c Avoid redundant querylocale
We just found the proper value a few lines above
Karl Williamson [Sat, 8 Oct 2022 12:29:47 +0000 (06:29 -0600)]
Time::HiRes: Fix compiler warning
A variable was declared twice; remove the redundant one
Aristotle Pagaltzis [Sun, 30 Oct 2022 13:05:18 +0000 (14:05 +0100)]
Memoize: exclude CPAN-only toolchain from core
Yves Orton [Sun, 30 Oct 2022 09:29:10 +0000 (10:29 +0100)]
dump.c - add missing cast
In
06d92f00e810ad2f12b8fb9c1adf0d22765d6ccc we added the CV_FROM_REF()
macros, these macros assume the argument is an SV, so the gv prequires
a cast. The argument was cast to SV* in another case, so I am adding the
same fix here.
Silences the following warning:
dump.c: In function ‘S_gv_display’:
dump.c:880:58: warning: initialization of ‘SV *’ {aka ‘struct sv *’} from
incompatible pointer type ‘GV *’ {aka ‘struct gv *’} [-Wincompatible-pointer-types]
880 | SvPV_nolen_const(cv_name(CV_FROM_REF(gv), name, 0)));
| ^~
sv.h:1912:42: note: in definition of macro ‘SvPV_flags_const_nolen’
1912 | ((const char*) Perl_SvPV_helper(aTHX_ sv, NULL, flags, SvPVnormal_type_, \
| ^~
dump.c:880:21: note: in expansion of macro ‘SvPV_nolen_const’
880 | SvPV_nolen_const(cv_name(CV_FROM_REF(gv), name, 0)));
| ^~~~~~~~~~~~~~~~
dump.c:880:38: note: in expansion of macro ‘cv_name’
880 | SvPV_nolen_const(cv_name(CV_FROM_REF(gv), name, 0)));
| ^~~~~~~
handy.h:136:27: note: in expansion of macro ‘xV_FROM_REF’
136 | #define CV_FROM_REF(ref) xV_FROM_REF(CV, ref)
| ^~~~~~~~~~~
dump.c:880:46: note: in expansion of macro ‘CV_FROM_REF’
880 | SvPV_nolen_const(cv_name(CV_FROM_REF(gv), name, 0)));
Paul "LeoNerd" Evans [Thu, 27 Oct 2022 16:05:10 +0000 (17:05 +0100)]
Use new xV_FROM_REF macros
Paul "LeoNerd" Evans [Thu, 27 Oct 2022 16:05:00 +0000 (17:05 +0100)]
Define some xV_FROM_REF() macros
These macros contain assert() calls to check that the `ref` SV really is
a reference (SvROK) and that the SvTYPE it points to is that which is
expected.
Tom Stellard [Fri, 21 Oct 2022 04:34:53 +0000 (00:34 -0400)]
Fix fegetround on s390x with clang
Clang's s390x backend hard codes FLT_ROUNDS to one. This fixes
fenv.t test failures with building with clang on s390x.
Yves Orton [Fri, 28 Oct 2022 19:20:39 +0000 (21:20 +0200)]
dump.c - document sv_dump_depth()
Max Maischein [Fri, 28 Oct 2022 10:21:33 +0000 (12:21 +0200)]
Update experimental to 0.029
Yves Orton [Sun, 23 Oct 2022 11:26:03 +0000 (13:26 +0200)]
toke.c - rework "Perl_no_op" warnings so we call Perl_warner() once only
Using multiple calls to Perl_warner() means that fatalized warnings
do not include the full diagnostics. It also means that $SIG{__WARN__}
might get called more than once for a given warning, with parts of the
message in each call. This would affect "missing operator" warnings,
which often come up in the context of barewords and misspelled sub
names.
This patch moves the parenthesized "hint" part of the warning to the
same line as the main warning and ensures the entire message is
dispatched in a single call to Perl_warner(). The result of this is that
the hint is visible even under fatalized warnings and that
$SIG{__WARN__} is called only once for the warning.
At the same time this patch fixes an oversight where we would sometimes
form warning messages with a subject (var name or bareword name) that
was unquoted and sometimes had leading whitespace. This patch changes
this to quote the subject like most of our errors do and to strip the
whitespace when appropriate. (Note this doesn't use the QUOTEDPREFIX
formats, as it didn't seem to be necessary with the type of warnings
this is involved in.) This is not done in a separate patch as it would
mean manually altering all the tests multiple times over multiple
patches.
Note that yywarn() calls Perl_warner(), so even though this patch
does not call it directly it does call it indirectly via yywarn()
via yyerror().
This resolves GH Issue #20425.
Yves Orton [Sun, 23 Oct 2022 15:54:43 +0000 (17:54 +0200)]
t/op/lex.t - allow it to be run from the root of the repo
This makes:
./perl -Ilib t/op/lex.t
work as expected.
Yves Orton [Sun, 23 Oct 2022 11:23:56 +0000 (13:23 +0200)]
porting/diag.t - allow it to be run from the root directory
I think this used to work before we removed "." from @INC and
nobody noticed when we made that change. This adds it back into
@INC if necessary like we would have from t/.
Yves Orton [Tue, 25 Oct 2022 10:05:16 +0000 (12:05 +0200)]
feature.h - simplify expression CURRENT_HINTS expression
PL_hints expands to PL_compiling.cop_hints. So there is no
point in doing
PL_curcop == &PL_compiling ? PL_hints : PL_curcop->cop_hints
as it resolves to doing:
PL_curcop->cop_hints
but with a comparison, which likely kills any speed advantage
the direct access might provide.
The old define is left around to validate that the two are the same
if needed.
Tony Cook [Thu, 18 Mar 2021 03:37:01 +0000 (14:37 +1100)]
op.c - copy cop_features to the COP inserted into the OP tree
All current features are compile-time, so this hasn't been an issue,
but my current implementation of the autovivification issue checks
features at runtime, which failed to work correctly if non-bundle
features were set.
This commit fixes things so that run-time default-on features also work
properly, by setting each COP's cop_features to the value of the bits
set at the COP's compile time - ie the same approach as cop_hints.
Karl Williamson [Sat, 8 Oct 2022 12:32:11 +0000 (06:32 -0600)]
t/op/require_errors.t: Fix Windows miniperl warning
A regular expression pattern was failing to \Q an expansion of @INC,
leading to a perl warning due to it's thinking a \ in a path was an
escape. This doesn't arise on systems where the path separator is a
forward slash, and only under miniperl.
Karl Williamson [Mon, 24 Oct 2022 04:01:41 +0000 (22:01 -0600)]
Clarify perlfunc sleep entry
Note what happens if a fraction, and add markup.
Karl Williamson [Sat, 15 Oct 2022 18:32:18 +0000 (12:32 -0600)]
locale.c: Silence '-Wchar-subscripts' C++ warning
In, for example,
nntp.perl.org/group/perl.daily-build.reports/2022/10/msg285932.html
we get:
locale.c:2281:27: warning: array subscript is of type 'char'
[-Wchar-subscripts]
locale.c:2282:27: warning: array subscript is of type 'char'
[-Wchar-subscripts]
These warnings are bogus, but better to avoid them.
Paul "LeoNerd" Evans [Tue, 25 Oct 2022 14:37:00 +0000 (15:37 +0100)]
Add sv_derived_from_hv() helper function
Karl Williamson [Thu, 20 Oct 2022 03:21:28 +0000 (21:21 -0600)]
t/test.pl: Fix threads signalling watchdog cancellation
Commit
4712a4c94e5974bba8ef97d68aadf2b99c0b4ff4 added the ability to
cancel a watchdog timer. Unfortunately it doesn't work properly when
the timer method was using the thread signalling cancellation method.
This problem only shows up on slow systems under load, so the flaw
wasn't immediately discovered. That commit lowered the incidence level
significantly.
This commit solves the problem by having the child thread detach itself,
after it sets up the needed code to handle a signal from the parent.
The parent thread waits for the detach to happen, and proceeds. Not
until then would it be safe to signal the child.
Paul "LeoNerd" Evans [Fri, 14 Oct 2022 12:14:47 +0000 (13:14 +0100)]
Better handling of builtin CV attributes
The previous code would handle subroutine attributes directly against
`PL_compcv` as a side-effect of merely parsing the syntax in
`yyl_colon()`, an unlikely place for anyone to find it. This complicates
the way the parser works.
The new structure creates a new function to apply all the builtin
attributes out of an attribute list to any given CV, and invokes it from
the parser at a slightly better time.
Karl Williamson [Mon, 24 Oct 2022 23:43:24 +0000 (17:43 -0600)]
threads.xs: Use plain SvREFCNT_dec if SvREFCNT_dec_NN unavailable
Tony Cook [Mon, 24 Oct 2022 23:37:00 +0000 (10:37 +1100)]
dist/threads: Only veto switching locale on new perls
Older perls don't define these variables.
Joe McMahon [Sun, 23 Oct 2022 23:35:04 +0000 (16:35 -0700)]
19207: Document ellipsis statement error
Adds a section to `perldiag` that details what the `Unimplemented` error
is, caused by executing an ellipsis ("...;") statement.
Richard Leach [Sun, 23 Oct 2022 21:43:14 +0000 (21:43 +0000)]
version bump to squash
Richard Leach [Tue, 2 Aug 2022 21:48:26 +0000 (21:48 +0000)]
OP_EMPTYAVHV - optimized empty ANONLIST/ANONHASH
This commit introduces a new OP to replace cases of OP_ANONLIST and
OP_ANONHASH where there are zero elements, which is very common in
Perl code.
As an example, `my $x = {}` is currently implemented like this:
...
6 <2> sassign vKS/2 ->7
4 <@> anonhash sK* ->5
3 <0> pushmark s ->4
5 <0> padsv[$x:1,2] sRM*/LVINTRO ->6
The pushmark serves no meaningful purpose when there are zero
elements and the anonhash, besides undoing the pushmark,
performs work that is unnecessary for this special case.
The peephole optimizer, which also checks for applicability of a
related TARGMY optimization, transforms this example into:
...
- <1> ex-sassign vKS/2 ->4
3 <@> emptyavhv[$x:1,2] vK*/LVINTRO,ANONHASH,TARGMY ->4
- <0> ex-pushmark s ->3
- <0> ex-padsv sRM*/LVINTRO ->-
Max Maischein [Mon, 24 Oct 2022 17:11:55 +0000 (19:11 +0200)]
Also bump the Module::CoreList version number in Porting/Maintainers.pl
Max Maischein [Sun, 23 Oct 2022 12:46:14 +0000 (14:46 +0200)]
Update Memoize to 1.15
Graham Knop [Mon, 24 Oct 2022 03:36:08 +0000 (05:36 +0200)]
bump ExtUtils::ParseXS version to 3.47
Graham Knop [Sat, 22 Oct 2022 08:36:38 +0000 (10:36 +0200)]
fix ExtUtils::ParseXS compatibility with perl < 5.8.8