diff options
author | Simon McVittie <smcv@collabora.com> | 2019-07-23 11:14:14 +0100 |
---|---|---|
committer | Simon McVittie <smcv@collabora.com> | 2019-07-23 11:14:14 +0100 |
commit | b24fd92dcaac567568641df0490acac334dd94c9 (patch) | |
tree | cc4752787f25e0055c98c041a69d228fd2f6f0cf | |
parent | d59f67d69256fdb88421934297ae20ff49356fb6 (diff) |
Silence -Wcast-function-type with gcc 8
Casting via void (*)(void) is the documented way to suppress this
warning. This is required because the CPython API treats function
pointers as generic, with flags to indicate different calling
conventions.
Signed-off-by: Simon McVittie <smcv@collabora.com>
-rw-r--r-- | dbus_bindings/conn-methods.c | 11 | ||||
-rw-r--r-- | dbus_bindings/message.c | 70 | ||||
-rw-r--r-- | dbus_bindings/module.c | 2 | ||||
-rw-r--r-- | dbus_bindings/pending-call.c | 6 | ||||
-rw-r--r-- | dbus_bindings/server.c | 2 | ||||
-rw-r--r-- | dbus_bindings/unixfd.c | 2 | ||||
-rw-r--r-- | dbus_glib_bindings/module.c | 2 | ||||
-rw-r--r-- | test/dbus_py_test.c | 2 |
8 files changed, 50 insertions, 47 deletions
diff --git a/dbus_bindings/conn-methods.c b/dbus_bindings/conn-methods.c index 8ae053a..62bdf86 100644 --- a/dbus_bindings/conn-methods.c +++ b/dbus_bindings/conn-methods.c @@ -1035,7 +1035,10 @@ PyDoc_STRVAR(set_unique_name__doc__, "already been set.\n"); struct PyMethodDef DBusPyConnection_tp_methods[] = { -#define ENTRY(name, flags) {#name, (PyCFunction)Connection_##name, flags, Connection_##name##__doc__} +#define ENTRY(name, flags) {\ + #name, (PyCFunction) (void (*)(void)) Connection_##name, \ + flags, Connection_##name##__doc__ \ +} ENTRY(_require_main_loop, METH_NOARGS), ENTRY(close, METH_NOARGS), ENTRY(flush, METH_NOARGS), @@ -1053,13 +1056,13 @@ struct PyMethodDef DBusPyConnection_tp_methods[] = { ENTRY(send_message_with_reply_and_block, METH_VARARGS), ENTRY(_unregister_object_path, METH_VARARGS|METH_KEYWORDS), ENTRY(list_exported_child_objects, METH_VARARGS|METH_KEYWORDS), - {"_new_for_bus", (PyCFunction)DBusPyConnection_NewForBus, + {"_new_for_bus", (PyCFunction) (void (*)(void)) DBusPyConnection_NewForBus, METH_CLASS|METH_VARARGS|METH_KEYWORDS, new_for_bus__doc__}, - {"get_unique_name", (PyCFunction)DBusPyConnection_GetUniqueName, + {"get_unique_name", (PyCFunction) (void (*)(void)) DBusPyConnection_GetUniqueName, METH_NOARGS, get_unique_name__doc__}, - {"set_unique_name", (PyCFunction)DBusPyConnection_SetUniqueName, + {"set_unique_name", (PyCFunction) (void (*)(void)) DBusPyConnection_SetUniqueName, METH_VARARGS, set_unique_name__doc__}, ENTRY(set_allow_anonymous, METH_VARARGS), diff --git a/dbus_bindings/message.c b/dbus_bindings/message.c index 602a3fb..7c0c192 100644 --- a/dbus_bindings/message.c +++ b/dbus_bindings/message.c @@ -783,77 +783,77 @@ Message_set_error_name(Message *self, PyObject *args) } static PyMethodDef Message_tp_methods[] = { - {"copy", (PyCFunction)Message_copy, + {"copy", (PyCFunction) (void (*)(void)) Message_copy, METH_NOARGS, Message_copy__doc__}, - {"is_method_call", (PyCFunction)Message_is_method_call, + {"is_method_call", (PyCFunction) (void (*)(void)) Message_is_method_call, METH_VARARGS, Message_is_method_call__doc__}, - {"is_signal", (PyCFunction)Message_is_signal, + {"is_signal", (PyCFunction) (void (*)(void)) Message_is_signal, METH_VARARGS, Message_is_signal__doc__}, - {"is_error", (PyCFunction)Message_is_error, + {"is_error", (PyCFunction) (void (*)(void)) Message_is_error, METH_VARARGS, Message_is_error__doc__}, - {"get_args_list", (PyCFunction)dbus_py_Message_get_args_list, + {"get_args_list", (PyCFunction) (void (*)(void)) dbus_py_Message_get_args_list, METH_VARARGS|METH_KEYWORDS, dbus_py_Message_get_args_list__doc__}, - {"guess_signature", (PyCFunction)dbus_py_Message_guess_signature, + {"guess_signature", (PyCFunction) (void (*)(void)) dbus_py_Message_guess_signature, METH_VARARGS|METH_STATIC, dbus_py_Message_guess_signature__doc__}, - {"append", (PyCFunction)dbus_py_Message_append, + {"append", (PyCFunction) (void (*)(void)) dbus_py_Message_append, METH_VARARGS|METH_KEYWORDS, dbus_py_Message_append__doc__}, - {"get_auto_start", (PyCFunction)Message_get_auto_start, + {"get_auto_start", (PyCFunction) (void (*)(void)) Message_get_auto_start, METH_NOARGS, Message_get_auto_start__doc__}, - {"set_auto_start", (PyCFunction)Message_set_auto_start, + {"set_auto_start", (PyCFunction) (void (*)(void)) Message_set_auto_start, METH_VARARGS, Message_set_auto_start__doc__}, - {"get_destination", (PyCFunction)Message_get_destination, + {"get_destination", (PyCFunction) (void (*)(void)) Message_get_destination, METH_NOARGS, Message_get_destination__doc__}, - {"set_destination", (PyCFunction)Message_set_destination, + {"set_destination", (PyCFunction) (void (*)(void)) Message_set_destination, METH_VARARGS, Message_set_destination__doc__}, - {"has_destination", (PyCFunction)Message_has_destination, + {"has_destination", (PyCFunction) (void (*)(void)) Message_has_destination, METH_VARARGS, Message_has_destination__doc__}, - {"get_error_name", (PyCFunction)Message_get_error_name, + {"get_error_name", (PyCFunction) (void (*)(void)) Message_get_error_name, METH_NOARGS, Message_get_error_name__doc__}, - {"set_error_name", (PyCFunction)Message_set_error_name, + {"set_error_name", (PyCFunction) (void (*)(void)) Message_set_error_name, METH_VARARGS, Message_set_error_name__doc__}, - {"get_interface", (PyCFunction)Message_get_interface, + {"get_interface", (PyCFunction) (void (*)(void)) Message_get_interface, METH_NOARGS, Message_get_interface__doc__}, - {"set_interface", (PyCFunction)Message_set_interface, + {"set_interface", (PyCFunction) (void (*)(void))Message_set_interface, METH_VARARGS, Message_set_interface__doc__}, - {"has_interface", (PyCFunction)Message_has_interface, + {"has_interface", (PyCFunction) (void (*)(void))Message_has_interface, METH_VARARGS, Message_has_interface__doc__}, - {"get_member", (PyCFunction)Message_get_member, + {"get_member", (PyCFunction) (void (*)(void))Message_get_member, METH_NOARGS, Message_get_member__doc__}, - {"set_member", (PyCFunction)Message_set_member, + {"set_member", (PyCFunction) (void (*)(void))Message_set_member, METH_VARARGS, Message_set_member__doc__}, - {"has_member", (PyCFunction)Message_has_member, + {"has_member", (PyCFunction) (void (*)(void))Message_has_member, METH_VARARGS, Message_has_member__doc__}, - {"get_path", (PyCFunction)Message_get_path, + {"get_path", (PyCFunction) (void (*)(void))Message_get_path, METH_NOARGS, Message_get_path__doc__}, - {"get_path_decomposed", (PyCFunction)Message_get_path_decomposed, + {"get_path_decomposed", (PyCFunction) (void (*)(void))Message_get_path_decomposed, METH_NOARGS, Message_get_path_decomposed__doc__}, - {"set_path", (PyCFunction)Message_set_path, + {"set_path", (PyCFunction) (void (*)(void))Message_set_path, METH_VARARGS, Message_set_path__doc__}, - {"has_path", (PyCFunction)Message_has_path, + {"has_path", (PyCFunction) (void (*)(void))Message_has_path, METH_VARARGS, Message_has_path__doc__}, - {"get_no_reply", (PyCFunction)Message_get_no_reply, + {"get_no_reply", (PyCFunction) (void (*)(void))Message_get_no_reply, METH_NOARGS, Message_get_no_reply__doc__}, - {"set_no_reply", (PyCFunction)Message_set_no_reply, + {"set_no_reply", (PyCFunction) (void (*)(void))Message_set_no_reply, METH_VARARGS, Message_set_no_reply__doc__}, - {"get_reply_serial", (PyCFunction)Message_get_reply_serial, + {"get_reply_serial", (PyCFunction) (void (*)(void))Message_get_reply_serial, METH_NOARGS, Message_get_reply_serial__doc__}, - {"set_reply_serial", (PyCFunction)Message_set_reply_serial, + {"set_reply_serial", (PyCFunction) (void (*)(void))Message_set_reply_serial, METH_VARARGS, Message_set_reply_serial__doc__}, - {"get_sender", (PyCFunction)Message_get_sender, + {"get_sender", (PyCFunction) (void (*)(void))Message_get_sender, METH_NOARGS, Message_get_sender__doc__}, - {"set_sender", (PyCFunction)Message_set_sender, + {"set_sender", (PyCFunction) (void (*)(void))Message_set_sender, METH_VARARGS, Message_set_sender__doc__}, - {"has_sender", (PyCFunction)Message_has_sender, + {"has_sender", (PyCFunction) (void (*)(void))Message_has_sender, METH_VARARGS, Message_has_sender__doc__}, - {"get_serial", (PyCFunction)Message_get_serial, + {"get_serial", (PyCFunction) (void (*)(void))Message_get_serial, METH_NOARGS, Message_get_serial__doc__}, - {"get_signature", (PyCFunction)Message_get_signature, + {"get_signature", (PyCFunction) (void (*)(void))Message_get_signature, METH_NOARGS, Message_get_signature__doc__}, - {"has_signature", (PyCFunction)Message_has_signature, + {"has_signature", (PyCFunction) (void (*)(void))Message_has_signature, METH_VARARGS, Message_has_signature__doc__}, - {"get_type", (PyCFunction)Message_get_type, + {"get_type", (PyCFunction) (void (*)(void))Message_get_type, METH_NOARGS, Message_get_type__doc__}, {NULL, NULL, 0, NULL} }; diff --git a/dbus_bindings/module.c b/dbus_bindings/module.c index 559d12c..2779bfa 100644 --- a/dbus_bindings/module.c +++ b/dbus_bindings/module.c @@ -220,7 +220,7 @@ set_default_main_loop(PyObject *always_null UNUSED, } static PyMethodDef module_functions[] = { -#define ENTRY(name,flags) {#name, (PyCFunction)name, flags, name##__doc__} +#define ENTRY(name,flags) {#name, (PyCFunction) (void (*)(void))name, flags, name##__doc__} ENTRY(validate_interface_name, METH_VARARGS), ENTRY(validate_member_name, METH_VARARGS), ENTRY(validate_bus_name, METH_VARARGS|METH_KEYWORDS), diff --git a/dbus_bindings/pending-call.c b/dbus_bindings/pending-call.c index d5092db..636095f 100644 --- a/dbus_bindings/pending-call.c +++ b/dbus_bindings/pending-call.c @@ -225,11 +225,11 @@ PendingCall_tp_dealloc (PendingCall *self) } static PyMethodDef PendingCall_tp_methods[] = { - {"block", (PyCFunction)PendingCall_block, METH_NOARGS, + {"block", (PyCFunction) (void (*)(void))PendingCall_block, METH_NOARGS, PendingCall_block__doc__}, - {"cancel", (PyCFunction)PendingCall_cancel, METH_NOARGS, + {"cancel", (PyCFunction) (void (*)(void))PendingCall_cancel, METH_NOARGS, PendingCall_cancel__doc__}, - {"get_completed", (PyCFunction)PendingCall_get_completed, METH_NOARGS, + {"get_completed", (PyCFunction) (void (*)(void))PendingCall_get_completed, METH_NOARGS, PendingCall_get_completed__doc__}, {NULL, NULL, 0, NULL} }; diff --git a/dbus_bindings/server.c b/dbus_bindings/server.c index 3f2819d..dfbfa53 100644 --- a/dbus_bindings/server.c +++ b/dbus_bindings/server.c @@ -535,7 +535,7 @@ Server_get_is_connected (Server *self, PyObject *args UNUSED) /* Server type object =============================================== */ struct PyMethodDef DBusPyServer_tp_methods[] = { -#define ENTRY(name, flags) {#name, (PyCFunction)Server_##name, flags, Server_##name##__doc__} +#define ENTRY(name, flags) {#name, (PyCFunction) (void (*)(void))Server_##name, flags, Server_##name##__doc__} ENTRY(disconnect, METH_NOARGS), ENTRY(get_address, METH_NOARGS), ENTRY(get_id, METH_NOARGS), diff --git a/dbus_bindings/unixfd.c b/dbus_bindings/unixfd.c index 79b513c..8ca6771 100644 --- a/dbus_bindings/unixfd.c +++ b/dbus_bindings/unixfd.c @@ -189,7 +189,7 @@ dbus_py_unix_fd_get_fd(PyObject *self) } static PyMethodDef UnixFd_methods[] = { - {"take", (PyCFunction) UnixFd_take, METH_NOARGS, UnixFd_take__doc__ }, + {"take", (PyCFunction) (void (*)(void)) UnixFd_take, METH_NOARGS, UnixFd_take__doc__ }, {NULL} }; diff --git a/dbus_glib_bindings/module.c b/dbus_glib_bindings/module.c index e3e61bc..6614394 100644 --- a/dbus_glib_bindings/module.c +++ b/dbus_glib_bindings/module.c @@ -170,7 +170,7 @@ static PyMethodDef module_functions[] = { {"setup_with_g_main", setup_with_g_main, METH_VARARGS, setup_with_g_main__doc__}, {"gthreads_init", gthreads_init, METH_NOARGS, gthreads_init__doc__}, - {"DBusGMainLoop", (PyCFunction)DBusGMainLoop, + {"DBusGMainLoop", (PyCFunction) (void (*)(void))DBusGMainLoop, METH_VARARGS|METH_KEYWORDS, DBusGMainLoop__doc__}, {NULL, NULL, 0, NULL} }; diff --git a/test/dbus_py_test.c b/test/dbus_py_test.c index f44b2ff..7f8f996 100644 --- a/test/dbus_py_test.c +++ b/test/dbus_py_test.c @@ -114,7 +114,7 @@ UnusableMainLoop (PyObject *always_null UNUSED, PyObject *args, PyObject *kwargs } static PyMethodDef module_functions[] = { - {"UnusableMainLoop", (PyCFunction)UnusableMainLoop, + {"UnusableMainLoop", (PyCFunction) (void (*)(void))UnusableMainLoop, METH_VARARGS|METH_KEYWORDS, "Return a main loop that fails to attach"}, {NULL, NULL, 0, NULL} }; |