From e2796cda0d78e01dc14d5dcf88aafe43c3da0d6f 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) (cherry picked from commit 42913505a3c62dac199708f3da338fa97f87d58e) (cherry picked from commit 3cd8c64c6d3827692141eeacf583d54294230205) --- clients/tui/newt/nmt-newt-form.c | 2 +- libnm-glib/nm-remote-connection.c | 14 +++++++------- 2 files changed, 8 insertions(+), 8 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 04d94c1884..be4499ef5c 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;