diff --git a/Modules/nismodule.c b/Modules/nismodule.c index a24978e0686705..837b935b85808f 100644 --- a/Modules/nismodule.c +++ b/Modules/nismodule.c @@ -213,7 +213,9 @@ nis_cat (PyObject *self, PyObject *args, PyObject *kwdict) dict = PyDict_New (); if (dict == NULL) return NULL; + #pragma GCC diagnostic ignored "-Wcast-function-type" cb.foreach = (foreachfunc)nis_foreach; + #pragma GCC diagnostic pop data.dict = dict; map = nis_mapname (map, &data.fix); cb.data = (char *)&data; @@ -298,11 +300,12 @@ nis_xdr_ypmaplist(XDR *xdrs, nismaplist *objp) if (!nis_xdr_mapname(xdrs, &objp->map)) { return (FALSE); } + #pragma GCC diagnostic ignored "-Wcast-function-type" if (!xdr_pointer(xdrs, (char **)&objp->next, - sizeof(nismaplist), (xdrproc_t)nis_xdr_ypmaplist)) - { + sizeof(nismaplist), (xdrproc_t)nis_xdr_ypmaplist)) { return (FALSE); } + #pragma GCC diagnostic pop return (TRUE); } @@ -324,11 +327,12 @@ nis_xdr_ypresp_maplist(XDR *xdrs, nisresp_maplist *objp) if (!nis_xdr_ypstat(xdrs, &objp->stat)) { return (FALSE); } + #pragma GCC diagnostic ignored "-Wcast-function-type" if (!xdr_pointer(xdrs, (char **)&objp->maps, - sizeof(nismaplist), (xdrproc_t)nis_xdr_ypmaplist)) - { + sizeof(nismaplist), (xdrproc_t)nis_xdr_ypmaplist)){ return (FALSE); } + #pragma GCC diagnostic pop return (TRUE); } @@ -340,13 +344,14 @@ nisproc_maplist_2(domainname *argp, CLIENT *clnt) static nisresp_maplist res; memset(&res, 0, sizeof(res)); + #pragma GCC diagnostic ignored "-Wcast-function-type" if (clnt_call(clnt, YPPROC_MAPLIST, (xdrproc_t)nis_xdr_domainname, (caddr_t)argp, (xdrproc_t)nis_xdr_ypresp_maplist, (caddr_t)&res, - TIMEOUT) != RPC_SUCCESS) - { + TIMEOUT) != RPC_SUCCESS) { return (NULL); } + #pragma GCC diagnostic pop return (&res); } diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index 0163b0757aefa5..ad8563c90c87a0 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -3392,12 +3392,15 @@ os_chown_impl(PyObject *module, path_t *path, uid_t uid, gid_t gid, * This is for Mac OS X 10.3, which doesn't have lchown. * (But we still have an lchown symbol because of weak-linking.) * It doesn't have fchownat either. So there's no possibility - * of a graceful failover. + * of a graceful failover. GCC 9 complains about this so we silence his + * warning. */ + #pragma GCC diagnostic ignored "-Waddress" if ((!follow_symlinks) && (lchown == NULL)) { follow_symlinks_specified("chown", follow_symlinks); return NULL; } + #pragma GCC diagnostic pop #endif if (PySys_Audit("os.chown", "OIIi", path->object, uid, gid, @@ -14936,11 +14939,14 @@ INITFUNC(void) #endif /* HAVE_STATVFS */ # ifdef HAVE_LCHOWN + /* GCC 9 complains about lchown always being defined so silence it here. */ + #pragma GCC diagnostic ignored "-Waddress" if (lchown == NULL) { if (PyObject_DelAttrString(m, "lchown") == -1) { return NULL; } } + #pragma GCC diagnostic pop #endif /* HAVE_LCHOWN */