-
Notifications
You must be signed in to change notification settings - Fork 263
Add unions for ICD2 tags in cl_icd_dispatch #280
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
Conversation
rust bug for reference: rust-lang/rust#141660 |
I love the suggestion, but there is another instance of anonymous union where guards exist: Lines 137 to 167 in 1ce4f1c
I think we would need something similar to enable this. |
mhhh.. not a big fan of replicating the same code block, but maybe this can be moved into a macro or some sorts. Will play around with it later. |
We already have helper macros in cl_platform.h we can use instead of the current mess.
Turns out there were already a bit of helper macros in cl_platform for anonymous structs we can also reuse for unions. Cleaned up code in cl.h and used the more streamlined stuff in cl_icd.h as well |
434c119
to
e245a57
Compare
I need this, because otherwise rustc doesn't let me use a constant in place of a function pointer. But I think being more explicit here would make the code a bit cleaner for loader implementors.
Looking good, and generally an improvement I think. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
I'm a little nervous about losing some compiler-specific warning suppression, but if the macros are working well for the other anonymous structs, they should work fine here, too.
yeah.. I've checked clang docs and it uses The only part I'm a bit more concerned about is MSVC and the pop/push of the warning is a bit global. Maybe they have a similar mechanism like |
We can rerun the CI in KhronosGroup/OpenCL-ICD-Loader#252 once this one is merged as an additional check. |
Merging as discussed in the June 17th teleconference. |
This requires C11/C++11 as support for anonymous unions got added there.
I need this, because otherwise rustc doesn't let me use a constant in place of a function pointer. But I think being more explicit here would make the code a bit cleaner for loader implementors.