diff options
author | Philip Withnall <withnall@endlessm.com> | 2019-01-25 11:29:05 +0000 |
---|---|---|
committer | Philip Withnall <withnall@endlessm.com> | 2019-01-25 11:29:05 +0000 |
commit | a8af2862ab3a6207b13b562388b9cfb453c0fa20 (patch) | |
tree | 4fdeed7528e9c739d1b3d921f4820b9e0d0d909a | |
parent | 7035462da0f30875e62dc19fa39dd9a7f5b5841e (diff) | |
download | glib-a8af2862ab3a6207b13b562388b9cfb453c0fa20.tar.gz |
gtypemodule: Cast *_init functions to void(*)(void) first
This is an analogous commit to c1f5e528. The original fix only touched
gtype.h and not gtypemodule.h.
The *_init() functions have prototypes incompatible with *InitFunc types they
are being cast to. This upsets GCC 8's -Wcast-function-type that's enabled by
default with -Wextra.
Let's not have the public header files emit a warning and neutralize it by
doing a void(*)(void) cast first.
Signed-off-by: Philip Withnall <withnall@endlessm.com>
https://gitlab.gnome.org/GNOME/glib/issues/1666
-rw-r--r-- | gobject/gtypemodule.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/gobject/gtypemodule.h b/gobject/gtypemodule.h index deeadcdd3..5c4025063 100644 --- a/gobject/gtypemodule.h +++ b/gobject/gtypemodule.h @@ -204,12 +204,12 @@ type_name##_register_type (GTypeModule *type_module) \ sizeof (TypeName##Class), \ (GBaseInitFunc) NULL, \ (GBaseFinalizeFunc) NULL, \ - (GClassInitFunc) type_name##_class_intern_init, \ - (GClassFinalizeFunc) type_name##_class_finalize, \ + (GClassInitFunc)(void (*)(void)) type_name##_class_intern_init, \ + (GClassFinalizeFunc)(void (*)(void)) type_name##_class_finalize, \ NULL, /* class_data */ \ sizeof (TypeName), \ 0, /* n_preallocs */ \ - (GInstanceInitFunc) type_name##_init, \ + (GInstanceInitFunc)(void (*)(void)) type_name##_init, \ NULL /* value_table */ \ }; \ type_name##_type_id = g_type_module_register_type (type_module, \ @@ -238,7 +238,7 @@ type_name##_register_type (GTypeModule *type_module) \ */ #define G_IMPLEMENT_INTERFACE_DYNAMIC(TYPE_IFACE, iface_init) { \ const GInterfaceInfo g_implement_interface_info = { \ - (GInterfaceInitFunc) iface_init, NULL, NULL \ + (GInterfaceInitFunc)(void (*)(void)) iface_init, NULL, NULL \ }; \ g_type_module_add_interface (type_module, g_define_type_id, TYPE_IFACE, &g_implement_interface_info); \ } |