Branch: refs/heads/yves/auto_embed_fnc
Home: https://github.com/Perl/perl5
Commit: 8589352e5fe40b4853540b9af9690845b8ab390e
https://github.com/Perl/perl5/commit/8589352e5fe40b4853540b9af9690845b8ab390e
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: e70dfb6d8666a45f53e98e5e658506dbf896192d
https://github.com/Perl/perl5/commit/e70dfb6d8666a45f53e98e5e658506dbf896192d
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: 861ffe8074a28254f9c3fe14a151a9974b93fe0d
https://github.com/Perl/perl5/commit/861ffe8074a28254f9c3fe14a151a9974b93fe0d
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: 9bbdc6155853edba903cdf184908bc231a0c30f3
https://github.com/Perl/perl5/commit/9bbdc6155853edba903cdf184908bc231a0c30f3
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: 89886be4f799326834d7bf3045b04af1c0aec5de
https://github.com/Perl/perl5/commit/89886be4f799326834d7bf3045b04af1c0aec5de
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/ead55805baf3...89886be4f799