all: fix -Wcast-function-type warnings

GCC 8.0's -Wcast-function-type objects casting function pointers to ones
with incompatible prototypes. Sometimes we do that on purpose though.

Notably, the g_source_set_callback()'s func argument can point to functions
of various prototypes. Also, libnm-glib/nm-remote-connection is perhaps
just not worth reworking, that would just be a waste of time.

A cast to void(*)(void) avoids the GCC warning, let's use it.
This commit is contained in:
Lubomir Rintel 2018-02-07 18:08:58 +00:00
parent 3113e193c0
commit ee916a1e9e
3 changed files with 9 additions and 9 deletions

View file

@ -360,7 +360,7 @@ nmt_newt_form_real_show (NmtNewtForm *form)
keypress_source = g_io_create_watch (io, G_IO_IN);
g_source_set_can_recurse (keypress_source, TRUE);
g_source_set_callback (keypress_source,
(GSourceFunc) nmt_newt_form_keypress_callback,
(GSourceFunc)(void (*) (void)) nmt_newt_form_keypress_callback,
NULL, NULL);
g_source_attach (keypress_source, NULL);
g_io_channel_unref (io);

View file

@ -218,7 +218,7 @@ proxy_destroy_cb (DBusGProxy* proxy, gpointer user_data) {
static void
result_cb (RemoteCall *call, DBusGProxyCall *proxy_call, GError *error)
{
NMRemoteConnectionResultFunc func = (NMRemoteConnectionResultFunc) call->callback;
NMRemoteConnectionResultFunc func = (NMRemoteConnectionResultFunc)(void (*) (void)) call->callback;
GError *local_error = NULL;
if (!error) {
@ -254,7 +254,7 @@ nm_remote_connection_commit_changes (NMRemoteConnection *self,
priv = NM_REMOTE_CONNECTION_GET_PRIVATE (self);
call = remote_call_new (self, result_cb, (GFunc) callback, user_data);
call = remote_call_new (self, result_cb, (GFunc)(void (*) (void)) callback, user_data);
if (!call)
return;
@ -294,7 +294,7 @@ nm_remote_connection_commit_changes_unsaved (NMRemoteConnection *connection,
priv = NM_REMOTE_CONNECTION_GET_PRIVATE (connection);
call = remote_call_new (connection, result_cb, (GFunc) callback, user_data);
call = remote_call_new (connection, result_cb, (GFunc)(void (*) (void)) callback, user_data);
if (!call)
return;
@ -331,7 +331,7 @@ nm_remote_connection_save (NMRemoteConnection *connection,
priv = NM_REMOTE_CONNECTION_GET_PRIVATE (connection);
call = remote_call_new (connection, result_cb, (GFunc) callback, user_data);
call = remote_call_new (connection, result_cb, (GFunc)(void (*) (void)) callback, user_data);
if (!call)
return;
@ -359,7 +359,7 @@ nm_remote_connection_delete (NMRemoteConnection *self,
priv = NM_REMOTE_CONNECTION_GET_PRIVATE (self);
call = remote_call_new (self, result_cb, (GFunc) callback, user_data);
call = remote_call_new (self, result_cb, (GFunc)(void (*) (void)) callback, user_data);
if (!call)
return;
@ -372,7 +372,7 @@ nm_remote_connection_delete (NMRemoteConnection *self,
static void
get_secrets_cb (RemoteCall *call, DBusGProxyCall *proxy_call, GError *error)
{
NMRemoteConnectionGetSecretsFunc func = (NMRemoteConnectionGetSecretsFunc) call->callback;
NMRemoteConnectionGetSecretsFunc func = (NMRemoteConnectionGetSecretsFunc)(void (*) (void)) call->callback;
GHashTable *secrets = NULL;
GError *local_error = NULL;
@ -415,7 +415,7 @@ nm_remote_connection_get_secrets (NMRemoteConnection *self,
priv = NM_REMOTE_CONNECTION_GET_PRIVATE (self);
call = remote_call_new (self, get_secrets_cb, (GFunc) callback, user_data);
call = remote_call_new (self, get_secrets_cb, (GFunc)(void (*) (void)) callback, user_data);
if (!call)
return;

View file

@ -257,7 +257,7 @@ nm_udev_client_new (const char *const*subsystems,
channel = g_io_channel_unix_new (udev_monitor_get_fd (self->monitor));
self->watch_source = g_io_create_watch (channel, G_IO_IN);
g_io_channel_unref (channel);
g_source_set_callback (self->watch_source, (GSourceFunc) monitor_event, self, NULL);
g_source_set_callback (self->watch_source, (GSourceFunc)(void (*) (void)) monitor_event, self, NULL);
g_source_attach (self->watch_source, g_main_context_get_thread_default ());
g_source_unref (self->watch_source);
}