Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: Deterministic scan.c and bootstrap byte comparison check #372

Merged
merged 2 commits into from
Apr 2, 2024

Conversation

Explorer09
Copy link
Contributor

(Split from PR #321)

Change the generating rules of scan.c (in dist-hook) and stage1scan.c
so that the source and output file names in #line directives are fixed.
This would allow the scanner results be comparable to each other.

Also in --disable-bootstrap build, the flex binary will now be built
with scan.c directly - no more sedding.

@westes westes added this to the 2.6.6 milestone Oct 22, 2018
@Explorer09 Explorer09 changed the title build: Generate deterministic scan.c and stage1scan.c. build: Deterministic scan.c and bootstrap byte comparison check Feb 15, 2020
@Explorer09
Copy link
Contributor Author

Update (2020-02-15): With stage1scan.c being deterministic, I added a byte comparison check (stage2scan.c) here that ensures the generated flex program can build the scanner of itself flawlessly.

@Explorer09
Copy link
Contributor Author

Explorer09 commented Mar 9, 2020

Updated according to @jannick0 's comments. The new version of this pull request now preserves stage2scan.c even if comparison fails. I don't think generating a diff output is good as it could be lengthy. The file is preserved so if you want to make a diff you could do so yourself.

@Explorer09
Copy link
Contributor Author

Hello. It has been years after I made this pull request. Is Will (or other Flex maintainers) still interested in this? I may try to rebase it to the latest main branch if needed.

@westes
Copy link
Owner

westes commented Mar 29, 2024

I'm working my way through the backlog (combination of easy and most important first).

I am 100% interested in this, yes.

@Explorer09 Explorer09 force-pushed the scan-c-determinism branch 6 times, most recently from 094dcd2 to 81e1884 Compare March 30, 2024 14:24
Change the generating rules of scan.c (in dist-hook) and stage1scan.c
so that the source and output file names in #line directives are fixed.
This would allow the scanner results be comparable to each other.

Also in --disable-bootstrap build, the flex binary will now be built
with scan.c directly - no more sedding.

Signed-off-by: Kang-Che Sung <[email protected]>
@westes
Copy link
Owner

westes commented Apr 1, 2024

Could you update this to account for #640?

With stage1scan.c being deterministic, it's possible to add a bootstrap
check that ensures the generated flex program can build the scanner of
itself flawlessly. The check is performed on native build only.

Code is partly inspired from GCC's makefile.

Signed-off-by: Kang-Che Sung <[email protected]>
@Explorer09 Explorer09 force-pushed the scan-c-determinism branch from 81e1884 to 354bdba Compare April 1, 2024 20:19
@Explorer09
Copy link
Contributor Author

Rebased just now.

@westes westes merged commit 4f7f19e into westes:master Apr 2, 2024
3 checks passed
@Explorer09 Explorer09 deleted the scan-c-determinism branch April 2, 2024 11:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants