-
Notifications
You must be signed in to change notification settings - Fork 14
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
Support designated initialization style. #35
Conversation
I don't know if adding a type to the AST is the best thing to do, but I couldn't think of anything else. If you have a better idea, I'd be glad to remove that new type :) |
OK, looks good to merge, but can you please first rebase with master (or merge master, doesn't really matter) so that we can sure that the new set of tests is still passing. There is a small conflict in run.t but it is trivial. |
Concerning the AST changes, I think we have no other choice (though having it in the expression is a little bit weird, but it looks like that it is indeed where it should be). I have only question about the name
Do you have some better reference? |
Thanks, will rename and rebase :) |
You know, after deeper reading, I think your naming is correct (I still can't find any reference in the C99 standard about designated intializers) but at least this document (it is C++ though) states that the deisgnator is the left-hand side of the designated clause (basically the name part), so Please keep it :) |
ah, oops :) |
Fixes BinaryAnalysisPlatform#32. * frontc/cabs.ml: Add `DESIGNATED` expression type for struct initialization. * frontc/cparser.mly: Add rules for compounds (struct initialization). A compound contains a list of expressions or designated, but a standard initialization cannot be a designated outside a compound. * frontc/cprint.ml: Print new AST type. * frontc/ctoxml.ml: Print XML for new designated AST type. * ctoxml/test.t/c99-struct-initializers.c: New test. * ctoxml/test.t/run.t: Update expected output for new test.
There, rebased and kept |
awesome, thanks! |
@roptat, I noticed a new warning,
and indeed it is not used anywhere. Is that expected? Then I will delete it if you don't mind. |
Ha sorry for the lack of reply, I didn't notice yours. I simply copied the rules, and didn't notice init_comma_expression was only used once, so indeed, you can remove it. Thank you! |
Fixes #32.
DESIGNATED
expression type for structinitialization.
compound contains a list of expressions or designated, but a standard
initialization cannot be a designated outside a compound.