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

C2016: C requires that a struct or union have at least one member #4

Closed
rsteube opened this issue Oct 18, 2023 · 3 comments · Fixed by #5
Closed

C2016: C requires that a struct or union have at least one member #4

rsteube opened this issue Oct 18, 2023 · 3 comments · Fixed by #5

Comments

@rsteube
Copy link
Contributor

rsteube commented Oct 18, 2023

I'm trying to add this to helix.
But compilation fails with C2016:

D:\a\helix\helix\runtime\grammars\sources\templ\src\scanner.c(67): warning C4189: 'found': local variable is initialized but not referenced
D:\a\helix\helix\runtime\grammars\sources\templ\src\scanner.c(93): error C2016: C requires that a struct or union have at least one member
D:\a\helix\helix\runtime\grammars\sources\templ\src\scanner.c(341): warning C4244: 'function': conversion from 'int32_t' to 'wint_t', possible loss of data

Adding a dummy member seems to fix it:

diff --git a/src/scanner.c b/src/scanner.c
index bde6561..efaa773 100644
--- a/src/scanner.c
+++ b/src/scanner.c
@@ -90,6 +90,7 @@ enum TokenType {
 };
 
 typedef struct {
+  bool dummy;
 } Scanner;
 
 static unsigned serialize(Scanner *scanner, char *buffer) { return 0; }

But as I understand the scanner.c file is generated by tree-sitter?

@vrischmann
Copy link
Owner

Yes the scanner is generated, I don't think I can do much about this.

You could try to use gcc with mingw ? I have no experience using treesitter on Windows unfortunately, I can't help you there.

@rsteube
Copy link
Contributor Author

rsteube commented Oct 18, 2023

Oh wait, is that true? Seems to me like the parser.c is generated, but scanner.c is updated by hand.

@vrischmann
Copy link
Owner

You're right, my bad I remembered incorrectly.

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 a pull request may close this issue.

2 participants