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 Issue 22028 - importC: Parser accepts initializers for struct members #12692

Merged
merged 1 commit into from Jun 17, 2021

Conversation

ibuclaw
Copy link
Member

@ibuclaw ibuclaw commented Jun 16, 2021

Adds cparseStructDeclaration, a stripped down version of cparseDeclaration that only deals with parsing a struct-declaration as per C11 6.7.2 (renamed to member-declaration in C2X 6.7.2).

Removing dead code from cparseDeclaration to be done in a follow-up PR. There's also room for de-duplicating the two, but again such refactoring will be done in subsequent follow-ups if it makes sense.

@ibuclaw ibuclaw added Bug Fix ImportC Pertaining to ImportC support labels Jun 16, 2021
@dlang-bot
Copy link
Contributor

Thanks for your pull request, @ibuclaw!

Bugzilla references

Auto-close Bugzilla Severity Description
22028 normal importC: Parser accepts initializers for struct members

Testing this PR locally

If you don't have a local development environment setup, you can use Digger to test this PR:

dub run digger -- build "master + dmd#12692"

@thewilsonator
Copy link
Contributor

src/dmd/cparse.d(1750): Error: function `dmd.cparse.CParser!(ASTCodegen).CParser.cparseDeclarator(DTR declarator, Type t, out Identifier pident, ulong storageClass = 0LU)` is not callable using argument types `(Type, Identifier)`
src/dmd/cparse.d(1750):        cannot pass argument `tspec` of type `dmd.mtype.Type` to parameter `DTR declarator`
src/dmd/dmodule.d(1054): Error: template instance `dmd.cparse.CParser!(ASTCodegen)` error instantiating
src/dmd/dmodule.d(785):        instantiated from here: `parseModule!(ASTCodegen)`

@ibuclaw
Copy link
Member Author

ibuclaw commented Jun 17, 2021

src/dmd/cparse.d(1750): Error: function `dmd.cparse.CParser!(ASTCodegen).CParser.cparseDeclarator(DTR declarator, Type t, out Identifier pident, ulong storageClass = 0LU)` is not callable using argument types `(Type, Identifier)`
src/dmd/cparse.d(1750):        cannot pass argument `tspec` of type `dmd.mtype.Type` to parameter `DTR declarator`
src/dmd/dmodule.d(1054): Error: template instance `dmd.cparse.CParser!(ASTCodegen)` error instantiating
src/dmd/dmodule.d(785):        instantiated from here: `parseModule!(ASTCodegen)`

Yes, I knew ahead of time that this would need adjusting if #12691 went in first.

Copy link
Contributor

@thewilsonator thewilsonator left a comment

Choose a reason for hiding this comment

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

Leaving merging to you

@ibuclaw
Copy link
Member Author

ibuclaw commented Jun 17, 2021

Rebased, ping @WalterBright

src/dmd/cparse.d Outdated Show resolved Hide resolved
src/dmd/cparse.d Outdated Show resolved Hide resolved
@ibuclaw ibuclaw force-pushed the issue22028 branch 4 times, most recently from a52d7d8 to b42f415 Compare June 17, 2021 11:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Fix ImportC Pertaining to ImportC support
Projects
None yet
4 participants