diff options
author | Christoph Reiter <reiter.christoph@gmail.com> | 2018-07-29 15:24:59 +0200 |
---|---|---|
committer | Christoph Reiter <reiter.christoph@gmail.com> | 2018-07-29 18:56:58 +0200 |
commit | 54e8b9b96e4553b4a05e95612d0a91677e85f9e8 (patch) | |
tree | 94cd99b3f91321b55bf33d015441efcf7e0fc55c /tests | |
parent | 769f7602dc5762fe1df3c44a0dd2f2b2fcc39dd8 (diff) | |
download | gobject-introspection-54e8b9b96e4553b4a05e95612d0a91677e85f9e8.tar.gz |
build: enable -Wcast-function-type
Where it's easy add dummy args to match the cast; where the target is a subset just
prevent the warning with a cast to void*.
Provide a real copy function for the boxed type code in regress_foo.
This code is never executed afaics, but why not.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/scanner/foo.c | 16 | ||||
-rw-r--r-- | tests/scanner/regress.c | 2 |
2 files changed, 15 insertions, 3 deletions
diff --git a/tests/scanner/foo.c b/tests/scanner/foo.c index 66b29845..a574a8ef 100644 --- a/tests/scanner/foo.c +++ b/tests/scanner/foo.c @@ -466,6 +466,12 @@ regress_foo_dbus_data_get_type (void) return our_type; } +static RegressFooBRect * +regress_foo_brect_copy (const RegressFooBRect *boxed) +{ + return (RegressFooBRect *)g_memdup (boxed, sizeof (RegressFooBRect)); +} + GType regress_foo_brect_get_type (void) { @@ -473,11 +479,17 @@ regress_foo_brect_get_type (void) if (our_type == 0) our_type = g_boxed_type_register_static ("RegressFooBRect", - (GBoxedCopyFunc) g_memdup, /* Won't work */ + (GBoxedCopyFunc) regress_foo_brect_copy, (GBoxedFreeFunc) g_free); return our_type; } +static RegressFooBUnion * +regress_foo_bunion_copy (const RegressFooBUnion *boxed) +{ + return (RegressFooBUnion *)g_memdup (boxed, sizeof (RegressFooBUnion)); +} + GType regress_foo_bunion_get_type (void) { @@ -485,7 +497,7 @@ regress_foo_bunion_get_type (void) if (our_type == 0) our_type = g_boxed_type_register_static ("RegressFooBUnion", - (GBoxedCopyFunc) g_memdup, /* Won't work */ + (GBoxedCopyFunc) regress_foo_bunion_copy, (GBoxedFreeFunc) g_free); return our_type; } diff --git a/tests/scanner/regress.c b/tests/scanner/regress.c index 29652caa..2302209f 100644 --- a/tests/scanner/regress.c +++ b/tests/scanner/regress.c @@ -2137,7 +2137,7 @@ regress_test_obj_set_property (GObject *object, case PROP_TEST_OBJ_LIST_OLD: g_list_free_full (self->list, g_free); list = g_value_get_pointer (value); - self->list = g_list_copy_deep (list, (GCopyFunc) g_strdup, NULL); + self->list = g_list_copy_deep (list, (GCopyFunc) (void *) g_strdup, NULL); break; case PROP_TEST_OBJ_INT: |