From: Noel Power Date: Thu, 2 May 2019 18:40:23 +0000 (+0100) Subject: s3: squash 'cast between incompatible function types' warning X-Git-Tag: tdb-1.4.1~19 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=cea41645fb463b026bb7161b524ba732ba0d14e3;p=thirdparty%2Fsamba.git s3: squash 'cast between incompatible function types' warning Some functions (e.g. py_smb_savefile) have an extra unecessary *kwargs param in their signatures, these definitions are causing 'cast between incompatible function types' warnings when compiled with -Wcast-function-type. Some other functions have the *kwargs which causes "cast between incompatible function types' warnings which need to be squashed with use of the PY_DISCARD_FUNC_SIG macro. Signed-off-by: Noel Power Reviewed-by: Andreas Schneider --- diff --git a/source3/libsmb/pylibsmb.c b/source3/libsmb/pylibsmb.c index da2e5e12d0d..aac0d95ba07 100644 --- a/source3/libsmb/pylibsmb.c +++ b/source3/libsmb/pylibsmb.c @@ -24,6 +24,7 @@ #include #include "includes.h" #include "python/py3compat.h" +#include "python/modules.h" #include "libcli/smb/smbXcli_base.h" #include "libsmb/libsmb.h" #include "libcli/security/security.h" @@ -786,8 +787,7 @@ static size_t push_data(uint8_t *buf, size_t n, void *priv) /* * Writes a file with the contents specified */ -static PyObject *py_smb_savefile(struct py_cli_state *self, PyObject *args, - PyObject *kwargs) +static PyObject *py_smb_savefile(struct py_cli_state *self, PyObject *args) { uint16_t fnum; const char *filename = NULL; @@ -910,8 +910,7 @@ static NTSTATUS py_smb_filesize(struct py_cli_state *self, uint16_t fnum, /* * Loads the specified file's contents and returns it */ -static PyObject *py_smb_loadfile(struct py_cli_state *self, PyObject *args, - PyObject *kwargs) +static PyObject *py_smb_loadfile(struct py_cli_state *self, PyObject *args) { NTSTATUS status; const char *filename = NULL; @@ -1581,21 +1580,27 @@ static PyObject *py_smb_setacl(struct py_cli_state *self, PyObject *args) static PyMethodDef py_cli_state_methods[] = { { "settimeout", (PyCFunction)py_cli_settimeout, METH_VARARGS, "settimeout(new_timeout_msecs) => return old_timeout_msecs" }, - { "create", (PyCFunction)py_cli_create, METH_VARARGS|METH_KEYWORDS, + { "create", PY_DISCARD_FUNC_SIG(PyCFunction, py_cli_create), + METH_VARARGS|METH_KEYWORDS, "Open a file" }, { "close", (PyCFunction)py_cli_close, METH_VARARGS, "Close a file handle" }, - { "write", (PyCFunction)py_cli_write, METH_VARARGS|METH_KEYWORDS, + { "write", PY_DISCARD_FUNC_SIG(PyCFunction, py_cli_write), + METH_VARARGS|METH_KEYWORDS, "Write to a file handle" }, - { "read", (PyCFunction)py_cli_read, METH_VARARGS|METH_KEYWORDS, + { "read", PY_DISCARD_FUNC_SIG(PyCFunction, py_cli_read), + METH_VARARGS|METH_KEYWORDS, "Read from a file handle" }, - { "truncate", (PyCFunction)py_cli_ftruncate, + { "truncate", PY_DISCARD_FUNC_SIG(PyCFunction, + py_cli_ftruncate), METH_VARARGS|METH_KEYWORDS, "Truncate a file" }, - { "delete_on_close", (PyCFunction)py_cli_delete_on_close, + { "delete_on_close", PY_DISCARD_FUNC_SIG(PyCFunction, + py_cli_delete_on_close), METH_VARARGS|METH_KEYWORDS, "Set/Reset the delete on close flag" }, - { "list", (PyCFunction)py_cli_list, METH_VARARGS|METH_KEYWORDS, + { "list", PY_DISCARD_FUNC_SIG(PyCFunction, py_cli_list), + METH_VARARGS|METH_KEYWORDS, "list(directory, mask='*', attribs=DEFAULT_ATTRS) -> " "directory contents as a dictionary\n" "\t\tDEFAULT_ATTRS: FILE_ATTRIBUTE_SYSTEM | " diff --git a/source3/param/pyparam.c b/source3/param/pyparam.c index 4f80a0ef864..6f709afe96e 100644 --- a/source3/param/pyparam.c +++ b/source3/param/pyparam.c @@ -28,7 +28,7 @@ static PyTypeObject *loadparm_Type = NULL; void initparam(void); -static PyObject *py_get_context(PyObject *self) +static PyObject *py_get_context(PyObject *self, PyObject *Py_UNUSED(ignored)) { PyObject *py_loadparm; const struct loadparm_s3_helpers *s3_context;