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 | |
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.
-rw-r--r-- | configure.ac | 2 | ||||
-rw-r--r-- | girepository/girepository.c | 2 | ||||
-rw-r--r-- | girepository/gitypelib.c | 2 | ||||
-rw-r--r-- | giscanner/giscannermodule.c | 4 | ||||
-rw-r--r-- | giscanner/sourcescanner.c | 6 | ||||
-rw-r--r-- | tests/scanner/foo.c | 16 | ||||
-rw-r--r-- | tests/scanner/regress.c | 2 |
7 files changed, 23 insertions, 11 deletions
diff --git a/configure.ac b/configure.ac index 80475973..52536129 100644 --- a/configure.ac +++ b/configure.ac @@ -65,7 +65,7 @@ AX_COMPILER_FLAGS(,, [yes]) # These get triggered a lot, not worth it imo, but feel free to fix them AX_APPEND_COMPILE_FLAGS([-Wno-duplicated-branches -Wno-switch-enum]) # FIXME: Fix the warnings and remove the flags -AX_APPEND_COMPILE_FLAGS([-Wno-redundant-decls -Wno-switch-default -Wno-shadow -Wno-deprecated-declarations -Wno-cast-function-type -Wno-type-limits]) +AX_APPEND_COMPILE_FLAGS([-Wno-redundant-decls -Wno-switch-default -Wno-shadow -Wno-deprecated-declarations -Wno-type-limits]) AX_APPEND_COMPILE_FLAGS([-Wno-implicit-fallthrough -Wno-sign-compare]) WARN_CFLAGS_PYTHON="$WARN_CFLAGS" diff --git a/girepository/girepository.c b/girepository/girepository.c index 10282c72..6ffb3aa8 100644 --- a/girepository/girepository.c +++ b/girepository/girepository.c @@ -1362,7 +1362,7 @@ find_namespace_latest (const gchar *namespace, *path_ret = elected->path; *version_ret = elected->version; g_slice_free (struct NamespaceVersionCandidadate, elected); /* just free the container */ - g_slist_foreach (candidates, (GFunc) free_candidate, NULL); + g_slist_foreach (candidates, (GFunc) (void *) free_candidate, NULL); g_slist_free (candidates); } return result; diff --git a/girepository/gitypelib.c b/girepository/gitypelib.c index f2b20607..1e33c6af 100644 --- a/girepository/gitypelib.c +++ b/girepository/gitypelib.c @@ -2455,7 +2455,7 @@ g_typelib_free (GITypelib *typelib) g_free (typelib->data); if (typelib->modules) { - g_list_foreach (typelib->modules, (GFunc) g_module_close, NULL); + g_list_foreach (typelib->modules, (GFunc) (void *) g_module_close, NULL); g_list_free (typelib->modules); } g_slice_free (GITypelib, typelib); diff --git a/giscanner/giscannermodule.c b/giscanner/giscannermodule.c index 2a735978..a024f1a0 100644 --- a/giscanner/giscannermodule.c +++ b/giscanner/giscannermodule.c @@ -495,7 +495,7 @@ pygi_source_scanner_set_macro_scan (PyGISourceScanner *self, } static PyObject * -pygi_source_scanner_get_symbols (PyGISourceScanner *self) +pygi_source_scanner_get_symbols (PyGISourceScanner *self, G_GNUC_UNUSED PyObject *unused) { GSList *l, *symbols; PyObject *list; @@ -516,7 +516,7 @@ pygi_source_scanner_get_symbols (PyGISourceScanner *self) } static PyObject * -pygi_source_scanner_get_comments (PyGISourceScanner *self) +pygi_source_scanner_get_comments (PyGISourceScanner *self, G_GNUC_UNUSED PyObject *unused) { GSList *l, *comments; PyObject *list; diff --git a/giscanner/sourcescanner.c b/giscanner/sourcescanner.c index 8c400171..464e4695 100644 --- a/giscanner/sourcescanner.c +++ b/giscanner/sourcescanner.c @@ -39,7 +39,7 @@ void ctype_free (GISourceType * type) { g_free (type->name); - g_list_foreach (type->child_list, (GFunc)gi_source_symbol_unref, NULL); + g_list_foreach (type->child_list, (GFunc)(void *)gi_source_symbol_unref, NULL); g_list_free (type->child_list); g_slice_free (GISourceType, type); } @@ -242,9 +242,9 @@ gi_source_scanner_free (GISourceScanner *scanner) g_hash_table_destroy (scanner->typedef_table); g_hash_table_destroy (scanner->const_table); - g_slist_foreach (scanner->comments, (GFunc)gi_source_comment_free, NULL); + g_slist_foreach (scanner->comments, (GFunc)(void *)gi_source_comment_free, NULL); g_slist_free (scanner->comments); - g_slist_foreach (scanner->symbols, (GFunc)gi_source_symbol_unref, NULL); + g_slist_foreach (scanner->symbols, (GFunc)(void *)gi_source_symbol_unref, NULL); g_slist_free (scanner->symbols); g_hash_table_unref (scanner->files); 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: |