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

Partial support for self-referencial macros #146

Merged
merged 10 commits into from
Feb 4, 2025

Conversation

laurenthuberdeau
Copy link
Collaborator

@laurenthuberdeau laurenthuberdeau commented Feb 4, 2025

Context

TCC uses self-referential macros. This PR extends pnut's expansion phase to prevent the infinite expansion of self-referential macros. It also adds a few debugging features:

  1. Catch SIGINT signals and print the current location of the reader. This is useful when debugging infinite loops in the tokenizer or parser.
  2. Show the location of the #include when the file cannot be found or read.
  3. Makes it possible to add failing tests (for all backends, not just for specific shells which already existed) to keep of trace of known bugs in pnut.

@laurenthuberdeau laurenthuberdeau force-pushed the laurent/debug-handle-int-signals branch from 0cae2a3 to 3cc6668 Compare February 4, 2025 17:42
@laurenthuberdeau laurenthuberdeau force-pushed the laurent/debug-handle-int-signals branch from 3cc6668 to f042f77 Compare February 4, 2025 17:43
@laurenthuberdeau laurenthuberdeau changed the title Partial support for self-referencial macros and expand token pasted macros Partial support for self-referencial macros Feb 4, 2025
Upon reviewing the changes to the token pasting code, I realized that
pasted tokens already pass through the "is this a macro" check, and so
the changes in d4f87ce were
unnecessary.
@laurenthuberdeau laurenthuberdeau merged commit e2a3c77 into main Feb 4, 2025
37 checks passed
@laurenthuberdeau laurenthuberdeau deleted the laurent/debug-handle-int-signals branch February 4, 2025 19:42
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.

1 participant