-
Notifications
You must be signed in to change notification settings - Fork 725
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
Treat #define similarly to templates when used for types #1044
Comments
I don't think
It gives us the expanded code, and that there was a macro expansion, but the only way we're given to look inside of macros is a stream of tokens. I'm not sure this is something we want to support. |
Well yeah, it gives only stream of tokens, but it can be fed back to clang to detect type definitions? |
It also seems that looking "into" C macro contents this way can reveal other interesting possibilities. |
Input C Header
Actual Results
Expected Results
Note that this is not a bug, but more of a feature request. Is there any chance to produce generic types for this case? (and maybe also for multiple-types case like covered in tests/headers/complex.h, but that's not so important)
Looking at handling of macro in
var.rs
, it should be doable, but I'm not sure if it's worth introducing separate handling / recognition just for macro or is it possible to somehow share the logic between C++ templates and C macro handling? The templates logic seems to be quite complex and scattered across bindgen, so I'm not sure how that would look like, but maybe there is an easy entry point that could be reused?Currently I can workaround this by doing
#ifdef __cplusplus
magic that defines a template for C++ and macro then just instantiates that template, but this hack looks quite ugly and I don't really need it outside of the bindgen.The text was updated successfully, but these errors were encountered: