| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
Fix spelling on various files pertaining to core Perl.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The main exceptions being dist/, ext/, and Configure related
files, which will be updated in a subsequent commit. Files in the cpan/
directory are also omitted as they are not owned by the core.
'#define' has seven characters, so following it with a \t makes it look
like '#define ' when it is not, which then frustrates attempts to find
where a given define is. If you *know* then you do a
git grep -P 'define\s+WHATEVER'
but if don't or you forget, you can get very confused trying to find
where a given define is located. This fixes all such cases so they
actually are 'define WHATEVER' instead.
If this patch is getting in your way with blame analysis then view it
with the -w option to blame.
|
|
|
|
|
|
|
|
|
|
|
| |
This code is part of the fallback rng initialization, it should
only be used in odd circumstances, and it is intended to be "random"ish,
so the logic change should not be a problem.
This more or less reverts commit 4b4c4ab35e70f005167c863eae6d2003492c393c,
although the S_ptr_hash() now lives in util.c instead of hv.c.
Turns out having a decent pointer hash /is/ useful.
|
|
|
|
|
| |
This makes it easier to see the value with gdb, and also avoids an
assignment in the if condition body.
|
|
|
|
|
|
|
| |
This trivial function should get optimized out. But I couldn't get it
to work for Windows, because the two likely hdr files don't have
PL_thr_key defined in them. I suppose a new hdr file could be created
that gets included later. But I didn't think it was worth it.
|
|
|
|
| |
This trivial function will likely get optimized out
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Currently whether the __DIE__ signal handler triggers during compilation
of an eval string depends on the selection of the errors it contains.
Certain types of compilation error are considered "deferred errors" and
will not terminate compilation immediately, for instance undeclared
variables do not confuse the compiler so they do not trigger immediate
termination, and we will report them without limit provided they are the
only errors encountered. Whether a given error terminates compilation or
not or uses the error count to decide to do so seems to be somewhat
random, and it is quite possible that compilation can complete, with
errors, without ever "throwing" the exception so it can be passed to the
__DIE__ handler.
This patch ensures that when the eval has failed due to errors the
$SIG{__DIE__} handler is invoked before the eval completes.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Calls to libc snprintf() were neglected to be changed when perl was
fixed to change the radix character to the proper one based on whether
or not 'use locale' is in effect. Perl-level code is unaffected, but
core and XS code is.
This commit changes to wrap snprintf() calls with the macros designed
for the purpose, long used for similar situations elsewhere in the code.
Doing this requires the thread context. I achieved this in a few places
by a dTHX, instead of assuming a caller would have the context already
available, and adding a pTHX_ parameter. I tried doing it the other
way, and got a few breakages in our test suite. Formatting already
requires significant CPU time, so this addition should just be in the
noise
This bug was found by new tests that will be added in a future commit.
|
|
|
|
| |
Properly indent some preprocessor directives
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Otherwise the goto out_of_memory breaks threaded builds under debugging
as originally reported by Karl as we jump over the initialization
of the variable and then use it later on.
util.c: In function ‘void* Perl_safesysrealloc(void*, size_t)’:
util.c:335:11: error: jump to label ‘out_of_memory’
335 | out_of_memory:
| ^~~~~~~~~~~~~
util.c:248:18: note: from here
248 | goto out_of_memory;
| ^~~~~~~~~~~~~
util.c:277:12: note: crosses initialization of ‘UV was_where’
277 | UV was_where = PTR2UV(where);
| ^~~~~~~~~
make: *** [makefile:260: util.o] Error 1
|
|
|
|
| |
print purposes before we call realloc() on it
|
|
|
|
|
|
|
|
|
|
|
|
| |
Stress testing has shown that unless LC_TIME and LC_CTYPE are the same
locale, mojibake can result on some platforms.
locale.c already handles this for various other similar cases, and has
the infrastructure available to easily handle this one too. util.c does
not.
The only code change is to a comment to reflect that things are now in a
different file.
|
|
|
|
|
| |
This function can be simplified by using a do/while form to eliminate
the second call to strftime().
|
|
|
|
|
| |
If the passed in format is the empty string, the result is going to also
be the empty string. There is no need to do any other work.
|
|
|
|
|
|
| |
This converts to use 4 space indentation, removes pre-C99 workarounds,
moving declarations closer to first use as allowed by C99, and adds a
few comments.
|
|
|
|
| |
Mojibake currently can happen without taking care
|
|
|
|
|
|
| |
This reverts commit 81620fbedd5f5cb87f240d7809dc669cd60d0139.
The original commit was wrongly blamed for breakage, when it was the
harness parallelism that was at fault; since fixed, mostly.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In GH 20435 many typos in our C code were corrected. However, this pull
request was not applied to blead and developed merge conflicts. I
extracted diffs for the individual modified files and applied them with
'git apply', excepting four files where patch conflicts were reported.
Those files were:
handy.h
locale.c
regcomp.c
toke.c
We can handle these in a subsequent commit. Also, had to run these two
programs to keep 'make test_porting' happy:
$ ./perl -Ilib regen/uconfig_h.pl
$ ./perl -Ilib regen/regcomp.pl regnodes.h
|
|
|
|
|
|
| |
This reverts commit 5be23dd97e360d19c8abb4c0c534f5d5f9d3691a.
The original patch seems to break DBM.
|
|
|
|
| |
These short functions are reasonably frequently used.
|
|
|
|
|
|
|
| |
These short functions are moved from util.c to inline.h.
savesharedpv() and savesharedpvn() aren't moved because there is a
complication of needing also to move croak_no_mem(), which could be
done, but are these called enough to justify it?
|
| |
|
|
|
|
|
|
|
|
|
| |
gcc 12 was complaining that evaluating (somehekptr)->hek_key
was always true in many places where HvNAME() or HvENAME() was
being called in boolean context.
Add new macros to check whether the names should be available and
use those instead.
|
|
|
|
|
| |
With RCPV strings we can use the RCPV_LEN() macro, and
make this logic a little less weird.
|
|
|
|
|
|
| |
this allows multiple ops to share the same underlying
warning bit vector. the vectors are not deduped, however
they are efficiently copied and shared.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
As noted in the previous commit, some library functions now keep
per-thread state. So far the only ones we care about are libc
locale-changing ones.
When perl changes threads by swapping out tTHX, those library functions
need to be informed about the new value so that they remain in sync with
what perl thinks the locale should be.
This commit creates a function to do this, and changes the
thread-changing macros to also call this as part of the change.
For POSIX 2008, the function just calls uselocale() using the
per-interpreter object introduced previously.
For Windows, this commit adds a per-interpreter string of the current
LC_ALL, and the function calls setlocale on that. We keep the same
string for POSIX 2008 implementations that lack querylocale(), so this
commit just enables that variable on Windows as well. The code is
already in place to free the memory the string occupies when done.
The commit also creates a mechanism to skip this during thread
destruction. A thread in its death throes doesn't need to have accurate
locale information, and the information needed to map from thread to
what libc needs to know gets destroyed as part of those throes, while
relics of the thread remain. I couldn't find a way to accurately know
if we are dealing with a relic or not, so the solution I adopted was to
just not switch during destruction.
This commit completes fixing #20155.
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
| |
per the Posix standard
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
The old name was confusing.
|
|
|
|
|
| |
This is like plain my_strftime(), but additionally returns an indication
of the UTF-8ness of the returned string
|
|
|
|
| |
The new Perl_newSVhek_mortal function is slightly more efficient.
|
| |
|
|
|
|
|
| |
Prints more levels of C backtrace on SV allocation operations. Also
prints the perl caller file + line number.
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
| |
and document two of them, which I had done before I realized they were
to be deprecated.
These functions are obsolete, and stemmed from a long-solved problem in
Windows. There are a couple of uses on cpan of a couple of them. But
people should just use PL_opnames[], for example, instead of the
function here that returns the address of that array.
|
| |
|
|
|
|
|
|
|
| |
Now environ isn't owned by Perl and calling setenv/putenv in XS code
will no longer result in memory corruption.
Fixes #19399
|
| |
|
|
|
|
|
|
|
|
|
|
| |
- Early return is much better than wrapping the whole function with if().
- Remove pointless (void) casts.
- Move variable declarations closer to their first use.
- Normalize indentation.
|
| |
|
|
|
|
| |
This implements PerlProc_popen_list on some systems.
|
|
|
|
|
| |
This emulates socketpair on some systems that lack it; and should all be
under the level that XS code would deal with.
|
| |
|
|
|
|
| |
It had wrongly been added to the wrong entry.
|
|
|
|
|
| |
These implement PERL_[GS]ET_CONTEXT which are the API interfaces
for this functionality.
|
| |
|
| |
|