diff options
author | Garrett Regier <garrett.regier@riftio.com> | 2015-09-26 11:55:09 -0400 |
---|---|---|
committer | Colin Walters <walters@verbum.org> | 2015-09-26 11:55:09 -0400 |
commit | 5ae7bd58b6266997b61d897ad6562118eeb59210 (patch) | |
tree | c68c962a7c690969471531369b07ea4dbef9a77a /tests | |
parent | b503f31c7cfa3329456de9bff5a2c816a607285e (diff) | |
download | gobject-introspection-5ae7bd58b6266997b61d897ad6562118eeb59210.tar.gz |
scanner: Warn and ignore on incorrect transfer annotations
This is an issue in various code bases and tends
to confuse newcomers.
https://bugzilla.gnome.org/show_bug.cgi?id=752047
Signed-off-by: Garrett Regier <garrett.regier@riftio.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/gimarshallingtests.c | 2 | ||||
-rw-r--r-- | tests/scanner/Regress-1.0-expected.gir | 2 | ||||
-rw-r--r-- | tests/warn/invalid-transfer.h | 32 |
3 files changed, 30 insertions, 6 deletions
diff --git a/tests/gimarshallingtests.c b/tests/gimarshallingtests.c index 76beb92e..69311de7 100644 --- a/tests/gimarshallingtests.c +++ b/tests/gimarshallingtests.c @@ -3409,7 +3409,7 @@ glong /** * gi_marshalling_tests_pointer_in_return: * - * Returns: (transfer none): The same pointer + * Returns: The same pointer */ gpointer gi_marshalling_tests_pointer_in_return (gpointer pointer) diff --git a/tests/scanner/Regress-1.0-expected.gir b/tests/scanner/Regress-1.0-expected.gir index aeb3fdbc..bc3d29dc 100644 --- a/tests/scanner/Regress-1.0-expected.gir +++ b/tests/scanner/Regress-1.0-expected.gir @@ -1461,7 +1461,7 @@ uses a C sugar return type.</doc> c:identifier="regress_foo_object_new_cookie" introspectable="0"> <doc xml:space="preserve">Not sure why this test is here...</doc> - <return-value> + <return-value transfer-ownership="none"> <type name="FooObjectCookie" c:type="RegressFooObjectCookie"/> </return-value> <parameters> diff --git a/tests/warn/invalid-transfer.h b/tests/warn/invalid-transfer.h index ec43f2ac..054bb768 100644 --- a/tests/warn/invalid-transfer.h +++ b/tests/warn/invalid-transfer.h @@ -1,12 +1,36 @@ +#include "common.h" + +typedef char TestChar; /** * test_transfer_invalid: * @param: (transfer): * @param2: (transfer invalid): * @param3: (transfer full foo): + * @param4: (transfer full): + * @param5: (transfer full): + * @param6: (transfer full): + * @param7: (transfer container): + * @param8: (transfer floating): + */ +void test_transfer_invalid(GObject *param, GObject *param2, GObject *param3, + char param4, TestChar param5, GType param6, + GObject *param7, GDateTime *param8); + +// EXPECT:7: Warning: Test: "transfer" annotation needs one option, none given +// EXPECT:8: Warning: Test: invalid "transfer" annotation option: "invalid" +// EXPECT:9: Warning: Test: "transfer" annotation needs one option, 2 given +// EXPECT:10: Warning: Test: invalid "transfer" annotation: only valid for array, struct, union, boxed, object and interface types +// EXPECT:11: Warning: Test: invalid "transfer" annotation: only valid for array, struct, union, boxed, object and interface types +// EXPECT:12: Warning: Test: invalid "transfer" annotation: only valid for array, struct, union, boxed, object and interface types +// EXPECT:13: Warning: Test: invalid "transfer" annotation: only valid for container types +// EXPECT:14: Warning: Test: invalid "transfer" annotation: only valid for object and interface types + +/** + * test_transfer_return_invalid: + * + * Returns: (transfer full): */ -void test_transfer_invalid(int param, int param2, int param3); +char test_transfer_return_invalid (void); -// EXPECT:4: Warning: Test: "transfer" annotation needs one option, none given -// EXPECT:5: Warning: Test: invalid "transfer" annotation option: "invalid" -// EXPECT:6: Warning: Test: "transfer" annotation needs one option, 2 given +// EXPECT:32: Warning: Test: invalid "transfer" annotation: only valid for array, struct, union, boxed, object and interface types |