glib: fix ABI issues with macros/constants#135
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.
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.
I tried that but couldn't get it to work, let me try again
There was a problem hiding this comment.
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.
shouldn't this be fixed upstream?
There was a problem hiding this comment.
You can add (type uint) annotation for this IIRC
There was a problem hiding this comment.
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.
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.
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.
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