lib/talloc: squash 'cast between incompatible function types' warning
authorNoel Power <noel.power@suse.com>
Thu, 2 May 2019 18:49:27 +0000 (19:49 +0100)
committerAndreas Schneider <asn@cryptomilk.org>
Thu, 16 May 2019 17:55:17 +0000 (17:55 +0000)
To avoid warning above produced by using
-Wcast-function-type we;

  + ensure PyCFunctions of type METH_NOARGS defined dummy arg

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
lib/talloc/pytalloc.c
lib/talloc/test_pytalloc.c

index ad3ad969a0f42da9af977b788a1a054b3f444e68..b305b608f471f2b89397910e356637a411d8ecab 100644 (file)
@@ -47,7 +47,8 @@ static PyObject *pytalloc_report_full(PyObject *self, PyObject *args)
 }
 
 /* enable null tracking */
-static PyObject *pytalloc_enable_null_tracking(PyObject *self)
+static PyObject *pytalloc_enable_null_tracking(PyObject *self,
+               PyObject *Py_UNUSED(ignored))
 {
        talloc_enable_null_tracking();
        return Py_None;
index a7c31c1ad5ead882d0f66832f269cb5e369c5ab8..6797b98c6b90732f6b1680f140e37ae7f2ddbf49 100644 (file)
 #include <talloc.h>
 #include <pytalloc.h>
 
-static PyObject *testpytalloc_new(PyTypeObject *mod)
+static PyObject *testpytalloc_new(PyTypeObject *mod,
+               PyObject *Py_UNUSED(ignored))
 {
        char *obj = talloc_strdup(NULL, "This is a test string");;
        return pytalloc_steal(pytalloc_GetObjectType(), obj);
 }
 
-static PyObject *testpytalloc_get_object_type(PyObject *mod) {
+static PyObject *testpytalloc_get_object_type(PyObject *mod,
+               PyObject *Py_UNUSED(ignored))
+{
        PyObject *type = (PyObject *)pytalloc_GetObjectType();
        Py_INCREF(type);
        return type;
 }
 
-static PyObject *testpytalloc_base_new(PyTypeObject *mod)
+static PyObject *testpytalloc_base_new(PyTypeObject *mod,
+               PyObject *Py_UNUSED(ignored))
 {
        char *obj = talloc_strdup(NULL, "This is a test string for a BaseObject");;
        return pytalloc_steal(pytalloc_GetBaseObjectType(), obj);
 }
 
-static PyObject *testpytalloc_base_get_object_type(PyObject *mod) {
+static PyObject *testpytalloc_base_get_object_type(PyObject *mod,
+               PyObject *Py_UNUSED(ignored))
+{
        PyObject *type = (PyObject *)pytalloc_GetBaseObjectType();
        Py_INCREF(type);
        return type;