diff options
author | Torsten Schönfeld <kaffeetisch@gmx.de> | 2012-08-18 00:27:21 +0200 |
---|---|---|
committer | Torsten Schönfeld <kaffeetisch@gmx.de> | 2012-08-21 20:52:03 +0200 |
commit | b0b4c98b31a23e6885b6c0785df93404b161b4b7 (patch) | |
tree | 5ab549951ea665416baaefa16f95b72175909009 /tests/scanner | |
parent | 0389b06d2dc800178d1e02446d0d6ce8d7c0bda4 (diff) | |
download | gobject-introspection-b0b4c98b31a23e6885b6c0785df93404b161b4b7.tar.gz |
scanner: methods cannot have an out-arg as their first arg
This ensures that if the first argument of a function like
gboolean gdk_rgba_parse (GdkRGBA *rgba, const gchar *spec);
is annotated as being an out-arg, the result is a class function with two
arguments, not a method with one argument. Previously, the (out) annotation
was simply ignored.
https://bugzilla.gnome.org/show_bug.cgi?id=682124
Diffstat (limited to 'tests/scanner')
-rw-r--r-- | tests/scanner/Regress-1.0-expected.gir | 38 | ||||
-rw-r--r-- | tests/scanner/regress.c | 12 | ||||
-rw-r--r-- | tests/scanner/regress.h | 1 |
3 files changed, 51 insertions, 0 deletions
diff --git a/tests/scanner/Regress-1.0-expected.gir b/tests/scanner/Regress-1.0-expected.gir index e954705b..1d826766 100644 --- a/tests/scanner/Regress-1.0-expected.gir +++ b/tests/scanner/Regress-1.0-expected.gir @@ -1444,6 +1444,24 @@ Use with regress_test_obj_emit_sig_with_obj</doc> </parameter> </parameters> </method> + <function name="parse" c:identifier="regress_test_struct_a_parse"> + <return-value transfer-ownership="none"> + <type name="none" c:type="void"/> + </return-value> + <parameters> + <parameter name="a_out" + direction="out" + caller-allocates="1" + transfer-ownership="none"> + <doc xml:whitespace="preserve">the structure that is to be filled</doc> + <type name="TestStructA" c:type="RegressTestStructA*"/> + </parameter> + <parameter name="string" transfer-ownership="none"> + <doc xml:whitespace="preserve">ignored</doc> + <type name="utf8" c:type="const gchar*"/> + </parameter> + </parameters> + </function> </record> <record name="TestStructB" c:type="RegressTestStructB"> <field name="some_int8" writable="1"> @@ -3059,6 +3077,26 @@ What we're testing here is that the scanner ignores the @a nested inside XML.</d </parameter> </parameters> </function> + <function name="test_struct_a_parse" + c:identifier="regress_test_struct_a_parse" + moved-to="TestStructA.parse"> + <return-value transfer-ownership="none"> + <type name="none" c:type="void"/> + </return-value> + <parameters> + <parameter name="a_out" + direction="out" + caller-allocates="1" + transfer-ownership="none"> + <doc xml:whitespace="preserve">the structure that is to be filled</doc> + <type name="TestStructA" c:type="RegressTestStructA*"/> + </parameter> + <parameter name="string" transfer-ownership="none"> + <doc xml:whitespace="preserve">ignored</doc> + <type name="utf8" c:type="const gchar*"/> + </parameter> + </parameters> + </function> <function name="test_strv_in" c:identifier="regress_test_strv_in"> <return-value transfer-ownership="none"> <type name="gboolean" c:type="gboolean"/> diff --git a/tests/scanner/regress.c b/tests/scanner/regress.c index 910f01a5..e72c5aa7 100644 --- a/tests/scanner/regress.c +++ b/tests/scanner/regress.c @@ -1673,6 +1673,18 @@ regress_test_struct_a_clone (RegressTestStructA *a, } /** + * regress_test_struct_a_parse: + * @a_out: (out caller-allocates): the structure that is to be filled + * @string: ignored + */ +void +regress_test_struct_a_parse (RegressTestStructA *a_out, + const gchar *string) +{ + a_out->some_int = 23; +} + +/** * regress_test_struct_b_clone: * @b: the structure * @b_out: (out): the cloned structure diff --git a/tests/scanner/regress.h b/tests/scanner/regress.h index d6bdacb2..949a3764 100644 --- a/tests/scanner/regress.h +++ b/tests/scanner/regress.h @@ -282,6 +282,7 @@ struct _RegressTestStructA void regress_test_struct_a_clone (RegressTestStructA *a, RegressTestStructA *a_out); +void regress_test_struct_a_parse (RegressTestStructA *a_out, const gchar *string); struct _RegressTestStructB { |