[gobject-introspection] scanner: GVariants are also valid to be floating
- From: Colin Walters <walters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gobject-introspection] scanner: GVariants are also valid to be floating
- Date: Mon, 28 Sep 2015 15:18:18 +0000 (UTC)
commit d1086a641d6e46140b13996ff5a3bfbb90662dd5
Author: Colin Walters <walters verbum org>
Date: Mon Sep 28 11:17:07 2015 -0400
scanner: GVariants are also valid to be floating
More followup to https://bugzilla.gnome.org/show_bug.cgi?id=752047
giscanner/maintransformer.py | 5 +++--
tests/scanner/Regress-1.0-expected.gir | 6 ++++++
tests/scanner/Regress-1.0-sections-expected.txt | 1 +
tests/scanner/regress.c | 11 +++++++++++
tests/scanner/regress.h | 3 +++
5 files changed, 24 insertions(+), 2 deletions(-)
---
diff --git a/giscanner/maintransformer.py b/giscanner/maintransformer.py
index 8fb37f8..1b413ed 100644
--- a/giscanner/maintransformer.py
+++ b/giscanner/maintransformer.py
@@ -566,9 +566,10 @@ class MainTransformer(object):
if transfer == OPT_TRANSFER_FLOATING:
transfer = OPT_TRANSFER_NONE
- if not isinstance(target, (ast.Class, ast.Interface)):
+ if (not isinstance(target, (ast.Class, ast.Interface))
+ and node_type.target_giname != 'GLib.Variant'):
message.warn('invalid "transfer" annotation for {0}: '
- 'only valid for object and interface types'.format(target),
+ 'only valid for object and GVariant types'.format(target),
annotations.position)
return
diff --git a/tests/scanner/Regress-1.0-expected.gir b/tests/scanner/Regress-1.0-expected.gir
index bc3d29d..a7589ef 100644
--- a/tests/scanner/Regress-1.0-expected.gir
+++ b/tests/scanner/Regress-1.0-expected.gir
@@ -4776,6 +4776,12 @@ exposed to language bindings.</doc>
</parameter>
</parameters>
</function>
+ <function name="get_variant" c:identifier="regress_get_variant">
+ <return-value transfer-ownership="none">
+ <doc xml:space="preserve">A new variant</doc>
+ <type name="GLib.Variant" c:type="GVariant*"/>
+ </return-value>
+ </function>
<function name="global_get_flags_out"
c:identifier="regress_global_get_flags_out">
<return-value transfer-ownership="none">
diff --git a/tests/scanner/Regress-1.0-sections-expected.txt b/tests/scanner/Regress-1.0-sections-expected.txt
index 665c7be..68d28dd 100644
--- a/tests/scanner/Regress-1.0-sections-expected.txt
+++ b/tests/scanner/Regress-1.0-sections-expected.txt
@@ -47,6 +47,7 @@ regress_foo_test_varargs_callback2
regress_foo_test_varargs_callback3
regress_func_obj_null_in
regress_func_obj_nullable_in
+regress_get_variant
regress_global_get_flags_out
regress_has_parameter_named_attrs
regress_introspectable_via_alias
diff --git a/tests/scanner/regress.c b/tests/scanner/regress.c
index 626b132..43708e9 100644
--- a/tests/scanner/regress.c
+++ b/tests/scanner/regress.c
@@ -4112,3 +4112,14 @@ regress_like_xkl_config_item_set_name (RegressLikeXklConfigItem *self,
strncpy (self->name, name, sizeof (self->name) - 1);
self->name[sizeof(self->name)-1] = '\0';
}
+
+/**
+ * regress_get_variant:
+ *
+ * Returns: (transfer floating): A new variant
+ */
+GVariant *
+regress_get_variant (void)
+{
+ return g_variant_new_int32 (42);
+}
diff --git a/tests/scanner/regress.h b/tests/scanner/regress.h
index a06a236..7cc705f 100644
--- a/tests/scanner/regress.h
+++ b/tests/scanner/regress.h
@@ -1425,4 +1425,7 @@ typedef struct {
};
} RegressAnAnonymousUnion;
+GVariant *
+regress_get_variant (void);
+
#endif /* __GITESTTYPES_H__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]