GNOME Bugzilla – Bug 688356
typedef + define = bad gir
Last modified: 2015-02-07 17:01:39 UTC
The following, fairly common, C idiom typedef guint32 PangoGlyph; #define PANGO_GLYPH_EMPTY ((PangoGlyph)0xfffffffff) Produces this in the .gir: <constant name="GLYPH_EMPTY" value="268435455" c:type="PANGO_GLYPH_EMPTY"> <type c:type="PangoGlyph"/> </constant> Which then fails in gir-compile with Pango-1.0.gir:40:34: error: Line 40, character 34: The attribute 'name' on the element 'type' must be specified error parsing file Pango-1.0.gir: Line 40, character 34: The attribute 'name' on the element 'type' must be specified I attempted to coerce the type back to guint32 with a (type) annotation on PANGO_GLYPH_EMPTY, but it was ignored. One can work around the problem by converting the define to an enum: enum { PANGO_GLYPH_EMPTY = ((PangoGlyph)0xffffffff) }; but ISTM g-i should handle the define case as well.
With latest release of gobject-introspection, this seems to be fixed: <constant name="GLYPH_EMPTY" value="268435455" c:type="PANGO_GLYPH_EMPTY"> <type name="Glyph" c:type="PangoGlyph"/> </constant> Maybe we could revert http://git.gnome.org/browse/pango/commit/pango/pango-font.h?id=7274bd56db3ce2f02594687a307d22aa99c787c4 and depend on a newer version of g-i ? (this said commit causes warnings to be emitted when compiling client gtk code with -pedantic: /usr/include/pango-1.0/pango/pango-font.h:380:33: warning: ISO C restricts enumerator values to range of ‘int’ [-pedantic])
Reverted. Indeed, I couldn't get the bug to replicate even with earlier versions of g-ir-scanner, so I've no idea at this point what was going wrong.
[Mass-moving gobject-introspection tickets to its own Bugzilla product - see bug 708029. Mass-filter your bugmail for this message: introspection20150207 ]