This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Karl Williamson [Sat, 1 Oct 2022 19:43:54 +0000 (13:43 -0600)]
locale.c: Compile display fcn under more circumstances
This is in preparation for it to be used in more instances in future
commits. It uses a symbol that won't be defined until those commits.
Karl Williamson [Mon, 3 Oct 2022 14:33:55 +0000 (08:33 -0600)]
locale: Create special variable to hold current LC_ALL
Some configurations require us to store the current locale for each
category. Prior to this commit, this was done in the array
PL_curlocales, with the entry for LC_ALL being in the highest element.
Future commits will need just the value for LC_ALL in some other
configurations, without needing the rest of the array. This commit
splits off the LC_ALL element into its own per-interpreter variable to
accommodate those. It always had to have special handling anyway beyond
the rest of the array elements,
Karl Williamson [Mon, 3 Oct 2022 00:30:44 +0000 (18:30 -0600)]
Clean up perl.h/makedef.pl common logic
This has gotten two twisty little mazy over time. Clean it up, add
comments, and make sure the logic is the same on both.
Karl Williamson [Sat, 1 Oct 2022 17:20:04 +0000 (11:20 -0600)]
Don't #define USE_THREAD_SAFE LOCALE unless threaded
If there aren't threads, yes locales are trivially thread-safe, but
the code that gets executed to make them so doesn't need to get
compiled, and that is controlled by this #define.
Karl Williamson [Thu, 29 Sep 2022 18:33:21 +0000 (12:33 -0600)]
sv.c: Set phase to CONSTRUCT on interpreter being cloned
So far this hadn't been an issue, but it will be for a future commit.
Karl Williamson [Tue, 27 Sep 2022 21:51:16 +0000 (15:51 -0600)]
sv.c: Clone interpreter with locale set to C
A thread is supposed to start with the locale set to the C locale. We
were duping the parent values, and later overriding. Better to set to C
from the beginning.
Karl Williamson [Tue, 27 Sep 2022 19:53:08 +0000 (13:53 -0600)]
sv.c: Move some code; consolidate
This moves the code for cloning the locale variables to a single place,
consolidating some that had the same cpp directives. It showed that one
variable was cloned twice; the redundant one is now removed.
Tony Cook [Mon, 17 Oct 2022 23:01:20 +0000 (10:01 +1100)]
perldelta for
b0bc598140d48
Tony Cook [Thu, 25 Aug 2022 06:02:25 +0000 (16:02 +1000)]
handle intermediate pads not including the name in find_lexical_cv()
In the following each line is the pad for a scope, starting from
the outermost scope.
In non-eval cases a use of a lexical symbol in an inner pad
also adds that name to the pad in the intermediate scope. So for
code like:
my $bar;
sub foo { ... }
sub f { sub g { foo($bar) } }
we might get pads like:
[&foo] [$bar] # defining pad
[&foo] [$bar] # intermediate pad (for f)
[&foo] [$bar] # using pad (for g)
and each inner pad has an index of the same name in the parent
scope. find_lexical_cv() followed that chain of indexes to find
the definition, or at least the prototype, of the lexical sub.
Unfortunately names can only be added to the pad at compile-time,
so for an eval the intermediate scope is closed to further
modifications, and the pad for the intermediate scope doesn't
get an entry for the name, so code like:
my $bar;
sub foo { ... }
sub f { eval 'foo($bar)' }
we get pads like:
[&foo] [$bar] # defining pad
# intermediate pad (f) doesn't have the names
[&foo] [$bar] # eval 'foo($bar)' pad
but find_lexical_cv() assumed that the names would always exist
in the intermediate pads, and failed an assertion.
find_lexical_cv() now falls back to searching for the cv by name
up the chain of nested pads.
This doesn't fix a slightly related problem:
my sub foo { }
BEGIN {
foo(); # Undefined subroutine &foo
}
The fix for that may make find_lexical_cv() unnecessary, but is a
more complex fix.
Nicolas R [Fri, 14 Oct 2022 21:03:19 +0000 (15:03 -0600)]
Avoid excess flood from IRC notifications workflow
The IRC github workflow fails unexpectedly from time
to time. We should enforce a size limit to the message
we send (Some recent commit messages can be pretty
long).
Shorten Pull Requests title and body for IRC bot.
The default timeout is 6 hours which is much longer
than needed to parse the git commits and submit
a few IRC notifications if needed.
Adding a timeout to the job should avoid long stall runs.
We do not want the irc workflow to spoil resources and
prefer using it for running unit tests.
Use consistent heredoc token 'EOS' to setup variables.
Paul "LeoNerd" Evans [Sat, 15 Oct 2022 16:49:18 +0000 (17:49 +0100)]
Don't set OPf_REF on OP_ANONCODE during op_lvalue()
Doing so will upset XS code that manually builds optrees using OP_REFGEN
+ OP_ANONCODE (as would be required prior to perl 5.37.3), causing a
double-reference to be generated.
(Fixes https://github.com/Perl/perl5/issues/20384 )
Dan Book [Mon, 17 Oct 2022 02:12:47 +0000 (22:12 -0400)]
perlsub - replace uses of $a and $b in examples
replace $a and $b in examples to avoid recommending their use, since they aren't treated as normal variables by strict.
also replace $c and $d when used in the same examples so it looks consistent.
Tony Cook [Mon, 17 Oct 2022 00:28:56 +0000 (11:28 +1100)]
perldelta for
e2d2ca12ad65
Tony Cook [Wed, 21 Sep 2022 23:41:36 +0000 (09:41 +1000)]
end of file (^D on POSIX-likes) now behaves like q as documented
This was originally reported againt 5.36.0 where ^D would act
more like 'n' than 'q':
$ ~/perl/v5.36.0-clang14/bin/perl -lde 'print 1; print 2; print 3;'
Loading DB routines from perl5db.pl version 1.73
Editor support available.
Enter h or 'h h' for help, or 'man perldebug' for more help.
main::(-e:1): print 1; print 2; print 3;
DB<1> 1
main::(-e:1): print 1; print 2; print 3;
DB<1> 2
main::(-e:1): print 1; print 2; print 3;
DB<1> 3
(^D at each prompt)
Post
80c1f1e4 this behaved a little differently, since reading ^D
from the stream now sets the eof() flag readline() would return
immediately after each attempt, instead of reading a command.
This produced the same output as above, but only required a single ^D.
But neither of these is correct, both 'q' and ^D are documented to
exit the debugger, and 'q' does that, this changes eof to also
exit the debugger.
Unfortunately the perl5db test infrastructure doesn't support
testing this, and due to the way the debugger interacts with the
terminal, I don't think this is easily tested in core. I think
a module like Expect or IPC::Run that can interact with a terminal
would be needed.
Karl Williamson [Sun, 9 Oct 2022 19:21:04 +0000 (13:21 -0600)]
locale.c: Silence unused var warning on freebsd
This just moves some code out of #ifdefs so that the compiler sees
it, decides it is always false, and almost certainly won't generate any
code for it, but stops warning.
Karl Williamson [Wed, 12 Oct 2022 12:42:25 +0000 (06:42 -0600)]
locale.c: Fix Debug statement on netbsd
Other platforms declare the nl_item typedef an int, but this one makes
it a long. To portably output its value, cast it to a long and use the
%ld format.
TAKAI Kousuke [Wed, 5 Oct 2022 14:34:18 +0000 (23:34 +0900)]
Use `LINE_Tf` for formatting line numbers
TAKAI Kousuke [Wed, 5 Oct 2022 14:04:17 +0000 (23:04 +0900)]
toke.c: Use `line_t` (rather than `I32`) to hold the value of `CopLINE()`
TAKAI Kousuke [Tue, 4 Oct 2022 14:58:33 +0000 (23:58 +0900)]
Use `LINE_Tf` thoroughly for formatting the value of CopLINE()
The value of CopLINE() used to be formatted with various way; sometimes
with `%ld` and `(long)` cast, sometimes `IVdf` and `(IV)` cast, or `%d`
and so on.
TAKAI Kousuke [Wed, 28 Sep 2022 13:15:49 +0000 (22:15 +0900)]
locale.c: Add explicit (line_t) cast to silence DEBUGGING build warnings
Warning fixed:
locale.c:130:55: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 4 has type ‘int’ [-Wformat=]
130 | dSAVE_ERRNO; dTHX; PerlIO_printf(Perl_debug_log, "\n%s: %" LINE_Tf ": ", \
| ^~~~~~~~~
This warning might be only on 32-bit build.
Bram [Thu, 15 Sep 2022 19:28:20 +0000 (21:28 +0200)]
Extend testsuite.yml to 'select' which jobs to run
For the Perl/perl5 repository nothing changes.
For a fork of perl5 the user now has some more control to select which
jobs to run. This is done by setting the appropriate secrets.
Before this commit one could choose to:
- run no tests (= GitHub Actions disabled)
- run 'Sanity Check' (= GitHub Actions enabled)
- run all jobs (= GitHub Actions enabled + EXTENDED_TESTING secret added)
With this commit specific jobs can be enabled by adding a secret
with a true value.
For example: setting `CI_FORCE_CYGWIN=1` in the Secrets will cause it to
run the 'Sanity Check' job and the Cygwin' job. All other jobs are skipped.
(See the docs in the file to see the full list of Secrets)
Bram [Thu, 15 Sep 2022 19:26:14 +0000 (21:26 +0200)]
testsuite.yml: Check for false value
Extend the 'EXTENDED_TESTING' check to differentiate between a true
and a false value.
With the original check: setting 'EXTENDED_TESTING' to 0 would cause
all jobs to be run which is not very logical. The only way to disable
it is/was to completely remove the 'EXTENDED_TESTING' secret.
With this commit it can be disabled by setting 'EXTENDED_TESTING' to '0'
(or '
00000000' or ' ' or ' 0 0 0000 00 ' or ...)
Bram [Thu, 15 Sep 2022 19:25:37 +0000 (21:25 +0200)]
testsuite.yml: Split "run_all_jobs" logic
This is in preparation of the next commit which will alter
the `[[ -n "${EXTENDED_TESTING}" ]]` condition.
Bram [Thu, 15 Sep 2022 19:25:22 +0000 (21:25 +0200)]
Add some docs for workflow/testsuite.yml
Bram [Thu, 15 Sep 2022 19:23:45 +0000 (21:23 +0200)]
Use cancelled() instead of always()
The use of `always()` made it impossible to cancel the workflow.
From https://docs.github.com/en/actions/managing-workflow-runs/canceling-a-workflow :
To cancel the workflow run, the server re-evaluates if conditions for all
currently running jobs. If the condition evaluates to true, the job will
not get canceled. For example, the condition if: always() would evaluate
to true and the job continues to run.
-> Replace `always()` with `! cancelled()`
Bram [Thu, 15 Sep 2022 19:22:43 +0000 (21:22 +0200)]
Also run 'dist-modules' when porting test fails
This to make it similar to all other jobs: when (only) the porting
test fails then all other jobs should still run.
Peter John Acklam [Fri, 19 Aug 2022 18:53:44 +0000 (20:53 +0200)]
Math-Complex: list all imported constants in POD
The constant 'pi4' (= 4*pi) is imported, but is missing from the list of
imported constants in the SYNOPSIS.
This fixes CPAN RT #102544
For: https://github.com/Perl/perl5/pull/20120
Kenichi Ishigaki [Mon, 10 Oct 2022 21:51:39 +0000 (21:51 +0000)]
JSON::PP: Synch with CPAN version 4.12
From Changes: Call unimport overload first to silence warnings.
(https://github.com/makamaka/JSON-PP/issues/76, haarg++)
Committer: To keep 'make test_porting' happy, run:
cd t; ./perl porting/regen.t; cd -
./perl -Ilib Porting/makemeta -j
Karl Williamson [Sat, 8 Oct 2022 12:49:01 +0000 (06:49 -0600)]
handy.h: Set macro to false if can't ever be true
It's unlikely that perl will be compiled with out the LC_CTYPE locale
category being enabled. But if it isn't, there is no sense in having
per-interpreter variables for various conditions in it, and no sense
having code that tests those variables.
This commit changes a macro to always yield 'false' when this is
disabled, adds a new similar macro, and changes some occurrences that
test for a variable to use the macros instead of the variables. That
way the compiler knows these to conditions can never be true.
Karl Williamson [Sat, 8 Oct 2022 17:11:15 +0000 (11:11 -0600)]
makedef.pl Skip PL_in_utf8_COLLATE_locale if no LC_COLLATE
This fixes #20371
Karl Williamson [Wed, 5 Oct 2022 02:39:06 +0000 (20:39 -0600)]
locale.c: Add comments/white space; slight tidying
C99 allows declarations to be closer to their first use. This also
removes a redundant conditional that would set a variable to what it
already was initialized to.
Karl Williamson [Thu, 6 Oct 2022 15:12:59 +0000 (09:12 -0600)]
locale.c: Make win32_setlocale return const *
Add a bit of safety, and makes it correspond to the other setlocale
returns we use.
Karl Williamson [Tue, 4 Oct 2022 16:58:16 +0000 (10:58 -0600)]
Add some const to wrap_wsetlocale
And move declarations closer to first use as allowed in C99
Karl Williamson [Tue, 4 Oct 2022 11:04:32 +0000 (05:04 -0600)]
locale.c: Generalize static functions
This changes these functions to take the code page as input, instead of
being just UTF-8. Macros are created to call them with UTF-8.
I'm doing this because there is no loss of efficiency, and it is
somewhat jarring, given Perl terminology, to call a function with 'Byte'
in the name with a parameter with 'utf8' in the name.
Karl Williamson [Tue, 4 Oct 2022 10:49:47 +0000 (04:49 -0600)]
locale.c: Make static 2 Win-only functions
These are non-API, used in this file, and because of #ifdefs, not
accessible outside it, so there is no current need to make them publicly
available. If we were ever to need them to be accessible more widely,
they would not belong in this file.
Karl Williamson [Wed, 5 Oct 2022 02:43:30 +0000 (20:43 -0600)]
locale.c: Remove unused cpp alternatives
The wide setlocale function in Windows has been in the field since 5.32,
long enough, that we won't be forced to discontinue its use. So can
remove the never-used overrides, cleaning it up slightly
Karl Williamson [Wed, 5 Oct 2022 02:32:38 +0000 (20:32 -0600)]
locale.c: Windows special case NULL input first
This gets the trivial case out of the way, and can use plain setlocale,
as the locale string is non-existent, so doesn't need to handle
different character sets.
Karl Williamson [Thu, 6 Oct 2022 13:46:43 +0000 (07:46 -0600)]
locale.c: Allow function to have side effects
The previous commit changed find_locale_from_environment() to work on
Windows, and took care to not make the function have side effects. But
in the only use of this function so far (and likely forever), those side
effects are fine. Changing to allow them simplifies things.
Karl Williamson [Thu, 6 Oct 2022 13:39:22 +0000 (07:39 -0600)]
locale.c: Meld two functions into one
There is code in locale.c to emulate POSIX 'setlocale(foo, "")'. And
there is separate code to emulate this on Windows. This commit
collapses them, ensuring the same algorithm is used on both systems.
Karl Williamson [Wed, 5 Oct 2022 15:46:25 +0000 (09:46 -0600)]
locale.c: Refactor S_find_locale_from_environment()
This changes this function a bit to make the next commit easier, which
will extend the function to being usable from Windows. This also moves
declarations closer to first use, as now allowed in C99.
Karl Williamson [Wed, 5 Oct 2022 12:35:19 +0000 (06:35 -0600)]
locale.c: Move find_locale_from_environment() in file
This is in preparation for this function to be used under more
circumstances.
Karl Williamson [Wed, 5 Oct 2022 02:39:02 +0000 (20:39 -0600)]
Add wrap_wsetlocale() to embed.fnc
This makes the calls to it cleaner.
Tony Cook [Sun, 9 Oct 2022 21:58:16 +0000 (08:58 +1100)]
Felipe Gasper [Mon, 12 Sep 2022 12:58:00 +0000 (08:58 -0400)]
Compile anonymous subs as anoncode without srefgen.
Heretofore the compiler represented an anonymous subroutine as an
anoncode op then an srefgen op; the latter’s only purpose was to
return a reference to the anoncode’s returned CV.
This changeset slightly optimizes that by making pp_anoncode return
a reference if so bidden. The same optimization is applied to
pp_anonconst as well.
Deparse.pm is updated accordingly.
Felipe Gasper [Mon, 12 Sep 2022 15:41:08 +0000 (11:41 -0400)]
Add anonconst test to Deparse.t
Karl Williamson [Thu, 29 Sep 2022 12:12:58 +0000 (06:12 -0600)]
Allow non-ASCII locale names
Locale names are supposed to be opaque to the calling program. The
only requirement is that any name output by libc means the same as input
to that libc. And it makes sense, you might very well want to have a
locale name in your native language. This commit changes locale.c to
not impose any restrictions on the name proper. (It should be noted,
however, other Standards have come along that specify a particular
syntax using only ASCII. Perl needn't, and shouldn't, impose those
further restrictions.)
Karl Williamson [Sun, 2 Oct 2022 13:38:56 +0000 (07:38 -0600)]
locale.c: Display thread in DEBUG statements
This makes it easier to understand what's going on in threaded perls.
Nathan Mills [Tue, 4 Oct 2022 03:28:23 +0000 (20:28 -0700)]
Nathan Mills is now a Perl author
Nathan Mills [Mon, 19 Sep 2022 01:02:50 +0000 (18:02 -0700)]
pp_pack: Suppress Cppcheck warning.
Cppcheck warns about assigning the address of a stack variable to a
function parameter. This is harmless because symptr->previous is
reassigned after the recursive call to (un)pack_rec by the copying of
savsym/lookahead to the struct pointed to by symptr.
Fixes #20180.
Elvin Aslanov [Mon, 3 Oct 2022 15:29:44 +0000 (19:29 +0400)]
[doc] perlnewmod: Move links from HTTP to HTTPS
Convert links to MetaCPAN, PAUSE, and CPAN to HTTPS.
They will redirect anyway.
Paul "LeoNerd" Evans [Fri, 30 Sep 2022 16:19:45 +0000 (17:19 +0100)]
Add comments to perly.y to explain token ordering
Explains why KW_PACKAGE and KW_USE_or_NO appear to have the package name
and version barewords in the wrong order.
Karl Williamson [Sun, 2 Oct 2022 18:00:06 +0000 (12:00 -0600)]
locale.c: Fix syntax error (only when no LC_ALL)
Karl Williamson [Sun, 2 Oct 2022 18:50:01 +0000 (12:50 -0600)]
Certain LC_CTYPE variables need to always exist
Commit
b41c5839100237b5ac56296e146374b69a8ee83a moved some
per-interpreter variables to within an #ifdef. I thought I had tested
it agains all reasonable combinations, but it turns out that they need
to be always defined (without further restructuring)
Karl Williamson [Mon, 12 Apr 2021 21:35:11 +0000 (15:35 -0600)]
intrpvar.h: Consolidate some defns into #ifdefs
This moves related definitions together
Karl Williamson [Mon, 12 Apr 2021 21:32:02 +0000 (15:32 -0600)]
intrpvar.h: White space only
Karl Williamson [Sun, 2 Oct 2022 14:21:40 +0000 (08:21 -0600)]
perl.h: Rmv nested STMT_START...END
The outer pair is all that is necessary.
Karl Williamson [Fri, 30 Sep 2022 16:19:35 +0000 (10:19 -0600)]
locale.c: Remove obsolete, unused label
Peter John Acklam [Fri, 19 Aug 2022 18:32:43 +0000 (20:32 +0200)]
Math-Complex: fix syntax error in example
This fixes CPAN RT #131037
Committer: For https://github.com/Perl/perl5/pull/20122
Peter John Acklam [Thu, 1 Sep 2022 19:09:59 +0000 (21:09 +0200)]
Math-Complex: update URLs
Update the URLs with formulas for computing distance, bearing,
waypoints, destination etc. on a sphere.
This fixes CPAN RT #144195
Peter John Acklam [Sat, 1 Oct 2022 13:40:16 +0000 (13:40 +0000)]
fix typo (remove redundant 'an')
Committer: Substitute for: https://github.com/Perl/perl5/pull/20121/
Karl Williamson [Sat, 1 Oct 2022 03:28:19 +0000 (21:28 -0600)]
Move Math-Complex from cpan/ to dist/
This module is now being maintained by p5p now.
Karl Williamson [Thu, 2 Jun 2022 14:50:07 +0000 (08:50 -0600)]
RMG: Add step for deprecation/experimental resolution
Karl Williamson [Thu, 29 Sep 2022 16:17:51 +0000 (10:17 -0600)]
thread.h: White space only
Karl Williamson [Wed, 28 Sep 2022 20:03:49 +0000 (14:03 -0600)]
Add pTHX to thread_locale_(init|term)
A future commit will want the context for more than just DEBUGGING
builds.
Karl Williamson [Thu, 29 Sep 2022 19:10:49 +0000 (13:10 -0600)]
Merge branch 'Add mutexes' into blead
The vast majority of libc calls are thread-safe, but a substantial
number aren't, even ones claimed to be re-entrant. mbrlen(), for
example, may require both the locale and environment to remain unchanged
by other threads during its execution, or undefined behavior (like
segfaults) ensues. I went through the POSIX specification looking for
such calls, and also looked at likely suspects in my Ubuntu man pages.
It turns out that glibc violates POSIX in a few cases, allowing
thread-unsafe behavior even when the Standard prohibits it. A future
commit will change perlxs to include my findings. This series of commits
implements them by defining mutexes to prohibit concurrent execution of
multiple collaborating threads during critical sections. Like all
mutexes, code can simply not opt-in to using it, but this at least
causes all the perl core to conform. And the future perlxs changes will
document what XS code should do.
Another example is most time functions. tzset() is called behind the
scenes in many of them. It sets tzname[], which in many implementations
is a global variable. Thus, tzset() needs to be executed under control
of a mutex until tzname is safely copied to a per-interpreter variable.
And hence, asctime_r isn't really thread safe without a mutex
surrounding it.
On unthreaded perls, all these mutexes resolve to no-ops.
I certainly may have missed, in my search, items that should have
mutexes. Those can be added whenever any surfaces
Karl Williamson [Thu, 25 Mar 2021 13:02:34 +0000 (07:02 -0600)]
util.c: Add locks around strftime() calls
Karl Williamson [Thu, 11 Mar 2021 13:25:54 +0000 (06:25 -0700)]
POSIX.xs: Add some mutex locks
These are needed to prevent races on at least some platforms
Karl Williamson [Fri, 23 Sep 2022 00:43:23 +0000 (18:43 -0600)]
Add mutexes for various libc calls
There are various system calls used by perl that need to be protected by
a mutex in some configurations. This commit adds the ones not
previously added, for use in future commits. Further details are
in the merge commit message for this series of commits.
Karl Williamson [Sun, 29 Nov 2020 02:08:21 +0000 (19:08 -0700)]
os2: Use many reader lock instead of exclusive
This is just reading the environment, not changing it, so many readers
can be accessing it at the same time.
Karl Williamson [Sat, 13 Mar 2021 22:30:32 +0000 (15:30 -0700)]
util.c: mktime needs to run under a mutex
per the Posix standard
Karl Williamson [Sun, 6 Dec 2020 23:59:08 +0000 (16:59 -0700)]
win32.c: Add mutexes around some calls
These could have races.
Karl Williamson [Mon, 7 Dec 2020 00:16:16 +0000 (17:16 -0700)]
Add mutexes around calls in pp_sys.c
If there is no reentrant form of the function, these still won't be
thread safe, but doing that is better done in reentr.c. It is on my
TODO list.
Karl Williamson [Sun, 6 Dec 2020 23:58:05 +0000 (16:58 -0700)]
time64.c: Remove no longer needed code
This code defined some macros; those are now defined by perl.h
Karl Williamson [Tue, 1 Dec 2020 14:34:20 +0000 (07:34 -0700)]
perl.h: Finish implementing combo ENV/LOCALE mutexes
There are cases where an executing function is vulnerable to either the
locale or environment being changed by another thread. This commit
implements macros that use mutexes to protect these critical sections.
There are two cases that exist: one where the functions only read; and
one where they can also need exclusive control so that a competing
thread can't overwrite the returned static buffer before it is safely
copied.
5.32 had a placeholder for these, but didn't actually implement it.
Instead it locked just the ENV portion. On modern platforms with
thread-safe locales, the locale portion is a no-op anyway, so things
worked on them.
This new commit extends that safety to other platforms. This has long
been a vulnerability in Perl.
Karl Williamson [Tue, 8 Dec 2020 20:11:15 +0000 (13:11 -0700)]
perl.h: Move some statements
So they are closer to related statements
Karl Williamson [Sat, 13 Mar 2021 22:21:38 +0000 (15:21 -0700)]
Change ENV/LOCALE locking read macro names
The old name was confusing.
Karl Williamson [Sat, 13 Mar 2021 22:19:36 +0000 (15:19 -0700)]
Remove ENV_LOCALE_LOCK/UNLOCK macros
These are subsumed by gwENVr_LOCALEr_LOCK created in the previous
commit.
Karl Williamson [Mon, 5 Sep 2022 16:58:26 +0000 (10:58 -0600)]
perl.h: Add #define for gwENVr_LOCALEr_UNLOCK
This is for functions that read the locale and environment and write to
some global space.
Karl Williamson [Fri, 25 Dec 2020 03:25:00 +0000 (20:25 -0700)]
pp.c: Add mutex around a format
Stress testing showed this needed a mutex and copy in threaded perls.
TAKAI Kousuke [Thu, 29 Sep 2022 16:32:57 +0000 (01:32 +0900)]
cop.h: Fix return type in CopLINE()'s apidoc entry
CopLINE() actually returns `line_t` since a long time ago.
Karl Williamson [Mon, 12 Sep 2022 00:08:32 +0000 (18:08 -0600)]
locale.c: Revamp sync_locale(), switch_to_global_locale()
In reading this code, I realized that there were instances where the
functions didn't work properly. It is hard to test these, but a future
commit will do so.
Karl Williamson [Thu, 22 Sep 2022 10:34:24 +0000 (04:34 -0600)]
locale.c Change function to return a string, not print
This makes some print statements less awkward, and is more flexible,
which will be used in future commits
Karl Williamson [Sun, 18 Sep 2022 23:30:18 +0000 (17:30 -0600)]
locale.c: Save output of emulate_setlocale in buffer
Depending on Configuration and platform and details of the current
request, the value returned could be pointing to a system static buffer,
or be a temporary freeable upon LEAVE. This commit standardizes it to a
known per-interpreter buffer that can be properly freed at termination.
Karl Williamson [Mon, 26 Sep 2022 13:15:14 +0000 (07:15 -0600)]
locale.c: Teach save_to_buffer to handle self param
This function is called to save a string to a buffer. Teach it to treat
as a no-op the string passed being the buffer itself. This generalizes
it to make it work properly under more circumstances; the commit also
removes the current case where the function call was explicitly avoided
under this circumstance.
Karl Williamson [Wed, 28 Sep 2022 15:52:06 +0000 (09:52 -0600)]
mktables: flush output immediately when debugging
Helps disentangle mixed up output
Karl Williamson [Sat, 24 Sep 2022 12:10:34 +0000 (06:10 -0600)]
locale.c: Use synonym name for clarity
At this point we have two variables which we just set equal. Change
here to use the synonym that doesn't require looking elsewhere to
understand what's going on.
Bram [Sat, 17 Sep 2022 14:05:27 +0000 (16:05 +0200)]
Extend cmpVERSION.pl to check for modified .c/.h
When a .c or .h files is modified in ext/, cpan/, dist/ then check
if another file in that dist was bumped.
The inspiration for this extra check: sometimes a .c or .h file gets
modified without bumping a version number in any of the other files.
This then causes two things to report the same version number while
they are in fact somewhat different (assuming the .c/.h code is used).
This seems less optimal so add an extra check: if a .c/.h file is
modified then something in that dist should also have a version-bump.
Karl Williamson [Wed, 21 Sep 2022 13:05:03 +0000 (07:05 -0600)]
perlhacktips: Add section on writing safer macros
And remove the similar advice but which applied only to STMT_START {}
STMT_END
Unicode Consortium [Wed, 21 Sep 2022 11:21:00 +0000 (05:21 -0600)]
Support Unicode 15.0
Karl Williamson [Fri, 16 Sep 2022 13:55:20 +0000 (07:55 -0600)]
mktables: Skip some new 15.0 files
These are newly delivered by Unicode. I haven't had time to analyze
them for use for potential new properties. They deal with security
issues of characters that look alike.
I'm not adding them to the list of files under git, but they are
explicitly mentioned in mktables to indicate their not being used.
Karl Williamson [Fri, 16 Sep 2022 13:49:02 +0000 (07:49 -0600)]
mktables: Skip some code for Unicode 15
As it becomes obsolete
Karl Williamson [Fri, 16 Sep 2022 13:37:17 +0000 (07:37 -0600)]
mktables: Revise Version line search in inputs
Unicode 15.0 is revising the heading format for non-UCD files; Fix
mktables to be able to parse that.
Karl Williamson [Fri, 16 Sep 2022 12:24:39 +0000 (06:24 -0600)]
mktables: Accept multiple @missing lines in input files
Unicode 15.0 will now use this approach to deal with ranges of code
points that have a different default for unassigned code points than the
table at large. For example, a table may have one default, but all
Ideographic character ranges have something else. Prior to this new
mechanism, the files had entries for each unassigned code point that had
a different default than the global one. So this saves some lines in
the files that Unicode delivers that were otherwise useless.
Not all files in 15.0 have been converted to use the new scheme, for
whatever reason.
Karl Williamson [Fri, 16 Sep 2022 11:56:45 +0000 (05:56 -0600)]
mktables: Multi_Default now accepts multiple defaults per property
Unicode 15.0 may have multiple @missing lines for a single property,
that should use this class. This commit converts the storage into an
array to accommodate that need..
Karl Williamson [Fri, 16 Sep 2022 11:51:10 +0000 (05:51 -0600)]
mktables: Add two methods to Multi_Default class
These are so that you don't have to know everything at construction
time. The constructor function changes to call these with whatever it
does get passed
Karl Williamson [Fri, 16 Sep 2022 11:22:39 +0000 (05:22 -0600)]
mktables: More closely examine @missing lines
These lines have all had the same range (all of Unicode). But in
Unicode 15.0, there will be some with different ranges. This commit
changes to save those values (which are currently still unused)
Karl Williamson [Mon, 19 Sep 2022 19:16:05 +0000 (13:16 -0600)]
mktables: Standardize value aliases
As stated in the code comments added by this commit, Unicode has various
spellings for the same property value. For example in some places it
uses 'W', and in others 'Wide'. The legal spellings are listed in
PropValueAliases.txt, which is processed early in the construction. So
we can standardize things on input, which makes it easier later. This
commit produces minimal changes in the generated tables, so that the
algorithm can be verified by inspection of the results. And no other
code that has hard-coded in expected spellings needs to be changed.
Prior to this commit, we standardized the default value for properties
that have a default value,.
Karl Williamson [Wed, 21 Sep 2022 16:55:10 +0000 (10:55 -0600)]
mktables: Add/Fix comments, white-space
This includes indenting a block of code in anticipation of a future
commit which will form a conditional block around it
Karl Williamson [Wed, 21 Sep 2022 03:43:57 +0000 (21:43 -0600)]
mktables: Use intermed variable to shorten name
This changes an inside-out hash reference to have a shorthand for it,
making for better readability
Karl Williamson [Wed, 21 Sep 2022 03:41:13 +0000 (21:41 -0600)]
mktables: Convert array to hash
Prior to this commit we had a two element array, and it was known that
element 0 contained a particular thing; and element 1 contained the
other. But a future commit will add several elements, so keeping track
of which is which will become more problematic. Solve this by using a
hash instead, with the elements appropriately named.