diff options
author | Emmanuele Bassi <ebassi@gnome.org> | 2022-07-13 12:45:57 +0100 |
---|---|---|
committer | Emmanuele Bassi <ebassi@gmail.com> | 2023-01-08 21:48:45 +0000 |
commit | 8d44bd13940649a708c8a2186cd3ba58ce6fc503 (patch) | |
tree | 390c0457dc2939502a7c7a1e15e8b933fc1145d7 /giscanner/gdumpparser.py | |
parent | 9ffbdd3738b02a0220c8d9156babf20e0c5ff7d4 (diff) | |
download | gobject-introspection-8d44bd13940649a708c8a2186cd3ba58ce6fc503.tar.gz |
Split disguised attribute into two
The disguised attribute started off as a way to indicate a typedef to a
structure pointer, e.g.
typedef struct Foo* FooPtr;
Over the years, though, it started to include opaque structure types,
e.g.
typedef struct _FooObject FooObject;
typedef struct _FooObjectClass FooObjectClass;
This has led to issues in language bindings, code generators, and
documentation generators, which now have issues when dealing with both
pointer aliases and opaque types.
An initial attempt at fixing this mess in commit f606183a ended up
breaking Vala, and had to be reverted.
To avoid breaking existing users we can follow a similar approach to the
allow-none/nullable/optional solution:
1. introduce a new pair of attributes: "pointer" and "opaque"
2. deprecate the "disguised" attribute
The "pointer" attribute covers the case of pointer types.
The "opaque" attribute covers the case of opaque structured types.
See also: https://gitlab.gnome.org/GNOME/vala/-/issues/735
Fixes: #101
Diffstat (limited to 'giscanner/gdumpparser.py')
-rw-r--r-- | giscanner/gdumpparser.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/giscanner/gdumpparser.py b/giscanner/gdumpparser.py index b5ca4362..10cbcc91 100644 --- a/giscanner/gdumpparser.py +++ b/giscanner/gdumpparser.py @@ -229,7 +229,10 @@ blob containing data gleaned from GObject's primitive introspection.""" get_type='intern', c_symbol_prefix='variant') elif record.name == 'InitiallyUnownedClass': + # InitiallyUnowned is just GObject with extra steps, so we alias + # it in the introspection data record.fields = self._namespace.get('ObjectClass').fields + record.opaque = False record.disguised = False # Introspection over the data we get from the dynamic @@ -522,8 +525,9 @@ different --identifier-prefix.""" % (xmlnode.attrib['name'], self._namespace.ide pair_node.add_gtype(boxed.gtype_name, boxed.get_type) assert boxed.c_symbol_prefix is not None pair_node.c_symbol_prefix = boxed.c_symbol_prefix - # Quick hack - reset the disguised flag; we're setting it - # incorrectly in the scanner + # Backward compatibility hack - reset the disguised flag; we're + # setting it incorrectly in the scanner. We don't change the + # opaque flag, because it's a new one and we define its behavior pair_node.disguised = False else: return False |