Branch: refs/heads/yves/auto_embed_fnc
Home: https://github.com/Perl/perl5
Commit: 10650f46d67d0bb86893f3c73438d97e2af673cb
https://github.com/Perl/perl5/commit/10650f46d67d0bb86893f3c73438d97e2af673cb
Author: Yves Orton <[email protected]>
Date: 2022-12-16 (Fri, 16 Dec 2022)
Changed paths:
M MANIFEST
M regen.pl
A regen/HeaderParser.pm
A regen/tidy_embed.pl
A t/porting/header_parser.t
Log Message:
-----------
regen/HeaderParser.pm - A module to parse our header files
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
Commit: 6da2b7d617f1115cb08132ae8c740c7966aa4fd8
https://github.com/Perl/perl5/commit/6da2b7d617f1115cb08132ae8c740c7966aa4fd8
Author: Yves Orton <[email protected]>
Date: 2022-12-16 (Fri, 16 Dec 2022)
Changed paths:
M autodoc.pl
M makedef.pl
M regen/embed.pl
M regen/embed_lib.pl
M regen/regen_lib.pl
M regen/tidy_embed.pl
M t/porting/diag.t
M t/porting/regen.t
Log Message:
-----------
regen/embed.pl - switch to using HeaderParser for code generation and etc.
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.
Commit: 7eeb88ac1f9311245c06bbc46dc60cd86cfa57bf
https://github.com/Perl/perl5/commit/7eeb88ac1f9311245c06bbc46dc60cd86cfa57bf
Author: Yves Orton <[email protected]>
Date: 2022-12-16 (Fri, 16 Dec 2022)
Changed paths:
M embed.fnc
M embed.h
M embedvar.h
M proto.h
Log Message:
-----------
embed.* - use regen/HeaderParser to regenerate embed.h, proto.h etc.
This is the result of running make regen after the previous commit.
Note that embed.fnc is altered and normalized in this commit as well.
Commit: 7dfa79175109a3aa5487381a916744ffd391a41b
https://github.com/Perl/perl5/commit/7dfa79175109a3aa5487381a916744ffd391a41b
Author: Yves Orton <[email protected]>
Date: 2022-12-16 (Fri, 16 Dec 2022)
Changed paths:
M regen/feature.pl
Log Message:
-----------
regen/feature.pl - use regen/HeaderParser to parse perl.h
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.
Commit: dd815c4b9bd6cfef0605b91e7225dd6b097704cc
https://github.com/Perl/perl5/commit/dd815c4b9bd6cfef0605b91e7225dd6b097704cc
Author: Yves Orton <[email protected]>
Date: 2022-12-16 (Fri, 16 Dec 2022)
Changed paths:
M regen/regcomp.pl
Log Message:
-----------
regen/regcomp.pl - use regen/HeaderParser to read regnodes.h and etc.
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.
Compare: https://github.com/Perl/perl5/compare/89886be4f799...dd815c4b9bd6