GNOME Bugzilla – Bug 615923
g-i failed to parse enum
Last modified: 2018-01-24 17:01:47 UTC
<enumeration name="ContactFeature" doc=".... cut ...." version="0.7.18" c:type="TpContactFeature"> <member name="p_contact_feature_alias" value="0" c:identifier="TP_CONTACT_FEATURE_ALIAS"/> <member name="p_contact_feature_avatar_token" value="1" c:identifier="TP_CONTACT_FEATURE_AVATAR_TOKEN"/> <member name="p_contact_feature_presence" value="2" c:identifier="TP_CONTACT_FEATURE_PRESENCE"/> <member name="p_contact_feature_location" value="3" c:identifier="TP_CONTACT_FEATURE_LOCATION"/> <member name="um_tp_contact_features" value="4" c:identifier="NUM_TP_CONTACT_FEATURES"/> </enumeration> typedef enum { TP_CONTACT_FEATURE_ALIAS, TP_CONTACT_FEATURE_AVATAR_TOKEN, TP_CONTACT_FEATURE_PRESENCE, TP_CONTACT_FEATURE_LOCATION, NUM_TP_CONTACT_FEATURES } TpContactFeature; Guessing that NUM_TP_CONTACT_FEATURES breaks it. Is there a way to skip this value from the introspected output?
We could work around this by turning NUM_TP_CONTACT_FEATURES into a #define like we do in telepathy-glib's generated code, as it's (strictly speaking) not really part of the enum.
Can you retry this on trunk, the recent scanner rewrite might have fixed this.
Still an issue.
three years passed: is this still a problem in Telepathy? to be fair, the last enumeration value is pretty much against all best practises for enumeration values in GObject; I'm actually surprised it does not break glib-mkenums as well.
(In reply to comment #4) > three years passed: is this still a problem in Telepathy? We avoided it, initially by turning it into a #define, then later by renaming it to TP_NUM_THINGS. I think it makes more sense for it to be a #define anyway, tbh - it isn't a valid value of TpContactFeature (and when we add more features, its value will increase so it *still* isn't a valid value), so it should be outside the enum. > to be fair, the last enumeration value is pretty much against all best > practises for enumeration values in GObject Yeah, I'd be OK with calling this INVALID or something.
[Mass-moving gobject-introspection tickets to its own Bugzilla product - see bug 708029. Mass-filter your bugmail for this message: introspection20150207 ]
Closing as NOTABUG, as per comment 5