This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perl5.git
23 months agohide private functions with __attribute__((visibility("hidden")))
Tomasz Konojacki [Sat, 18 Jun 2022 05:26:58 +0000 (07:26 +0200)]
hide private functions with __attribute__((visibility("hidden")))

This allows us to enforce API boundaries and potentially enables
compiler optimisations.

We've been always hiding non-public symbols on Windows. This commit
brings that to the other platforms.

23 months agot/porting/libperl.t: don't check for non-public symbols
Tomasz Konojacki [Sat, 18 Jun 2022 05:26:58 +0000 (07:26 +0200)]
t/porting/libperl.t: don't check for non-public symbols

Both Perl_peep and Perl_pp_uc are private. Check for Perl_croak instead;
it's a part of the public API.

23 months agodefine POSIX:: constants from limits.h when building with mingw
Sidney Markowitz [Thu, 16 Jun 2022 00:14:56 +0000 (12:14 +1200)]
define POSIX:: constants from limits.h when building with mingw

23 months agoautodoc.pl: s/guts/intern/ (mostly)
Karl Williamson [Fri, 27 May 2022 11:15:58 +0000 (05:15 -0600)]
autodoc.pl: s/guts/intern/ (mostly)

The terms 'guts' and 'intern' are conflated in this file prior to this
commit.  perlguts and perlintern are separate entties.

23 months agoperlapi: Document ASCIIish
Karl Williamson [Sat, 17 Oct 2020 21:45:24 +0000 (15:45 -0600)]
perlapi: Document ASCIIish

23 months agoperlapi: PERL_USE_GCC_BRACE_GROUPS is defined or not
Karl Williamson [Sat, 17 Oct 2020 21:44:20 +0000 (15:44 -0600)]
perlapi: PERL_USE_GCC_BRACE_GROUPS is defined or not

Use the new perldoc flag for symbols that don't have a value when defined.

23 months agoAdd '#' flag for autodoc entries
Karl Williamson [Thu, 22 Oct 2020 15:14:15 +0000 (09:14 -0600)]
Add '#' flag for autodoc entries

This indicates the symbol is accessed via #ifdef and is not a function
or a macro with a returned value

23 months agoSidney Markowitz is now a Perl author
Karl Williamson [Fri, 17 Jun 2022 03:02:35 +0000 (21:02 -0600)]
Sidney Markowitz is now a Perl author

23 months agohandy.h: White space only
Karl Williamson [Wed, 10 Jun 2020 00:28:01 +0000 (18:28 -0600)]
handy.h: White space only

These shouldn't be indented

23 months agoGH19478: applying taint is no reason to mess with pos
Hugo van der Sanden [Fri, 3 Jun 2022 13:15:48 +0000 (14:15 +0100)]
GH19478: applying taint is no reason to mess with pos

25fdce4a16 introduced a chunk in sv_magic() to "force pos to be stored
as characters, not bytes" whenever any magic was applied to a string
marked UTF8.

It is not clear why a random call to sv_magic(), eg to mark a string as
tainted, needs to do this - it would seem more logical for the check to
happen either earlier (when the string first qualifies as SvMAGICAL(sv)
&& DO_UTF8(sv)) or later (eg on mg_find).

Experimentally remove this block - it appears to cause no test failures,
and allows the new test cases to pass.

23 months agolocale.c: Move unreachable code so is reachable
Karl Williamson [Sat, 26 Dec 2020 22:16:59 +0000 (15:16 -0700)]
locale.c: Move unreachable code so is reachable

It turns out this code, setting errno, is unreachable.  Move it to the
place where it would do some good, removing an extraneous, unreachable
return;

23 months agolocale.c: Simplify S_category_name
Karl Williamson [Wed, 23 Dec 2020 17:59:09 +0000 (10:59 -0700)]
locale.c: Simplify S_category_name

We can use the new function S_get_category_index() to simplify this.
Also, when I wrote it I didn't know about Perl_form(), and had
reimplemented a portion of it here; which is yanked as well.

23 months agolocale.c: Change S_emulate_setlocale name and sig
Karl Williamson [Wed, 24 Feb 2021 11:36:46 +0000 (04:36 -0700)]
locale.c: Change S_emulate_setlocale name and sig

It turns out this function is called only from places where we have the
category index already computed; so change the signature to use the
index and remove the re-calculation.

It renames it to emulate_setlocale_i() to indicate that the category
parameter is an index.

This also means, that it's very unlikely that it will be called with an
out-of-bounds value.  Remove the debugging statement for that case (but
retain the error return value).

23 months agolocale.c: Use get_category_index()
Karl Williamson [Wed, 24 Feb 2021 11:24:48 +0000 (04:24 -0700)]
locale.c: Use get_category_index()

This creates the first uses of the function added in the previous commit.

It changes the name of a function that now takes an index to have the
suffix _i to indicate its calling parameter is a category index rather
than a category.  This will become a common paradigm in this file in
later commits.

Two macros are also created to call that function; they have suffixes _c
(to indicate the parameter is a category known at compile time, and _r
(to indicate it needs to be computed at runtime).  This is in keeping
with the already existing paradigm in this file.

23 months agolocale.c: Create S_get_category_index()
Karl Williamson [Wed, 24 Feb 2021 11:36:42 +0000 (04:36 -0700)]
locale.c: Create S_get_category_index()

libc locale categories, like LC_NUMERIC, are opaque integers.  This
makes it inconvenient to have table-driven code.  Instead, we have
tables that are indexed by small positive integers, which are a
compile-time mapping from the libc values.

This commit creates a run-time function to also do that mapping.  It
will first be used in the next commit.

The function does a loop through the available categories, looking for a
match.  It could be replaced by some sort of quick hash lookup, but the
largest arrays in the field have a max of 12 elements, with almost all
searches finding their quarry in the first 6.  It doesn't seem
worthwhile to me to replace a linear search of 6 elements by something
more complicated.  The design intent is this search will be used only at
the edges of the locale-handling code; once found the index is used in
future bits of the current operation.

23 months agolocale.c: Cast return of setlocale() to const
Karl Williamson [Mon, 1 Mar 2021 18:25:45 +0000 (11:25 -0700)]
locale.c: Cast return of setlocale() to const

If they had it to do over again, the libc makers would have made the
return of this function 'const char *'.  We can cast it that way
internally to catch erroneous uses at compile time.

23 months agolocale.c: Change macro name
Karl Williamson [Fri, 26 Feb 2021 19:31:06 +0000 (12:31 -0700)]
locale.c: Change macro name

Adopt the git convention of 'porcelain' meaning without special
handling.  This makes it clear that porcelain_setlocale() is the base
level.

23 months agoRegularize HAS_POSIX_2008_LOCALE, USE_POSIX_2008_LOCALE
Karl Williamson [Wed, 10 Feb 2021 14:19:35 +0000 (07:19 -0700)]
Regularize HAS_POSIX_2008_LOCALE, USE_POSIX_2008_LOCALE

A platform shouldn't be required to use the Posix 2008 locale handling
functions if they are present.  Perhaps they are buggy.  So, a separate
define for using them was introduced, USE_POSIX_2008_LOCALE.  But until
this commit there were cases that were looking at the underlying
availability of the functions, not if the Configuration called for their
use.

23 months agoAdd USE_LOCALE_THREADS #define
Karl Williamson [Wed, 10 Feb 2021 14:09:06 +0000 (07:09 -0700)]
Add USE_LOCALE_THREADS #define

This is in preparation for supporting configurations where there threads
are available, but the locale handling code should ignore that fact.

This stems from the unusual locale handling of z/OS, where any attempt
is ignored to change locales after the first thread is created.

23 months agoMark newly moved symbols as private
Karl Williamson [Wed, 16 Dec 2020 18:21:53 +0000 (11:21 -0700)]
Mark newly moved symbols as private

The previous commit made certain symbols that previously were local to
locale.c now available everywhere.  Add a trailing underscore to their
names to mark them as private.

23 months agoMove some locale.c #defines to perl.h
Karl Williamson [Wed, 16 Dec 2020 18:08:18 +0000 (11:08 -0700)]
Move some locale.c #defines to perl.h

This is in preparation for them to be used in macros from outside
locale.c

23 months agoAvoid using ' version of isnt
Nicolas Mendoza [Thu, 16 Jun 2022 00:06:29 +0000 (02:06 +0200)]
Avoid using ' version of isnt

23 months agoNicolas Mendoza is now a Perl author
Karl Williamson [Thu, 16 Jun 2022 00:19:47 +0000 (18:19 -0600)]
Nicolas Mendoza is now a Perl author

23 months agoperlapi: Document hv_ksplit
Karl Williamson [Fri, 20 May 2022 04:01:46 +0000 (22:01 -0600)]
perlapi: Document hv_ksplit

23 months agoallow building with -DPERL_MEM_LOG on Win32
Tony Cook [Wed, 15 Jun 2022 04:10:12 +0000 (14:10 +1000)]
allow building with -DPERL_MEM_LOG on Win32

This appears to have been broken for a while, and became more broken
with 75acd14e, which made newSV_type() inline.

This will also prevent warnings about calls to undeclared functions
on systems that don't need symbols to be exported.

23 months agopp_aelemfast: include fast return for non-lvals
Richard Leach [Mon, 13 Jun 2022 11:41:42 +0000 (11:41 +0000)]
pp_aelemfast: include fast return for non-lvals

Within the "inlined av_fetch() for simple cases" fast path, we already
operate within the bounding conditions of the if() statement. Once
AvARRAY(av)[key] is found to be null, a call of av_fetch(av,key,lval)
here just boils down to a single line:

    return lval ? av_store(av,key,newSV_type(SVt_NULL)) : NULL;

Checking the rest of pp_aelemfast, it's clear that within the fast
path, if (!sv) and (!lval), the function must eventually
PUSHs(&PL_sv_undef). So the fast path might as well do that directly.

23 months agoPorting/release_schedule.pod: Fix verbatim line len
Karl Williamson [Tue, 14 Jun 2022 22:28:14 +0000 (16:28 -0600)]
Porting/release_schedule.pod: Fix verbatim line len

23 months agoAdded release managers through January 2023
Neil Bowers [Tue, 14 Jun 2022 21:34:08 +0000 (22:34 +0100)]
Added release managers through January 2023

23 months agoUpdate cygwin README file from downstream
Leon Timmermans [Sun, 7 Feb 2021 00:19:28 +0000 (01:19 +0100)]
Update cygwin README file from downstream

23 months agoUpdate libsearch paths for cygwin
Leon Timmermans [Sat, 6 Feb 2021 23:30:05 +0000 (00:30 +0100)]
Update libsearch paths for cygwin

23 months agoUse cygwin's own hints/cygwin.sh
Leon Timmermans [Sat, 6 Feb 2021 23:18:32 +0000 (00:18 +0100)]
Use cygwin's own hints/cygwin.sh

23 months agoUse auto-image-base on cygwin
Leon Timmermans [Sat, 6 Feb 2021 23:16:21 +0000 (00:16 +0100)]
Use auto-image-base on cygwin

23 months agoRevert "Do per-word hop back"
Karl Williamson [Tue, 14 Jun 2022 16:35:51 +0000 (10:35 -0600)]
Revert "Do per-word hop back"

This reverts commit d6ad3b72778369a84a215b498d8d60d5b03aa1af
and adds comments that it existed.  This is so that this work which
isn't really needed based on current usage in core isn't lost, and can
be used in the future.

23 months agoDo per-word hop back
Karl Williamson [Tue, 14 Jun 2022 16:17:15 +0000 (10:17 -0600)]
Do per-word hop back

This should speed up backing up a large distance in a UTF-8 string.  But
we don't actually do that in core.  I did this work 5 years ago before I
realized this.  Rather than throw it away, this commit gets it into the
history, and the next commit will revert it.

23 months agoAdd comment to inline.h noting perlstatic.h
Karl Williamson [Tue, 14 Jun 2022 14:28:55 +0000 (08:28 -0600)]
Add comment to inline.h noting perlstatic.h

23 months agoCreate perlstatic.h
Karl Williamson [Wed, 8 Jun 2022 12:54:37 +0000 (06:54 -0600)]
Create perlstatic.h

This is used for functions that we don't suggest should be inlined, but
we think the compiler will generate better code if it has full knowledge
about them.

At the moment, it only contains a single function which can be tail-call
optimized.

The Lord of the Rings quote for this file was suggested by Leon
Timmermans.

The proximal cause of this commit can be gleaned from this email:

From - Mon Nov 16 09:20:50 2020
X-Mozilla-Status: 0001
X-Mozilla-Status2: 00800000
X-Mozilla-Keys:
Subject: Re: about commit "Revert "croak_memory_wrap is an inline function.""
 (khw)
To: bulk88 <bulk88@hotmail.com>, perl5-porters@perl.org
References: <20200429011948.14287.qmail@lists-nntp.develooper.com>
From: Karl Williamson <public@khwilliamson.com>
Message-ID: <6f38382c-8fb5-ba1a-51c6-409fa5b56d2b@khwilliamson.com>
Date: Mon, 16 Nov 2020 09:20:41 -0700
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101
 Thunderbird/78.4.3
MIME-Version: 1.0
In-Reply-To: <20200429011948.14287.qmail@lists-nntp.develooper.com>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 7bit

On 4/28/20 7:19 PM, bulk88 wrote:
> https://perl5.git.perl.org/perl5.git/commitdiff/d68c938a1e6c6b4bfe907decbb4929780ee06eae
>
>
> Why was this done? Perl_croak_memory_wrap is supposed to be a static
> linkage, not globally visible C function, in every perl .o file that the
> CC/linker should toss the static func if its not used. I wanted to avoid
> the PLT/GOT runtime C symbol substitution/LDPRELOAD mechanism and let
> the CC turn Perl_croak_memory_wrap into a single conditional jump
> (offset from current instruction pointer), with no return and no C stack
> entry, jump instruction instead of
>
> call get_EIP //x86 32 only
> mov eax, *(eax_aka_eip+offset into PLT)
> call eax

I reverted this because, first of all, gcc with the appropriate -W
options raised warnings that it was disregarding the request and was not
inlining this function, and 2nd of all, there was no indication in the
comments as to why this function had been inlined.

23 months agoregen/embed.pl: Add static Perl_ not_inlined capability
Karl Williamson [Wed, 8 Jun 2022 12:49:59 +0000 (06:49 -0600)]
regen/embed.pl: Add static Perl_ not_inlined capability

This will be used in the next commit

23 months agoregen/embed.pl: Use $var to avoid duplicate string
Karl Williamson [Wed, 8 Jun 2022 12:48:15 +0000 (06:48 -0600)]
regen/embed.pl: Use $var to avoid duplicate string

23 months agoChange autodoc flag
Karl Williamson [Wed, 8 Jun 2022 12:57:59 +0000 (06:57 -0600)]
Change autodoc flag

This should be being used only in core, as its only use is for autodoc.
Change the flag name to be more mnemonic, freeing up its current name
for another use.

23 months agoConvert '!!' to cBOOL()
Karl Williamson [Tue, 7 Jun 2022 11:39:12 +0000 (05:39 -0600)]
Convert '!!' to cBOOL()

I believe the '!!' is somewhat obscure; I for one didn't know about it
for years of programming C, and it was buggy in one compiler, which is why
cBOOL was created, I believe.  And it is graphically dense, and
generally harder to read than the cBOOL() construct.

This commit dates from before we moved to C99 where we can simply cast
to (bool), and cBOOL() has been rewritten to do that.  But the vast
majority of code uses cBOOL(), and this commit brings the remainder of
the core .[ch] files into uniformity.

23 months agolib/locale.t: AIX now works
Karl Williamson [Mon, 6 Jun 2022 02:19:29 +0000 (20:19 -0600)]
lib/locale.t: AIX now works

Previous commits have fixed the AIX locale anomalies, so we don't have
to skip tests on that platform.

23 months agoA better error message for `try {} catch {}` missing its (VAR)
Paul "LeoNerd" Evans [Wed, 8 Jun 2022 11:35:25 +0000 (12:35 +0100)]
A better error message for `try {} catch {}` missing its (VAR)

As suggested in https://github.com/Perl/perl5/issues/19811, this now
outputs the message:

  $ ./perl -Mexperimental=try
  try { A() }
  catch { B() }

  catch block requires a (VAR) at - line 2, near "catch {"
  Execution of - aborted due to compilation errors.

23 months agoEvaluate SET_SVANY_FOR_BODYLESS_[IN]V() param just once
Karl Williamson [Mon, 29 Jun 2020 17:06:04 +0000 (11:06 -0600)]
Evaluate SET_SVANY_FOR_BODYLESS_[IN]V() param just once

Since these are defined for just the core, we can add
    STMT_START { ...  } STMT_END
without repercussions

23 months agoEvaluate isGV_with_GP(on|off)() param just once
Karl Williamson [Mon, 29 Jun 2020 16:58:43 +0000 (10:58 -0600)]
Evaluate isGV_with_GP(on|off)() param just once

23 months agoEvaluate Sv[INURU}V_set() params just once
Karl Williamson [Mon, 29 Jun 2020 15:49:01 +0000 (09:49 -0600)]
Evaluate Sv[INURU}V_set() params just once

23 months agoEvaluate SvSetSV_(nosteal_)?and() params just once
Karl Williamson [Mon, 29 Jun 2020 15:16:00 +0000 (09:16 -0600)]
Evaluate SvSetSV_(nosteal_)?and() params just once

23 months agoEvaluate SvIV_please() param just once
Karl Williamson [Mon, 29 Jun 2020 15:07:57 +0000 (09:07 -0600)]
Evaluate SvIV_please() param just once

23 months agoEvaluate SvREFCNT_inc_simple_void() param just once
Karl Williamson [Mon, 29 Jun 2020 15:00:59 +0000 (09:00 -0600)]
Evaluate SvREFCNT_inc_simple_void() param just once

23 months agoregexec.c: Refactor switch default()
Karl Williamson [Sat, 20 Mar 2021 17:14:00 +0000 (11:14 -0600)]
regexec.c: Refactor switch default()

It seems clearer to me to have the panic at the end of the routine
instead of as the default: of a switch().

23 months agoregexec.c: Use new macros; refactor switch()
Karl Williamson [Sat, 20 Mar 2021 17:09:40 +0000 (11:09 -0600)]
regexec.c: Use new macros; refactor switch()

These case statements in a switch all had the same prelude for checking
if the locale is UTF-8 and handling that case separately.  A few commits
ago created macros closer to the base level.  This commit factors out
the common UTF-8 handling, and then puts the lower lever things in the
switch().  Perhaps the C optimizer would have been smart enough to do
this too, but we might as well do it ourselves, now that it is
convenient.

23 months agolocale.c: Use macros from previous commits
Karl Williamson [Thu, 11 Mar 2021 18:17:22 +0000 (11:17 -0700)]
locale.c: Use macros from previous commits

The last few commits have introduced layers of the locale character
classification macros, so that quirks of certain platforms are
compensated for at the lowest levels.  Change locale.c to use those
compensating macros instead of the porcelain libc ones.

This causes these platforms to work in Perl more closely to the POSIX
standard.

23 months agohandy.h: Add layer for char classification/case change
Karl Williamson [Sat, 27 Mar 2021 19:20:09 +0000 (13:20 -0600)]
handy.h: Add layer for char classification/case change

This layer currently expands to just the layer below it, but that will
be changed in a future commit.

23 months agohandy.h: Add isCASED_LC
Karl Williamson [Sat, 20 Mar 2021 17:02:14 +0000 (11:02 -0600)]
handy.h: Add isCASED_LC

As a convenience to other code.

23 months agohandy.h: Add wrapper layer macros for isalnum() etc
Karl Williamson [Thu, 18 Mar 2021 16:03:20 +0000 (10:03 -0600)]
handy.h: Add wrapper layer macros for isalnum() etc

This adds a new set of macros, forming a lower layer to what is currently
there, to wrap the character classification libc functions, isdigit()
etc, and case changing ones, tolower(), toupper().

On most platforms these expand simply to the libc function call.  But on
Windows, they expand to something more complex, to bring the Windows
calls into POSIX compliance.  Similarly, but not as extensive,  IBM
products have some non-compliant behavior, and one macro is made more
comples to fix that.  Previously compliance  was achieved at a higher
level, with the result that lower level calls were broken.  This
resulted in parts of the test suite being skipped on Windows and IBM,
which remain for now.

The current level is rewritten to use the new lower layer, with the
result that it is simpler, as the complexity is now done further down.

23 months agohandy.h: Collapse some macros
Karl Williamson [Sat, 27 Mar 2021 18:14:45 +0000 (12:14 -0600)]
handy.h: Collapse some macros

These 3 sets of macros can be collapsed trivially into 3 macros.

23 months agohandy.h: Move some macro defns around
Karl Williamson [Sat, 27 Mar 2021 17:58:07 +0000 (11:58 -0600)]
handy.h: Move some macro defns around

This is to make the difference listing in future commits smaller.

This change includes some comment changes, and some extra parens around
some subexpressions

23 months agohandy.h: Collapse two sets of macros
Karl Williamson [Sat, 27 Mar 2021 17:10:13 +0000 (11:10 -0600)]
handy.h: Collapse two sets of macros

By redefining a wrapper macro used in one set based on compile-time
info; the other set can be defined in terms of it, and the separate
entries removed.

23 months agoNo locales => don't use isspace(), toLower() etc.
Karl Williamson [Sat, 27 Mar 2021 17:33:22 +0000 (11:33 -0600)]
No locales => don't use isspace(), toLower() etc.

This commit changes what happens on platforms without locale handling to
use our precomputed definitions of what the various character class
definitions and case changing operations are.  Previously, it just
called the libc locale-dependent functions and made sure the result was
ASCII.  I think this is a holdover from before we had the precomputed
definitions

23 months agohandy.h: #define one macro in terms of another
Karl Williamson [Thu, 18 Mar 2021 13:28:38 +0000 (07:28 -0600)]
handy.h: #define one macro in terms of another

These two macros are equivalent as folding and lowercasing are the same
for this input domain.  Better to say so rather than to replicate the
definitions.

23 months agohandy.h: Rmv unnecessary parameter to internal macros
Karl Williamson [Thu, 18 Mar 2021 13:04:01 +0000 (07:04 -0600)]
handy.h: Rmv unnecessary parameter to internal macros

The cast is required to be U8 by the POSIX standard.  There is no need
to have this added generality.

23 months agohandy.h: Refactor some internal macros
Karl Williamson [Thu, 18 Mar 2021 20:37:06 +0000 (14:37 -0600)]
handy.h: Refactor some internal macros

This changes the parameters etc, in preparation for further changes

23 months agohandy.h: Rmv internal macro
Karl Williamson [Thu, 18 Mar 2021 20:35:31 +0000 (14:35 -0600)]
handy.h: Rmv internal macro

LC_CAST_ was my attempt at generality, but I didn't realize that the
POSIX standard specifies the type that this was meant to generalize, so
there isn't any need for it.

23 months agoChange handy.h macro names to be C standard conformant
Karl Williamson [Sun, 20 Dec 2020 22:38:33 +0000 (15:38 -0700)]
Change handy.h macro names to be C standard conformant

C reserves symbols beginning with underscores for its own use.  This
commit moves the underscore so it is trailing, which is legal.  The
symbols changed here are many of the ones in handy.h that have
significant uses outside it.

23 months agohandy.h: Don't use char class if no LC_CTYPE
Karl Williamson [Sat, 27 Mar 2021 19:15:10 +0000 (13:15 -0600)]
handy.h: Don't use char class if no LC_CTYPE

It is possible to compile perl to not pay attention to LC_CTYPE.  This
was testing for no locales at all; whereas the stricter requirement
should be used.

23 months agohandy.h: White-space, comment only
Karl Williamson [Fri, 18 Dec 2020 20:02:07 +0000 (13:02 -0700)]
handy.h: White-space, comment only

23 months agohandy.h: Add some branch predictions
Karl Williamson [Thu, 18 Mar 2021 18:43:11 +0000 (12:43 -0600)]
handy.h: Add some branch predictions

23 months agohandy.h: Refactor some #ifdef's for commonality
Karl Williamson [Fri, 18 Dec 2020 17:04:10 +0000 (10:04 -0700)]
handy.h: Refactor some #ifdef's for commonality

This changes these compilation conditionals so that things in common
between Windows and other platforms are only defined once.

It changes the isIDFIRST_LC and isWORDCHAR_LC definitions for
non-Windows to match that platform superficially, though expanding to
what it previously did to.

23 months agohandy.h: Remove the only 2 calls to internal macro
Karl Williamson [Fri, 18 Dec 2020 20:12:02 +0000 (13:12 -0700)]
handy.h: Remove the only 2 calls to internal macro

Replace isIDFIRST_LC and isWORD_CHAR_LC isIDFIRST_LC  with slightly
faster implementations.

23 months agoChange handy.h macro names to be C standard conformant
Karl Williamson [Thu, 17 Dec 2020 20:07:34 +0000 (13:07 -0700)]
Change handy.h macro names to be C standard conformant

C reserves symbols beginning with underscores for its own use.  This
commit moves the underscore so it is trailing, which is legal.  The
symbols changed here are most of the ones in handy.h that have few uses
outside it.

23 months agoMinor update to perl -h to display newly added -g option.
Mohammad S Anwar [Sat, 11 Jun 2022 12:17:14 +0000 (13:17 +0100)]
Minor update to perl -h to display newly added -g option.

23 months agoregcomp.c: Add ASSERT
Karl Williamson [Wed, 8 Jun 2022 18:15:26 +0000 (12:15 -0600)]
regcomp.c: Add ASSERT

23 months agoMohammad S Anwar is now a Perl author
Karl Williamson [Sun, 12 Jun 2022 01:05:42 +0000 (19:05 -0600)]
Mohammad S Anwar is now a Perl author

23 months agoNote gotchas, workarounds in STMT_START..STMT_END
Karl Williamson [Sat, 4 Jun 2022 15:16:39 +0000 (09:16 -0600)]
Note gotchas, workarounds in STMT_START..STMT_END

23 months agoDiscourage use of GCC brace groups
Karl Williamson [Fri, 3 Jun 2022 16:28:46 +0000 (10:28 -0600)]
Discourage use of GCC brace groups

These days, static inline functions are the better bet, as you don't
have to maintain two code paths.

23 months agoMake fc(), qr//i thread-safe on participating platforms
Karl Williamson [Sun, 13 Dec 2020 20:06:42 +0000 (13:06 -0700)]
Make fc(), qr//i thread-safe on participating platforms

A long standing bug in Perl that has gone undetected is that the array
is global that is created when changing locales and tells fc() and qr//i
matching what the folds are in the new locale.

What this means is that any program only has one set of fold definitions
that apply to all threads within it, even if we claim that the locales
are thread-safe on the given platform.  One possibility for this going
undetected so long is that no one is using locales on multi-threaded
systems much.  Another possibility is that modern UTF-8 locales have the
same set of folds as any other one.

It is a simple matter to make the fold array per-thread instead of
per-process, and that solves the problem transparently to other code.

I discovered this stress-testing locale handling under threads.  That
test will be added in a future commit.

In order to keep from having a dTHX inside foldEQ_locale, it has to have
a pTHX_ parameter.  This means that the other functions that function
pointer variables get assigned to point to have to have an identical
signature, which means adding pTHX_ to functions that don't require it.
The bodies of all these are known to the compiler, since they are all
in inline.h or in the same .c file as where they are called.  Hence the
compiler can optimize out the unused parameter.

Two calls of STR_WITH_LEN also have to be changed because of C
preprocessor limitations; perhaps there is another way to do it that I'm
unfamiliar with.

23 months agomg.c: Fix to compile under g++
Karl Williamson [Sat, 11 Jun 2022 10:40:17 +0000 (04:40 -0600)]
mg.c: Fix to compile under g++

Commit 00a5df846e035280750985222a693ac58022ee36 fixed some c undefined
behavior, but it will not compile with g++, because a goto crosses
initialization.

https://stackoverflow.com/questions/14274225/statement-goto-can-not-cross-variable-definition

and its links sort of explains why

This commit works around this limitation

2 years agoRestore wrongly deleted pod for sv_pvutf8
Karl Williamson [Fri, 10 Jun 2022 17:12:19 +0000 (11:12 -0600)]
Restore wrongly deleted pod for sv_pvutf8

2 years agoRemove pod for non-existent functions
Karl Williamson [Fri, 10 Jun 2022 16:56:07 +0000 (10:56 -0600)]
Remove pod for non-existent functions

7008caa915ad99e650acf2aea40612b5e48b7ba2 removed several deprecated
functions, but did not remove all the pods thereof.

2 years agotoke.c: Remove Undefined C behavior
Karl Williamson [Fri, 10 Jun 2022 16:52:52 +0000 (10:52 -0600)]
toke.c: Remove Undefined C behavior

Spotted by clang 14.

2 years agomg.c: Remove Undedfined C behavior
Karl Williamson [Fri, 10 Jun 2022 16:51:54 +0000 (10:51 -0600)]
mg.c: Remove Undedfined C behavior

Spotted by clang-14.

2 years agoop.c: Improve comments
Karl Williamson [Fri, 10 Jun 2022 01:38:32 +0000 (19:38 -0600)]
op.c: Improve comments

2 years agoRemove support for Ultrix
Karl Williamson [Tue, 31 May 2022 23:26:08 +0000 (17:26 -0600)]
Remove support for Ultrix

Ultrix has been removed.  Ultrix was the native Unix-like operating
system for various Digital Equipment Corporation machines.  Its final
release was in 1995.

2 years agoperlapi: Document hv_name_set
Karl Williamson [Fri, 20 May 2022 21:47:49 +0000 (15:47 -0600)]
perlapi: Document hv_name_set

2 years agoSvGETMAGIC: evaluate its argument just once
Karl Williamson [Sun, 28 Jun 2020 18:52:03 +0000 (12:52 -0600)]
SvGETMAGIC: evaluate its argument just once

This required making it into an inline function.  I tried using
STMT_START{ ... } STMT_END, which should work since it has a void
return, but there were places where it was used in a comma operator, and
those did not compile.

2 years agoCapitalize Perl
Elvin Aslanov [Thu, 9 Jun 2022 07:40:46 +0000 (11:40 +0400)]
Capitalize Perl

Capitalize Perl when referring to the language (rather than the interpreter).

Also pluralize "built-ins" and format "CORE" package.

2 years agoPOSIX.xs: White-space only
Karl Williamson [Sat, 23 Jan 2021 13:15:27 +0000 (06:15 -0700)]
POSIX.xs: White-space only

Properly indent some nested preprocessor directives

2 years agoPOSIX.xs: Use macro to reduce complexity
Karl Williamson [Sat, 23 Jan 2021 13:12:27 +0000 (06:12 -0700)]
POSIX.xs: Use macro to reduce complexity

This #defines a macro and uses it to populate a structure, so that
strings don't have to be typed twice.

2 years agoregexec.c: Handle Turkish locale if large ANYOF bitmap
Karl Williamson [Tue, 2 Jun 2020 16:11:47 +0000 (10:11 -0600)]
regexec.c: Handle Turkish locale if large ANYOF bitmap

Perl defaults to the bitmap for ANYOF nodes being for the lowest 256
characters, but it is possible to compile the bitmap to be up to size
2**16.  Doing so, prior to this commit, broke Turkish locale handling.

2 years agoregexec.c: Avoid using a more general fcn
Karl Williamson [Sun, 7 Jun 2020 00:25:33 +0000 (18:25 -0600)]
regexec.c: Avoid using a more general fcn

The regnodes in the ANYOFH series by definition don't have a bitmap used
in the other ANYOF-type nodes.  Instead they have an inversion list.  We
can avoid the overhead of calling the general function that looks first
in the bitmap.

2 years agolocale.c: Replace most #ifdef DEBUGGING lines
Karl Williamson [Sat, 26 Dec 2020 03:24:22 +0000 (20:24 -0700)]
locale.c: Replace most #ifdef DEBUGGING lines

THe previous commit enhanced the DEBUG macros so that they contain the
logic that previously had to be done with conditional compilation
statements.  Removing them makes the code easier to read.

2 years agoDEBUG_L now also looks at environment variable
Karl Williamson [Sat, 26 Dec 2020 02:01:23 +0000 (19:01 -0700)]
DEBUG_L now also looks at environment variable

Because locale initialization happens before command line processing,
one can't pass a -DL argument to enable debugging of locale
initialization.  Instead, an environment variable is read then, and is
used to enable debugging or not.  In the past, code specifically had to
test for this being set.  This commit changes that so that debugging can
automatically be enabled without having to write special code.  Future
commits will strip out those special checks.

2 years agoXSLoader: convert from Test::More to internal test helpers
Graham Knop [Mon, 30 May 2022 15:17:28 +0000 (17:17 +0200)]
XSLoader: convert from Test::More to internal test helpers

The XSLoader tests need to play with the XS bits of various modules,
which can interfere with testing modules like Test::More. For example,
Test::More now loads Time::HiRes. This results in redefinition warnings,
and could lead to more serious problems.

Avoid this by creating some test helpers inside the XSLoader test, and
using those rather than Test::More.

The helpers implemented include roughly the same features used by the
test itself, so that the impact on the rest of the test code is minimal.

2 years agoFix building with clang-cl
Clemens Wasser [Tue, 31 May 2022 07:35:09 +0000 (09:35 +0200)]
Fix building with clang-cl

As mentioned in https://lists.llvm.org/pipermail/llvm-dev/2015-July/088122.html
and https://github.com/llvm/llvm-project/issues/24625 building with clang-cl currently fails due to the declaration of __PL_nan_u.
By declaring it like this, cl and clang-cl are happy to parse it.

2 years agoperldelta for ea43bc00e1113f
Tony Cook [Thu, 9 Jun 2022 00:49:25 +0000 (10:49 +1000)]
perldelta for ea43bc00e1113f

2 years agominitest_prep conflict on building $(MINIPERL_EXE)
Tony Cook [Wed, 8 Jun 2022 06:06:17 +0000 (16:06 +1000)]
minitest_prep conflict on building $(MINIPERL_EXE)

minitest depends on $(MINIPERL_EXE) and minitest_prep, but
minitest_prep calls back into make to build lib/Config.pm which
indirectly depends on $(MINIPERL_EXE).

This can result in a race between the parallel work of the parent
make and the work of the child make, as they both try to build
$(MINIPERL_EXE) and its dependencies, causing some of the errors
described in the ticket.

Note that trying to `make -j6 minitest all` could lead to
similar conflicts, but I think that's an unlikely and not worth
supporting anyway.

Fixes #19829 (I think)

2 years agoperldelta for bbaab2c3cd9
Tony Cook [Wed, 8 Jun 2022 23:38:31 +0000 (09:38 +1000)]
perldelta for bbaab2c3cd9

2 years agouse Off_t for file offsets in sdbm.c
Tony Cook [Wed, 8 Jun 2022 01:51:07 +0000 (11:51 +1000)]
use Off_t for file offsets in sdbm.c

On Win32 long is only 32-bits (even for x86_64), which meant
file sizes were limited to 2GB.

This successfully runs the example code, and can successfully read
all the keys back.

I didn't add a test, since creating a 2GB (or 8GB for the issue test)
would be unfriendly.

2 years agohandy.h: WIDEST_UTYPE is just PERL_UINTMAX_T
Karl Williamson [Wed, 8 Jun 2022 17:15:17 +0000 (11:15 -0600)]
handy.h: WIDEST_UTYPE is just PERL_UINTMAX_T

No need to re-derive it

2 years agoperl5dp.pl: Bump version
Karl Williamson [Wed, 8 Jun 2022 18:47:02 +0000 (12:47 -0600)]
perl5dp.pl: Bump version

2 years agoData::Dumper: bump version
Karl Williamson [Wed, 8 Jun 2022 18:46:31 +0000 (12:46 -0600)]
Data::Dumper: bump version