| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
This reverts commit ab28d7212b78f91ff5a0270d25b91a945c92c0e0.
|
|
|
|
|
|
| |
necessary"
This reverts commit f6405b442f40de7d3697fcd885bfbfa9ba55eab0.
|
|
|
|
| |
Fix spelling on various files pertaining to core Perl.
|
|
|
|
|
| |
makedef.pl exports them unconditionally and embed.pl should use the same
logic.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Karl complained about some of the wrapping logic we use for expressions.
This tweaks the rules in a number of different ways in an attempt to
produce more legible expressions. For instance if we have a complex
expression with different parenthesized sub expressions, then try to put
each sub expression on its own line. A previous patch ensures that we
put shorter sub expressions first, and this patch builds on that to put
each sub expression on its own line.
We also use different logic to wrap the expressions, with the end result
that each line should have the same number of defined() operations on it
(with the exception of the last). We also try harder to line up
logical operators and defined() functions.
|
|
|
|
|
|
|
|
|
| |
contents is short
it is a bit "noisy" to have comments that duplication the conditions
when the original line with the condition is visible on the screen at
the same time. this patch changes the rules so we only add these comments
when the clause is 10 lines or more from its prior
|
|
|
|
|
| |
if we have defined(X) && (defined(Y) || defined(Z)) put the defined(X)
first because it has less operations in it.
|
|
|
|
|
|
|
| |
Previously it would default to Perl, which happens to produce the right
comment character ("#"), but results in nonsensical syntax highlighting.
Now we set $lang to the special value 'None', which still produces
read-only declarations, but doesn't force a mode/filetype on editors.
|
|
|
|
|
| |
Vim's filetype declarations are case sensitive. The correct types for
Perl, C, and Pod are perl, c, and pod, respectively.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The leading underbar is reserved by C.
These defines are debugging only "recursion" depth related counters
injected into the function macro wrappers when a function is marked as
'W', much the same way that aTHX_ and pTHX_ are when building under
threaded builds. The functions are expected to incremented the depth
parameter themselves. Note that "recursion" is quoted above because in
practice currently they are only used by the regex engine when recursing
virtually, and they do not relate to true C stack related recursion.
(But they could be used for tracking C level recursion under debugging
if someone needed it.)
|
| |
|
|
|
|
| |
Also do not generate PERL_ARGS style macros for macros.
|
|
|
|
| |
This makes it easier to see the order the categories were added in.
|
|
|
|
|
| |
This also fixes the version_downgrade to show the correct version that
version downgrades will be removed in.
|
|
|
|
|
| |
This category applies to attempts to goto the internals of a block
construct.
|
|
|
|
|
|
| |
Some delimiters are considered deprecated because in the future they
will be used as part of a paired delimiter. This adds a new category
for these cases.
|
|
|
|
|
|
|
| |
deprecation category
This category is about use of apostrophe as a package separator, eg
for things like "Test::More::isn't()".
|
|
|
|
|
|
| |
This category is only used in the regex engine, we should be able
to disable it specifically, as it seems like we will never actually
remove demove support for the things it warns about.
|
|
|
|
|
| |
Instead of using a generic warnings category switch to fine grained
control.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Currently we seem to lack a way to have a subcategory under deprecated.
It seems reasonable to me that people might want to disable a specific
subcategory warning while leaving the rest in place. This patch allows
that. Note that both
no warnings "deprecated";
and
no warnings "deprecated::smartmatch";
work to disable the warning. Deprecated warnings shouldn't be "all or
nothing", they should be specific and targetted.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This defines a new magic hash C<%{^HOOK}> which is intended to be used for
hooking keywords. It is similar to %SIG in that the values it contains
are validated on set, and it is not allowed to store something in
C<%{^HOOK}> that isn't supposed to be there. Hooks are expected to be
coderefs (people can use currying if they really want to put an object
in there, the API is deliberately simple.)
The C<%{^HOOK}> hash is documented to have keys of the form
"${keyword}__${phase}" where $phase is either "before" or "after"
and in this initial release two hooks are supported,
"require__before" and "require__after":
The C<require__before> hook is called before require is executed,
including any @INC hooks that might be fired. It is called with the path
of the file being required, just as would be stored in %INC. The hook
may alter the filename by writing to $_[0] and it may return a coderef
to be executed *after* the require has completed, otherwise the return
is ignored. This coderef is also called with the path of the file which
was required, and it will be called regardless as to whether the require
(or its dependencies) die during execution. This mechanism makes it
trivial and safe to share state between the initial hook and the coderef
it returns.
The C<require__after> hook is similar to the C<require__before> hook
however except that it is called after the require completes
(successfully or not), and its return is ignored always.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The function SAVEDESTRUCTOR_X() (save_destructor_x) can be used to
execute a C function at the end of the current psuedo-block. Prior to
this patch there was no "mortal" equivalent that would execute at the
end of the current statement. We offer a collection of functions which
are intended to free SV's at either point in time, but only support
callbacks at the end of the current pseudo-block.
This patch adds two such functions, "mortal_destructor_sv" which can be
used to trigger a perl code reference to execute at the end of the
current statement, and "mortal_svfunc_x" which can be used to trigger an
SVFUNC_t C function at the end of the current statement.
Both functions differ from save_destructor_x() in that instead of
supporting a void pointer argument they both require their argument to
be some sort of SV pointer. The Perl callback function triggered by
"mortal_destructor_sv" may be provided no arguments, a single argument
or a list of arguments, depending on the type of argument provided to
mortal_destructor_sv(): when the argument is a raw AV (with no SV ref
wrapping it), then the contents of the AV are passed in as a list of
arguments. When the argument is anything else but NULL, the argument is
provided as a single argument, and when it is NULL the perl function is
called with no arguments.
Both functions are implemented on top of a mortal SV (unseen by the
user) which has PERL_MAGIC_destruct magic associated with it, which
triggers the destructor behavior when the SV is freed.
Both functions are provided with macros to match the normal SAVExx()
API, with MORTALDESTRUCTOR_SV() wrapping mortal_destructor_sv() and
MORTALSVFUNC_X() wrapping mortal_svfunc_x().
The heart of this logic cribbed from Leon Timmermans' Variable-OnDestruct.
See the code at:
https://metacpan.org/dist/Variable-OnDestruct/source/lib/Variable/OnDestruct.xs#L6-17
I am very grateful to him for his help on this. Any errors or omissions
in this code are my fault, not his.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
I misnamed some of the RCPV stuff when it was introduced. The macro
which I called SAVERCPVFREE should have been called SAVERCPV,
and there should also have been a SAVEFREERCPV macro.
Note the naming system for these functions is a bit confusing.
SAVEFREERCPV /just/ frees. SAVERCPV saves and restores (eg, its like
local). SAVEFREESV is an exception. :-( and it behaves like SAVERCPV.
See for instance SAVEPV or similar macros.
There also should have been RCPV_REFCNT_dec() and RCPV_REFCNT_inc()
macros.
There was also missing documentation. This patch should fix all of these
issues. Since this functionality has never been released in a production
perl it should be fine to do these renames, nothing out there should use
these macros yet.
I noticed these oversights while fixing Scope::Upper, see also:
https://github.com/Perl/perl5/issues/20861
https://rt.cpan.org/Ticket/Display.html?id=146897
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Like the previous commit which did it for amagic_call() and call_sv(),
this commit makes executing the faked-up OP_ENTEREVAL be executed as
part of the runops loop rather than as a separate call. This is to allow
shortly fixing up for a reference-counted stack. (CALLRUNOPS() will
reify the stack if necessary, while the raw call to pp_entereval() won't
fix up the stack unless its part of the runops loop too.)
However, this is a bit more complex than call_sv() etc in that there is
a good reason for calling pp_entereval() separately. The faked up
OP_ENTEREVAL has its op_next set to NULL - this is the op which would
normally be returned on failure of the eval compilation. By seeing
whether the retuned value from pp_entereval() is NULL or not, eval_sv()
can tell whether compilation failed.
On the other hand, if pp_entereval() was made to be called as part of
the runops loop, then the runops loop *always* finishes with PL_op set
to NULL. So we can no lo longer distinguish between compile-failed and
compile-succeeded-and-eval-ran-to-completion.
This commit moves the entereval into the runops loop, but restores the
ability to distinguish in a slightly hacky way. It adds a new private
flag for OP_ENTEREVAL - OPpEVAL_EVALSV - which indicates to
pp_entereval() that it was called from eval_sv(). And of course
eval_sv() sets this flag on the OPpEVAL_EVALSV op it fakes up. If
pp_entereval() fails to compile, then if that flag is set, it pushes a
null pointer onto the argument stack before returning.
Thus by checking whether *PL_stack_sp is NULL or not on return from
CALLRUNOPS(), eval_sv() regains the ability to distinguish the two
cases.
|
|
|
|
|
| |
Change is actually made in regen/feature.pl, then we run 'perl
regen.pl'.
|
| |
|
|
|
|
|
| |
Make the 'experimental::smartmatch' warning obsolete, and use
'deprecated' instead.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Multiple forms of syntax can be used to obtain a package name from
`caller`, which emits this as its first return value, and assign
that name to a lexical scalar.
The following each achieve the same result, but with varying efficiency:
* `sub callme { my $package = caller(2); ...}`
* `sub callme { my ($package) = caller(2); ...}`
* `sub callme { my $package = (caller(2))[0]; ...}`
In the first example, `pp_caller` determines only the package name
and pushes it to the stack. In the other two examples, the other 10 of
`caller`'s return values are calculated and pushed onto the stack,
before being discarded.
This commit changes non-CPAN-first instances of the latter two forms
in core to the first form.
Note: There is a special exception to the equivalence described above,
when caller is use in list context within the DB package. Such a
usage instance in regen/warnings.pl therefore remains unchanged.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This ensures we use a canonical string for each possible flag variant,
which makes it easier to search for flags with a given flag signature.
It also exposed a mutex bug in flag handling which caused
PerlEnv_putenv to be improperly marked as static, when it is in fact
static inline.
To validate there aren't any issues like this remaining in the script
I set it up so the flags were shuffled during processing and ran
embed.pl in a loop for a while and none of the output files changed,
so I assume there are no further such issues.
This patch also includes some basic validation of the flags so that if
someone misses a line continuation the following lines are not treated
as a new definition without any flags. I also ran perltidy on it
according to the rules contained within the file.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is actually a library sort (lc with underbars removed), followed by a
lexicographical sort. Comment lines are sticky to the line that follows
them.
Somehow the original version of this patch was missed in my earlier work on
tidy_embed.pl, I think I messed up a rebase somehow. I noticed it was missing
when I realized that new entries werent being sorted into place correctly.
While this patch creates a fair bit of churn in the file right now, long
term it will make it easier to use. Also note that the *output* files
have not changed, which validates that the patch did not break anything.
|
|
|
|
|
|
|
|
|
|
| |
This updates the mode-line for most of our generated files so that
they include file type information so they will be properly syntax
highlighted on github.
This does not make any other functional changes to the files.
[Note: Commit message rewritten by Yves]
|
|
|
|
| |
Unless the user requests we do so by setting REGEN_T_KEEP_CHANGES
|
| |
|
|
|
|
|
| |
Allows non-constant expressions with side effects. Evaluated during the
constructor of each instance.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Adds a new experimental warning, feature, keywords and enough parsing to
implement basic classes with an empty `new` constructor method.
Inject a $self lexical into method bodies; populate it with the object instance, suitably shifted
Creates a new OP_METHSTART opcode to perform method setup
Define an aux flag to remark which stashes are classes
Basic implementation of fields.
Basic anonymous methods.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We had a bug where we processed the first one in the flags definition. Sorting
the flags or rearranging them changes the output, which shouldn't happen.
This also fixes the handling and specification of PerlEnv_putenv(), which was
marked "si" when it should have been marked "i". This required changing its
implementation from a Perl_ prefix to a S_ prefix and regenerating.
I have run embed.pl in a loop with a local patch to shuffle the flags to see
if there were any other order dependencies. No output files changed so I
assume with this patch we are free of such bugs.
|
|
|
|
| |
None of the other headings in feature.pm have full stops.
|
|
|
|
|
| |
This autogenerates the required asserts to validate a parameter is non-zero.
It uses it to replace the check in regrepeat() as a first example.
|
|
|
|
|
|
| |
Since lib/feature.pm is a generated file, the actual changes are made in
regen/feature.pl, followed by 'make regen' to regenerate lib/feature.pm
(and then followed by 'make test_porting') to confirm.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We were not handling gaps in the sequence properly, and effectively
showing the wrong flag names or missing the last flag. Now we die if there
are any collisions or if any of the PREGf defines set more than one bit.
This also adds some crude tests to validate that intflags serialization is
working properly.
Note, extflags handles more complex scenarios and seems to handle this
gracefully already, hence the reason I haven't touched it as well.
This also tweaks a comment in lexical_debug.t which part of this was
cribbed from.
|
|
|
|
|
|
|
| |
Dave noticed there was a bug where I was adding a reference to an
integer. That did not make any sense. This patch fixes up the data so
the source of the line is more clear. I will do a further follow up
to improve this more, this is just to get the bug out of the way.
|
|
|
|
|
|
|
|
| |
regen/regcomp.pl reads several header files, using HeaderParser will
harden against line continuations or multiline comments. The current
code is actually somewhat fragile, and minor changes to the header files
it reads will break it. With this patch such changes would be dealt
with by HeaderParser, which should already do the right thing.
|
|
|
|
|
|
| |
Using HeaderParser hardens the code against possible future changes
and ensures if there are any parse bugs they get fixed for all our
regen code.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
HeaderParser was designed to replace the old grouping code in embed.pl and
regen/embed_lib.pl, which is used to generate embed.h and proto.h and
embedvar.h
It can handle "elif" in embed.fnc, and produces more consistently structured
and formatted and readable output than the old code. It also has much better
logic to dedupe expressions. Adding or changing a constraint in embed.fnc
should no longer have any "action at a distance" effects on the output for
other functions which were not changed or obviously affected by the change.
The old code assumed that sorting the constraints applying to a given function
definition was acceptable, with the result that "elif" was impossible to
support properly, and creating the problem that adding a new constraint which
sorted into a different position could change a large amount of the
output, making it hard to verify that the change was correct.
The new logic should, once the initial normalization is applied, ensure that any
further changes are minimal.
This patch also includes a new tool regen/normalize_embed.pl which will be run
by make regen, which consistently formats embed.fnc itself, which should make
maintaining the file easier, especially during code splits and reorgs.
Function definitions can be lifted out, moved to the end, with new
constraints, and the `make regen` will put it all back into the correct place
and order.
A number of tools and tests which use embed_lib.pl to load embed.fnc data have
necessarily been changed to use the new HeaderParser based logic.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Consistent proper header file parsing with an OO interface.
There are various traps and zaps parsing header files, such as line
continuations, and multiline comments acting as a line continuation.
There are also issues that the naive may overlook such as indented
preprocessor directives, and such things.
There are also some specialized tasks which we perform to construct
header files from other header files, such as grouping content under
similar guard clauses together, normalizing guard clauses, and the like.
HeaderParser provides an API to handle these issues. The code which
needs to read header files, or write header files, can use the
HeaderParser to group and normalize the content they are reading or
writing. This also frees the code generators from needing to worry about
indentation, or such artifacts, HeaderParser normalizes it all away.
This patch includes migrating everything to use the new infra, but it
does not include some of the changes that would come with that new
infra, so it would not pass test on THIS commit. Running make regen
should "fix" this, although it is deliberate to make rebasing the
branch easier.
One of the notable changes in this commit is that embed.fnc is now under
control of `make regen` (even though it is an input to `make regen`) and
any changes will be automatically tied by running it, even if those changes
also trigger other changes. HeaderParser sits underneath it all, so there
is no chicken and egg problem that would require running `make regen`
twice, the output of processing the modified embed.fnc would be identical
to the output of processing the original.
fixup
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This op is constructed using an OP_HELEM as the op_first and any scalar
expression as the op_other.
It is roughly equivalent to the following perl code:
exists $hv{$key} ? $hv{$key} : OTHER
except that the HV and the KEY expression are evaluated only once, and
only one hv_* function is invoked to both test and obtain the value. It
is therefore smaller and more efficient.
Likewise, adding the OPpHELEMEXISTSOR_DELETE flag turns it into the
equivalent of
exists $hv{$key} ? delete $hv{$key} : OTHER
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This splits a bunch of the subcomponents of the regex engine into
smaller files.
regcomp_debug.c
regcomp_internal.h
regcomp_invlist.c
regcomp_study.c
regcomp_trie.c
The only real change besides to the build machine to achieve the split
is to also adds some new defines which can be used in embed.fnc to control
exports without having to enumerate /every/ regex engine file. For
instance all of regcomp*.c defines PERL_IN_REGCOMP_ANY, and this is used
in embed.fnc to manage exports.
|
|
|
|
| |
This was added in commit <https://github.com/Perl/perl5/commit/ff25e5dbbad6ccf83f2e2a874a3c90294ea8cb47>.
|