Branch: refs/heads/yves/auto_embed_fnc
  Home:   https://github.com/Perl/perl5
  Commit: b0f713363c0824e895ff010a2d4d44319b06a616
      
https://github.com/Perl/perl5/commit/b0f713363c0824e895ff010a2d4d44319b06a616
  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: 8f4538254f0de054f9b849a56559a1d75ed3f412
      
https://github.com/Perl/perl5/commit/8f4538254f0de054f9b849a56559a1d75ed3f412
  Author: Yves Orton <[email protected]>
  Date:   2022-12-16 (Fri, 16 Dec 2022)

  Changed paths:
    M autodoc.pl
    M makedef.pl
    M regen.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: ea8f2a0d61a7cdec9a98e43beec3ae31ae49d9fe
      
https://github.com/Perl/perl5/commit/ea8f2a0d61a7cdec9a98e43beec3ae31ae49d9fe
  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: 9a803a3150e9b0f4dbc13d1a34d95b0f702b92f5
      
https://github.com/Perl/perl5/commit/9a803a3150e9b0f4dbc13d1a34d95b0f702b92f5
  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: ead55805baf3d940bcfd492bdbe6b9054d2a47d4
      
https://github.com/Perl/perl5/commit/ead55805baf3d940bcfd492bdbe6b9054d2a47d4
  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/fd274d4c6ea1...ead55805baf3

Reply via email to