From 42913505a3c62dac199708f3da338fa97f87d58e Mon Sep 17 00:00:00 2001 From: Lubomir Rintel Date: Wed, 7 Feb 2018 18:08:58 +0000 Subject: [PATCH] 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. (cherry picked from commit ee916a1e9ec3f06f8c88dc3d95058a6bd1561c7d) --- clients/tui/newt/nmt-newt-form.c | 2 +- libnm-glib/nm-remote-connection.c | 14 +++++++------- shared/nm-utils/nm-udev-utils.c | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/clients/tui/newt/nmt-newt-form.c b/clients/tui/newt/nmt-newt-form.c index 835c1aba7d..ccf447eada 100644 --- a/clients/tui/newt/nmt-newt-form.c +++ b/clients/tui/newt/nmt-newt-form.c @@ -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); diff --git a/libnm-glib/nm-remote-connection.c b/libnm-glib/nm-remote-connection.c index 6dcce0ba97..820f9e5ca5 100644 --- a/libnm-glib/nm-remote-connection.c +++ b/libnm-glib/nm-remote-connection.c @@ -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; diff --git a/shared/nm-utils/nm-udev-utils.c b/shared/nm-utils/nm-udev-utils.c index 79d4426de9..709f759043 100644 --- a/shared/nm-utils/nm-udev-utils.c +++ b/shared/nm-utils/nm-udev-utils.c @@ -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); }