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

fix(parser): fix variadic macro #3229

Merged
merged 1 commit into from
Apr 2, 2024
Merged

Conversation

ObserverOfTime
Copy link
Member

@ObserverOfTime ObserverOfTime commented Mar 28, 2024

Problem

Compiling a parser with -pedantic warns that the REDUCE macro must have at least one variadic argument. This is innocuous since the macro does not expand into a function call, which prohibits trailing commas, but into a struct initialiser, where they are allowed. The warning can be silenced in clang but not in GCC. (MSVC doesn't care.)

Solution

Move all arguments into the variadic list.

Closes #3227

Alternatives

Separate into a macro with arguments and one without

That would make the generator more complicated.

Change the std to gnu11

No reason to do that just for this easily fixable warning.

Copy link
Contributor

@DavisVaughan DavisVaughan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this idea!

@amaanq amaanq merged commit 78b6067 into tree-sitter:master Apr 2, 2024
12 checks passed
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.

Compiling generated grammar parser.c files with -pedantic throws a warning about REDUCE()
3 participants