Skip to content

Allow modifying macro tokens at parse time #3211

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

igelado
Copy link

@igelado igelado commented May 23, 2025

This a rerun of PR #2119. The goal is to provide a callback to allow modifying the tokens when parsing macros to handle values that are non-standard. As described in the original PR, I have several header files which contains things like:

#define FLAG_BITS            8:10

In my specific case, these values are later on used within a ternary operator. This PR enables transforming those values into a valid integer that generates a valid integer constant.

@gonzalobg
Copy link

This is really useful. cc @emilio

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