Skip to content

Commit

Permalink
gh-84461: Silence some compiler warnings on WASM (GH-93978) (#94025)
Browse files Browse the repository at this point in the history
(cherry picked from commit 774ef28)

Co-authored-by: Christian Heimes <christian@python.org>
  • Loading branch information
vstinner and tiran committed Jun 20, 2022
1 parent 8a1bade commit 9d73adf
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Modules/_io/bufferedio.c
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ _enter_buffered_busy(buffered *self)
: buffered_closed(self)))

#define CHECK_CLOSED(self, error_msg) \
if (IS_CLOSED(self) & (Py_SAFE_DOWNCAST(READAHEAD(self), Py_off_t, Py_ssize_t) == 0)) { \
if (IS_CLOSED(self) && (Py_SAFE_DOWNCAST(READAHEAD(self), Py_off_t, Py_ssize_t) == 0)) { \
PyErr_SetString(PyExc_ValueError, error_msg); \
return NULL; \
} \
Expand Down
3 changes: 1 addition & 2 deletions Modules/getnameinfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ getnameinfo(sa, salen, host, hostlen, serv, servlen, flags)
u_long v4a;
#ifdef ENABLE_IPV6
u_char pfx;
#endif
int h_error;
#endif
char numserv[512];
char numaddr[512];

Expand Down Expand Up @@ -181,7 +181,6 @@ getnameinfo(sa, salen, host, hostlen, serv, servlen, flags)
hp = getipnodebyaddr(addr, gni_afd->a_addrlen, gni_afd->a_af, &h_error);
#else
hp = gethostbyaddr(addr, gni_afd->a_addrlen, gni_afd->a_af);
h_error = h_errno;
#endif

if (hp) {
Expand Down
7 changes: 5 additions & 2 deletions Modules/signalmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,8 @@ compare_handler(PyObject *func, PyObject *dfl_ign_handler)
return PyObject_RichCompareBool(func, dfl_ign_handler, Py_EQ) == 1;
}

#ifdef HAVE_GETITIMER
/* auxiliary functions for setitimer */
#ifdef HAVE_SETITIMER
/* auxiliary function for setitimer */
static int
timeval_from_double(PyObject *obj, struct timeval *tv)
{
Expand All @@ -202,7 +202,10 @@ timeval_from_double(PyObject *obj, struct timeval *tv)
}
return _PyTime_AsTimeval(t, tv, _PyTime_ROUND_CEILING);
}
#endif

#if defined(HAVE_SETITIMER) || defined(HAVE_GETITIMER)
/* auxiliary functions for get/setitimer */
Py_LOCAL_INLINE(double)
double_from_timeval(struct timeval *tv)
{
Expand Down
2 changes: 2 additions & 0 deletions Modules/socketmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -996,6 +996,7 @@ init_sockobject(PySocketSockObject *s,
}


#ifdef HAVE_SOCKETPAIR
/* Create a new socket object.
This just creates the object and initializes it.
If the creation fails, return NULL and set an exception (implicit
Expand All @@ -1015,6 +1016,7 @@ new_sockobject(SOCKET_T fd, int family, int type, int proto)
}
return s;
}
#endif


/* Lock to allow python interpreter to continue, but only allow one
Expand Down

0 comments on commit 9d73adf

Please sign in to comment.