This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Yves Orton [Mon, 21 Feb 2022 06:14:52 +0000 (07:14 +0100)]
regcomp.c: consistent NOTHING/OPFAIL optimizations for lookaround
Add funcs to parse empty constructs which boil down to OPFAIL or NOTHING,
and then consistently use them while parsing lookahead and lookbehind.
This allows us to eliminate duplicated code and optimize the various cases
which boil down to these constructs.
Eg. (?!) and (?<!) are equivalent to OPFAIL ops,
and (?=) and (?<=) are equivalent to NOTHING ops.
This patch does not deal with the (* ... ) forms, that will come in a
follow up.
One advantage of this optimization is it does not need to set the various
special flags related to lookaround as they aren't really lookaround ops.
As a bonus this also improves the error messages from incomplete patterns,
and add tests for various error messages.
Note the functions are given awkward but shortish names so they are not
always forced to be line broken. I would prefer to name them something
more descriptive, but that would make their use harder to read by
forcing line breaks. So I chose to use an abbreviation.
Yves Orton [Mon, 21 Feb 2022 12:18:06 +0000 (13:18 +0100)]
regcomp.c: fix long lines or unnecessary line breakage
Vertical space is more expensive than horizontal, don't waste it when we
are under the recommended line length.
At the same time, rewording a comment so its shorter than the line length
keeps us compliant. (I'd prefer we didnt have to do this, but ze rulez
are ze rulez!)
Also fixes indents and make the error message coding style consistent.
Yves Orton [Sun, 20 Feb 2022 09:38:09 +0000 (10:38 +0100)]
regex engine: Issue #19168 - Fix variable length lookbehind matches
We were not validating that when (?<=a|ab) matched that the right hand
side of the match lined up with the position of the assertion. Similar
for (?<!a|ab) and related patterns, eg, (*positive_lookbehind:).
Note these problems do NOT affect lookahead.
Part of the difficulty here was that the SUCCEED node was serving too
many purposes, necessitating a new regop LOOKBEHIND_END.
Includes more tests for various lookahead or lookbehind cases.
Yves Orton [Sun, 20 Feb 2022 01:22:27 +0000 (02:22 +0100)]
regcomp.c: add whitespace to avoid =* as a symbol
GNU indent warns that this is ambiguous, and the spaces make it more
legible anyway.
Nicholas Clark [Tue, 22 Feb 2022 20:35:17 +0000 (20:35 +0000)]
Perl_gv_init_pvn() must handle a stash holding the value -1
As a space optimisation, where possible, sub declarations are stored in the
symbol table as a plain scalar, and converted to a PVGV, PVCV pair only when
needed.
A regression was introduced by the recently merged commit
bb5bc97fde9ef2f1:
Don't set SVf_POK in Perl_sv_2pv_flags() when caching the string for an IV.
This permits XS code (such as serialisers) to distinguish between values
that started as IVs but had a string representation cached, and values that
started as PVs but had an (exact) integer representation cached.
As implemented, the change in flags means that Perl_sv_2pv_flags() will be
entered each time the string for an IV is wanted. The next commit will fix
SvPV() and the other macros to avoid calling Perl_sv_2pv_flags() more than
once, restoring the previous behaviour.
Specifically, code which reduces to this:
sub foo;
$::{foo} . "";
eval q{*foo = []};
changed behaviour (to an assertion failure)
Previously the runtime behaviour of the middle line (simplifying slightly)
was to convert the IV -1 to the PVIV "-1". The third line would then see
this as a(n illegal) prototype "-1", but the code in Perl_gv_init_pvn()
would diligently move this across to the PVCV it created, and finish with a
structurally valid PVGV and PVCV
With the recent commit, the second line would still convert to PVIV, but no
longer set the flag bit SVf_POK. This meant that with this same test case,
the SvPOK() test in Perl_gv_init_pvn() was no longer true, and a different
code path was taken, resulting in broken assumptions and an assertion
failure (when assertions are enabled).
Fixing this regression also fixes a long standing bug, likely present since
the commit from 1998 that added this space optimisation. This pathological
code:
sub foo;
$::{foo} . "";
eval q{ sub foo {} };
use to incorrectly warn:
Prototype mismatch: sub main::foo (-1) vs none at (eval 1) line 1.
because the placeholder -1 for "no prototype" had been converted to a
string, that string then copied because it seemed to be a placeholder
prototype, and then the warning issued on the mistaken incorrect prototype.
Matthew Horsfall [Mon, 21 Feb 2022 13:39:48 +0000 (08:39 -0500)]
POD typo fix: suroutine -> subroutine
Bernd [Mon, 21 Feb 2022 08:46:23 +0000 (09:46 +0100)]
use neutral form for parameter
User $val instead of $sv as for the other parameter in the samples.
For: https://github.com/Perl/perl5/pull/19445
Committer: Increment package version
Bernd [Mon, 21 Feb 2022 08:13:33 +0000 (09:13 +0100)]
fix typo in perl5358delta
Remove doubled line in the "Testing" section.
For: https://github.com/Perl/perl5/pull/19443
Committer: Bernd is now a Perl author
reneeb [Sun, 20 Feb 2022 16:46:06 +0000 (16:46 +0000)]
prepare Module::CoreList for 5.35.10
reneeb [Sun, 20 Feb 2022 16:08:42 +0000 (16:08 +0000)]
bump version for 5.35.10
reneeb [Sun, 20 Feb 2022 15:16:20 +0000 (15:16 +0000)]
add new perldelta for 5.35.10
reneeb [Sun, 20 Feb 2022 15:13:04 +0000 (15:13 +0000)]
tick off release 5.35.9 in release schedule
reneeb [Sun, 20 Feb 2022 15:03:49 +0000 (15:03 +0000)]
update epigraphs with 5.35.9 entry
reneeb [Sun, 20 Feb 2022 09:53:46 +0000 (09:53 +0000)]
Add new release to perlhist
reneeb [Sun, 20 Feb 2022 09:53:11 +0000 (09:53 +0000)]
fixed POD warnings in perldelta, regenerated known_pod_issues.dat
reneeb [Sun, 20 Feb 2022 09:27:56 +0000 (09:27 +0000)]
finalize perldelta for 5.35.9
reneeb [Sun, 20 Feb 2022 08:53:24 +0000 (08:53 +0000)]
Update Module::CoreList for 5.35.9
reneeb [Sun, 20 Feb 2022 07:56:08 +0000 (07:56 +0000)]
Update AUTHORS list for 5.35.9
reneeb [Sun, 20 Feb 2022 07:50:39 +0000 (07:50 +0000)]
Update Devel-PPPort to 3.64
reneeb [Sun, 20 Feb 2022 06:54:18 +0000 (06:54 +0000)]
update Porting/Maintainers.pl (update Scalar-List-Utils version
reneeb [Sun, 20 Feb 2022 06:40:14 +0000 (06:40 +0000)]
update Scalar-List-Utils to 1.61
Paul "LeoNerd" Evans [Tue, 15 Feb 2022 18:54:29 +0000 (18:54 +0000)]
Add 'signatures' to :5.36 feature bundle
Paul "LeoNerd" Evans [Tue, 15 Feb 2022 17:04:12 +0000 (17:04 +0000)]
Update various documentation files
Paul "LeoNerd" Evans [Tue, 15 Feb 2022 15:02:03 +0000 (15:02 +0000)]
Remove 'no warnings experimental::signatures' from support files
Paul "LeoNerd" Evans [Tue, 15 Feb 2022 13:46:29 +0000 (13:46 +0000)]
Don't emit experimental::signatures warning (closes #13681)
Paul "LeoNerd" Evans [Tue, 15 Feb 2022 18:54:11 +0000 (18:54 +0000)]
perl5db.pl needs to use :prototype() attribute to set sub prototypes
Tony Cook [Mon, 29 Nov 2021 04:04:43 +0000 (15:04 +1100)]
test the new flags behaviour, to prevent accidental breakage
Tony Cook [Mon, 29 Nov 2021 00:29:57 +0000 (11:29 +1100)]
document the new flags behaviour and why
Nicholas Clark [Mon, 5 Jul 2021 09:08:55 +0000 (09:08 +0000)]
perldelta entry for the PV/IV flags changes.
This needs an update to known_pod_issues.dat because the Pod has trailing
whitespace to avoid parts of the same verbatim code block getting separated.
Nicholas Clark [Sun, 4 Jul 2021 19:23:05 +0000 (19:23 +0000)]
Copy values that are "written as IV, then read as PV" with the same flags.
Previously Perl_sv_setsv_flags() would gleefully turn on SVf_POK for these
values, which meant that any copy no longer propagated the (new) state
that says "this value started as an integer".
Nicholas Clark [Fri, 2 Jul 2021 19:03:28 +0000 (19:03 +0000)]
Update SvPV() etc to avoid calling sv_2pv_flags() for cached IV strings.
This "teaches" them the new SV flags combination implemented by the previous
commit.
Nicholas Clark [Fri, 2 Jul 2021 12:45:42 +0000 (12:45 +0000)]
Don't set SVf_POK in Perl_sv_2pv_flags() when caching the string for an IV.
This permits XS code (such as serialisers) to distinguish between values
that started as IVs but had a string representation cached, and values that
started as PVs but had an (exact) integer representation cached.
As implemented, the change in flags means that Perl_sv_2pv_flags() will be
entered each time the string for an IV is wanted. The next commit will fix
SvPV() and the other macros to avoid calling Perl_sv_2pv_flags() more than
once, restoring the previous behaviour.
Tomasz Konojacki [Wed, 16 Feb 2022 05:29:25 +0000 (06:29 +0100)]
implement a new command-line flag, -g
It's a simpler alias for -0777. It was proposed in RFC-0011:
https://github.com/Perl/RFCs/blob/master/rfcs/rfc0011.md
Tomasz Konojacki [Wed, 16 Feb 2022 04:51:41 +0000 (05:51 +0100)]
t/run/switches.t: don't declare a plan
Leon Timmermans [Sat, 19 Feb 2022 15:46:52 +0000 (16:46 +0100)]
Upgrade experimental to 0.027
Yves Orton [Mon, 14 Feb 2022 06:35:59 +0000 (07:35 +0100)]
Reapply "docs: clarify effect of $^H, %^H, ${^WARNING_BITS}"
This reverts commit
d0b5de5644ac01ea2ccdbd8cbe7dd9c5fe225af4
which itself reverted
ee428a211d040dc56d9efc4a89c96886a398fc1c
See http://nntp.perl.org/group/perl.perl5.porters/257128
Yves Orton [Mon, 14 Feb 2022 06:34:54 +0000 (07:34 +0100)]
Reapply squashed "avoid identical stack traces" patches
This reapplies two reverted patches as a single squashed commit.
Revert "Revert "avoid identical stack traces""
This reverts commit
79f75eaa716307235be78834c99ba0599a00319b
which itself reverted
f2f32cd638746f538da6db804dab6dd54e654f30
Revert "Revert "fixup to "avoid identical stack traces" - try 2""
This reverts commit
2abf7efcc0ff8978340af661cb333175a899a84e
which itself reverted
ad89278aa25475fb03971aec66692e18e35d9c07
Original Author: David Mitchell <davem@iabyn.com>
Original Date: Fri Dec 13 13:48:25 2019 +0000
avoid identical stack traces
GH #15109
The output of caller() (e.g. as produced by carp::Confess) produces
multiple identical outputs when within a nested use/require. This is
because at the time of calling the 'BEGIN { require ... }', PL_curcop is
set to &PL_compiling, which is a fixed buffer within the interpreter,
whose individual file and line fields are saved and restored when doing
a new require/eval. This means that within the innermost require,
PL_compiling has file:lineno of the innermost source file, and multiple
saved PL_curcop values in the context stack frames all point to the same
&PL_copmpiling. So all levels of the stack trace appear to come from the
innermost file.
This commit fixes this (after a fashion) by, at the start of calling a
BEGIN, making PL_curcop point to a temporary copy of PL_compiling
instead.
This is all a bit of a hack.
Max Maischein [Fri, 18 Feb 2022 17:34:02 +0000 (18:34 +0100)]
Eliminate a variable keeping the length of a string
As per the discussion in
https://github.com/Perl/perl5/issues/19268
Paul "LeoNerd" Evans [Fri, 18 Feb 2022 15:56:57 +0000 (15:56 +0000)]
Mark files generated by unicode as linguist-generated
Yves Orton [Sat, 12 Feb 2022 04:36:36 +0000 (05:36 +0100)]
regcomp.h: change regexp_internal attribute from I32 to U32
This changes the name_list_idx attribute from I32 to a U32 as it will
never be negative, and as of
a963d6d5acabdd8c7 a 0 can be safely used
to represent "no value" for items in the 'data' array.
I noticed this while cleaning up the offsets debug logic and updating
the perlreguts documentation, so I figured I might as well clean it up
at the same time.
Yves Orton [Wed, 16 Feb 2022 02:49:52 +0000 (03:49 +0100)]
regcomp.c: disambiguate "parse_start" and related var names
This was originally done to make the cleanup of the offsets debug logic
easier to follow and understand. 'parse_start' was heavily used in
multiple functions, and given the size of the functions in regcomp.c
it was often not clear which parse_start was which. 'oregcomp_parse'
was also used in a similar way.
This patch disambiguates them all so they are all uniquely named
and relevant to the code they operate on and of the form
"thing_parse_start", (or "thing_parse_start_const" where both were in
use).
Yves Orton [Fri, 11 Feb 2022 05:30:45 +0000 (06:30 +0100)]
regcomp.c,re.pm: Remove "offsets" debugging code
This code was added by Mark Jason Dominus to aid a regex debugger
he wrote for ActiveState. The basic premise is that every opcode
in a regex can be attributed back to a contiguous sequence of characters
that make up the pattern. This assumption has not been true ever since
the "jump" TRIE optimizations were added to the engine.
I spoke to MJD many years ago about whether it was ok to remove this
from the regex engine and he said he had no objections.
An example of a pattern that cannot be handled correctly by this logic is
/(?: a x+ | b y+ | c z+ )/x
where the
(?:a ... | b ... | c ...)
parts will now be handled by the TRIE logic and not by the BRANCH/EXACT
opcodes that it would have been in the past. The offset debug output
cannot handle this type of transformation, and produce nonsense output
that mention opcodes that have been optimized away from the final program.
The regex compiler is complicated enough without having to maintain this
logic. There are essentially no tests for it, and the few tests that do
cover it do so as a byproduct of testing other things. Despite the offsets
logic only being used in debug supporting it does have a cost to non-debug
logic as various internal routines include parameters related to it that
are otherwise unused.
Note this output is only usable or visible by enabling special flags
in re.pm, there is no formal API to access it short of parsing the
output of the debug mode of the regex engine, which has changed multiple
time over the past years.
Yves Orton [Wed, 16 Feb 2022 02:53:38 +0000 (03:53 +0100)]
perlreguts.pod: synchronize regexp_internal docs with code
Various changes have been made to struct regexp_internal over
time which have not been documented. This updates the docs to
match the code as it is now in preparation of changing the docs
in subsequent commits.
Ricardo Signes [Fri, 18 Feb 2022 14:48:57 +0000 (09:48 -0500)]
release schedule: update the road to v5.36
Christopher Yeleighton [Thu, 30 Dec 2021 01:06:38 +0000 (02:06 +0100)]
Document Hash::Util::hash_value($string, $seed)
Returns the hash value as if computed with a different seed.
Karl Williamson [Fri, 18 Feb 2022 01:18:37 +0000 (18:18 -0700)]
Christopher Yeleighton is a Perl author
James Raspass [Tue, 25 Jan 2022 10:35:38 +0000 (10:35 +0000)]
Tie::SubstrHash - Add strict & warnings
James Raspass [Tue, 25 Jan 2022 10:34:52 +0000 (10:34 +0000)]
Tie::SubstrHash - Replace sub ceil with builtin::ceil
James Raspass [Tue, 25 Jan 2022 10:30:51 +0000 (10:30 +0000)]
Tie::SubstrHash - Consistently deref with the arrow op
James Raspass [Tue, 25 Jan 2022 11:04:22 +0000 (11:04 +0000)]
Tie::SubstrHash - Use ||= and //=
James Raspass [Tue, 25 Jan 2022 10:15:25 +0000 (10:15 +0000)]
Tie::SubstrHash - Replace tabs with spaces
Karl Williamson [Thu, 17 Feb 2022 02:23:35 +0000 (19:23 -0700)]
podcheck: Make sure digest gets a byte string
Digest only accepts bytes; this makes sure it doesn't get UTF-8 encoded
characters.
Karl Williamson [Thu, 17 Feb 2022 02:21:09 +0000 (19:21 -0700)]
Add link to String::Util to podcheck db
Karl Williamson [Thu, 17 Feb 2022 02:21:47 +0000 (19:21 -0700)]
perlrecharclass: Update Unicode version reference
The list is still valid in the current Unicode version, which is much
later than the one listed as it being valid for. This could have caused
concern that it was out-dated.
Yves Orton [Wed, 16 Feb 2022 09:20:05 +0000 (10:20 +0100)]
Porting/GitUtils.pm: add missing package declaration
TAKAI Kousuke [Thu, 13 Jan 2022 17:00:33 +0000 (02:00 +0900)]
POSIX.pod: wording fix in the description of testing NaN-ness
Equality operators test equality, not equivalence.
TAKAI Kousuke [Thu, 13 Jan 2022 16:48:24 +0000 (01:48 +0900)]
POSIX.pod: add link and small example for the description for NaN-ness test
TAKAI Kousuke [Thu, 13 Jan 2022 16:05:53 +0000 (01:05 +0900)]
POSIX.pod: NaN-ness should be able to be tested by "=="
A note in the description of "isnan" used to say that NaN-ness
cannot be tested with equality operator, but it should be possible.
Dave Cross [Mon, 24 Jan 2022 17:11:50 +0000 (17:11 +0000)]
lib/sigtrap.pm: Documentation improvements
As suggested by GW Haywood. See
https://www.nntp.perl.org/group/perl.perl5.porters/2022/01/msg262533.html
For: https://github.com/Perl/perl5/pull/19365
zhmylove [Tue, 15 Feb 2022 15:11:03 +0000 (18:11 +0300)]
perlop.pod: Fix typo in smartmatch example
Committer: Sergey Zhmylove is now a Perl author
For: https://github.com/Perl/perl5/pull/19422
Tomasz Konojacki [Tue, 15 Feb 2022 17:24:31 +0000 (18:24 +0100)]
revert to windows-2019 in GitHub Actions (for now)
It seems the changes in windows-latest (windows-2022) image broke our
builds.
Paul "LeoNerd" Evans [Mon, 7 Feb 2022 18:08:19 +0000 (18:08 +0000)]
Add 'isa' to 'use feature :5.35'
Paul "LeoNerd" Evans [Mon, 7 Feb 2022 17:26:13 +0000 (17:26 +0000)]
No longer print experimental::isa warning (closes #18754)
Karl Williamson [Sat, 12 Feb 2022 19:43:00 +0000 (12:43 -0700)]
toke.c: Add a couple const to decls
Karl Williamson [Sat, 12 Feb 2022 19:41:16 +0000 (12:41 -0700)]
parser.h: add to comments
Karl Williamson [Mon, 14 Feb 2022 23:53:47 +0000 (16:53 -0700)]
toke.c: I32 considered harmful; change to 'int'
Dagfinn Ilmari Mannsåker [Mon, 14 Feb 2022 21:50:25 +0000 (21:50 +0000)]
Mark feature.h and lib/feature.pm as generated
David Cantrell [Wed, 2 Feb 2022 13:08:00 +0000 (13:08 +0000)]
fix looking up letters by their name only so that we search scripts
in the order the user asked for
David Cantrell [Wed, 2 Feb 2022 13:07:11 +0000 (13:07 +0000)]
add tests that when we import more than one script, we look for
letters in those scripts in the specified order
David Cantrell [Thu, 27 Jan 2022 09:00:34 +0000 (09:00 +0000)]
bump $VERSION
David Cantrell [Wed, 26 Jan 2022 23:34:09 +0000 (23:34 +0000)]
detect and warn when the user asks for short names for multiple
charsets which have letters with the same name
David Cantrell [Wed, 26 Jan 2022 23:33:45 +0000 (23:33 +0000)]
tests to detect when the user asks for short names for multiple
charsets which have letters with the same name
Hugo van der Sanden [Sun, 13 Feb 2022 15:01:33 +0000 (15:01 +0000)]
Sort tests in t/porting/dual-life.t
This give a non-obvious order, since we're sorting on the location of the
distribution rather than the installation location mentioned in the test
legend, but at least it will be consistent (at a given commit) rather
than dependent on directory order.
Paul "LeoNerd" Evans [Mon, 7 Feb 2022 16:10:50 +0000 (16:10 +0000)]
Might as well just do numerical comparisons against shortver rather than creating new temporary "version" objects
Paul "LeoNerd" Evans [Mon, 7 Feb 2022 16:35:43 +0000 (16:35 +0000)]
Add to perldeprecation.pod
Paul "LeoNerd" Evans [Mon, 7 Feb 2022 19:01:30 +0000 (19:01 +0000)]
Add to perldelta.pod
Paul "LeoNerd" Evans [Sat, 5 Feb 2022 02:20:13 +0000 (02:20 +0000)]
Print a deprecation warning if downgrading to a use VERSION below v5.11
Paul "LeoNerd" Evans [Sat, 5 Feb 2022 02:05:56 +0000 (02:05 +0000)]
Add a PL_prevailing_version interpreter var
Save/restore PL_prevailing_version at SAVEHINTS time
Have PL_prevailing_version track the applied use VERSION currently in scope
TAKAI Kousuke [Sat, 12 Feb 2022 05:18:44 +0000 (14:18 +0900)]
Add tests for string "-Inf" to IV conversion.
While a numeric -Inf is treated as IV_MIN in IV context (such as
operands for bitwise operators under "use integer"), string "-Inf"
used to yield some random (zero, or previously assigned) value in
such context.
TAKAI Kousuke [Wed, 9 Feb 2022 13:42:56 +0000 (22:42 +0900)]
sv.c: String "Inf" is now consistently converted to IV/UV
S_sv_2iuv_common() used to fail to set IV/UV slot on direct conversion
from string "Inf" to IV/UV, so such conversion would return garbage on
the memory. Now it will return the same result with two-staged
conversions, string to NV first and then NV to IV/UV.
Karl Williamson [Thu, 10 Feb 2022 20:40:05 +0000 (13:40 -0700)]
t/porting/diag.t: Fix typo in comment
Paul "LeoNerd" Evans [Tue, 8 Feb 2022 17:06:03 +0000 (17:06 +0000)]
Document that $^S is 1 inside a try block
Dagfinn Ilmari Mannsåker [Mon, 7 Feb 2022 18:11:17 +0000 (18:11 +0000)]
Update perldiag and perldeprecation for features removed in 5.30
Remove the perldiag entry for `my` in false conditional, and change
the perldiag entries to past tense.
Also correct the description of what actually happened to
`File::Glob::glob()`.
Dagfinn Ilmari Mannsåker [Mon, 7 Feb 2022 18:18:05 +0000 (18:18 +0000)]
Mark lib/warnings.pm and warnings.h as generated
Karl Williamson [Wed, 2 Feb 2022 03:17:59 +0000 (20:17 -0700)]
Update perlhactips for bool changes
This changes this doc to reflect the changes in the past few commits
Karl Williamson [Wed, 2 Feb 2022 03:05:49 +0000 (20:05 -0700)]
Simplify cBOOL defn
This existed because there wasn't a compiler bool necessarily, and
made complicated to workaround a bug in an AIX compiler as of 2010-ish.
Now that C99 is required, there always is a bool type; we don't know if
the bug existed in a C99 mode for the broken compiler, and sufficient
time has passed that it should have been fixed nonetheless.
This was tested on
IBM XL C/C++ for AIX, V12.1 (5765-J02, 5725-C72)
Version: 12.01.0000.0012
which dates to about 2012.
Karl Williamson [Wed, 2 Feb 2022 03:03:46 +0000 (20:03 -0700)]
Remove HAS_BOOL
This is no longer used in core. It occurs twice in metacpan, both to
define it so as to fool core into thinking it is there; hence it isn't
actually used at all in cpan.
Karl Williamson [Wed, 2 Feb 2022 02:50:45 +0000 (19:50 -0700)]
Remove PERL_BOOL_AS_CHAR uses; always define HAS_BOOL
Now that C99 is required, bool is always defined, so HAS_BOOL should
also always be defined.
PERL_BOOL_AS_CHAR was used to workaround problems when no bool type
existed, so it is obsolete, and in fact perl won't compile if
PERL_BOOL_AS_CHAR is #defined. So remove it completely from being
looked at.
Branislav Zahradník [Thu, 23 Dec 2021 22:27:18 +0000 (23:27 +0100)]
Use `optexpr` in anonymous to reduce number of symbols
Branislav Zahradník [Thu, 23 Dec 2021 22:25:49 +0000 (23:25 +0100)]
Unify optional rules
- start with `opt` (renamed `siglistornull`)
- employ bison's default rule whenever possible
Branislav Zahradník [Thu, 23 Dec 2021 22:24:52 +0000 (23:24 +0100)]
Introduce rule `empty` returning NULL
to save few keystrokes ...
Branislav Zahradník [Thu, 23 Dec 2021 22:24:09 +0000 (23:24 +0100)]
Gather all MY variants into single rule
Branislav Zahradník [Thu, 23 Dec 2021 22:20:01 +0000 (23:20 +0100)]
Favour switch over if/else if to improve readability
Branislav Zahradník [Thu, 23 Dec 2021 22:19:43 +0000 (23:19 +0100)]
Cleanup remnants after distinguising C- and perly- literals
Paul "LeoNerd" Evans [Sat, 5 Feb 2022 13:43:43 +0000 (13:43 +0000)]
Expansions of PERLVAR* in intrpvar.h should not end in semicolons
Tomasz Konojacki [Fri, 4 Feb 2022 17:18:08 +0000 (18:18 +0100)]
make autodoc.pl and makedef.pl understand the I embed.fnc flag
It's needed in case a publicly visible PERL_STATIC_FORCE_INLINE
function is added.
Paul "LeoNerd" Evans [Thu, 3 Feb 2022 17:17:46 +0000 (17:17 +0000)]
embedvar.h is a generated file
Hugo van der Sanden [Thu, 3 Feb 2022 02:26:07 +0000 (02:26 +0000)]
Augment overload::Method docs
Karl Williamson [Sat, 22 Jan 2022 21:41:27 +0000 (14:41 -0700)]
toke.c: Fix potential C sign error
Taking (UV)(* char) isn't what was meant. Instead it should be
(UV) * (U8 *)(char).
(and the UV cast becomes irrelevant in this case).
If the C compiler defaults char to unsigned, it doesn't matter. Nor
does it matter if the char value is positive. But it gives the wrong
result when 'char' means 'signed char' and the value is negative.
Experimentally adding non-ASCII brackets to this code showed up this
error.
Karl Williamson [Thu, 13 May 2021 14:50:23 +0000 (08:50 -0600)]
Refactor utf8 to code point conversion
Most such conversions occur in the inlined function
Perl_utf8n_to_uvchr_msgs(), which several macros like utf8n_to_uvchr()
expand to.
This commit effectively removes a conditional from inside the loop, and
avoids some conditionals when converting the common case of the input
being UTF-8 invariant (ASCII on ASCII platforms).
Prior to this commit, the code did something different the first time
through the loop than the other times. By hoisting that to pre-loop
initialization, that conditional is removed from each iteration. That
meant rearranging the loop to be a while(1), and have its exit
conditions in the middle.
All calls to this function from the Perl core pass in a non-empty
string. But outside calls could conceivably pass an empty one which
could lead to reading outside the buffer. An extra check is added to
non-core calls, as is already done elsewhere.
This change means that calls from core execute no more conditionals than
the typical:
if (UTF8_IS_INVARIANT(*s)) {
code_point = *s;
}
else {
code_point = utf8n_to_uvchr(s, ...)
}
I'm therefore thinking these can now just be replaced by the simpler
code_point = utf8n_to_uvchr(s, ...)
without a noticeable hit in performance. The essential difference is
that the former gets its code point from the string already being
examined, and the latter looks up data in a 450 byte static array that
is referred to constantly, so is likely to be cached.