-
-
Notifications
You must be signed in to change notification settings - Fork 47
glib: fix ABI issues with macros/constants #135
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
| <doc xml:space="preserve">Multiplying the base 2 exponent by this number yields the base 10 exponent.</doc> | ||
| <type name="gdouble" c:type="gdouble"/> | ||
| </constant> | ||
| <constant name="LOG_DOMAIN" value="0" c:type="G_LOG_DOMAIN"> |
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.
Instead this can be ignored in the Gir.toml file which will drop it from the ffi tests
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.
I tried that but couldn't get it to work, let me try again
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.
we do that in gtk for the version constants for example
| <doc xml:space="preserve">log level for debug messages, see g_debug()</doc> | ||
| </member> | ||
| <member name="level_mask" value="-4" c:identifier="G_LOG_LEVEL_MASK"> | ||
| <member name="level_mask" value="4294967292" c:identifier="G_LOG_LEVEL_MASK"> |
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.
shouldn't this be fixed upstream?
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.
You can add (type uint) annotation for this IIRC
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.
And (value 4294967292). That's done in GStreamer in many places. It also confuses the Python bindings if you don't do that, but I guess nobody is using G_LOG_LEVEL_MASK from Python.
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.
I think we have this problem with any flags type, we consider them u32 but in C anything in an enum has to be int. Maybe I will just have gir cast them to unsigned
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.
Yeah it looks like those annotations won't work on an enum constant, they only work on a #define
| </parameter> | ||
| </parameters> | ||
| </function-macro> | ||
| <constant name="macro__has_attribute___noreturn__" value="0" c:type="g_macro__has_attribute___noreturn__"> |
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.
Similar to the other constant
|
Closing in favor of more stuff in gtk-rs-core/gir#1409 |
Part of gtk-rs/gtk-rs-core#64
g_macro__has_attribute___noreturn__andG_LOG_DOMAINare used for C macros, should not be in ffi at allG_LOG_LEVEL_MASKis considered unsigned by rust but C defines it as signed