[Python-checkins] gh-84461: Silence some compiler warnings on WASM (GH-93978) (#94025)

vstinner webhook-mailer at python.org
Mon Jun 20 10:10:01 EDT 2022


https://github.com/python/cpython/commit/9d73adf7a45035f9c3bd6771347aad912e15c373
commit: 9d73adf7a45035f9c3bd6771347aad912e15c373
branch: 3.10
author: Victor Stinner <vstinner at python.org>
committer: vstinner <vstinner at python.org>
date: 2022-06-20T16:09:55+02:00
summary:

gh-84461: Silence some compiler warnings on WASM (GH-93978) (#94025)

(cherry picked from commit 774ef28814d0d9d57ec813cb31b0a7af6c476127)

Co-authored-by: Christian Heimes <christian at python.org>

files:
M Modules/_io/bufferedio.c
M Modules/getnameinfo.c
M Modules/signalmodule.c
M Modules/socketmodule.c

diff --git a/Modules/_io/bufferedio.c b/Modules/_io/bufferedio.c
index ba966f568b399..97fefb40e49a7 100644
--- a/Modules/_io/bufferedio.c
+++ b/Modules/_io/bufferedio.c
@@ -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; \
     } \
diff --git a/Modules/getnameinfo.c b/Modules/getnameinfo.c
index f014c11ae157e..db3e8eedd217c 100644
--- a/Modules/getnameinfo.c
+++ b/Modules/getnameinfo.c
@@ -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];
 
@@ -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) {
diff --git a/Modules/signalmodule.c b/Modules/signalmodule.c
index c3a5237bce434..80fa4d50eef71 100644
--- a/Modules/signalmodule.c
+++ b/Modules/signalmodule.c
@@ -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)
 {
@@ -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)
 {
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c
index 392cc32f7fa2f..271e79f7eabc3 100644
--- a/Modules/socketmodule.c
+++ b/Modules/socketmodule.c
@@ -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
@@ -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



More information about the Python-checkins mailing list