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

miss-islington webhook-mailer at python.org
Mon Jun 20 08:08:37 EDT 2022


https://github.com/python/cpython/commit/81686e701cda58fc155f9bbd2fe07c523185914b
commit: 81686e701cda58fc155f9bbd2fe07c523185914b
branch: 3.11
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: miss-islington <31488909+miss-islington at users.noreply.github.com>
date: 2022年06月20日T05:08:14-07:00
summary:
gh-84461: Silence some compiler warnings on WASM (GH-93978)
(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
M Objects/stringlib/fastsearch.h
M configure
M configure.ac
diff --git a/Modules/_io/bufferedio.c b/Modules/_io/bufferedio.c
index ac30d1d632bff..4a4a1992dbbb7 100644
--- a/Modules/_io/bufferedio.c
+++ b/Modules/_io/bufferedio.c
@@ -328,7 +328,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 dfb1f923cdccf..e3b37f179312d 100644
--- a/Modules/signalmodule.c
+++ b/Modules/signalmodule.c
@@ -189,8 +189,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)
 {
@@ -206,7 +206,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 9aefa443c7c69..461096cf17004 100644
--- a/Modules/socketmodule.c
+++ b/Modules/socketmodule.c
@@ -1013,6 +1013,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
@@ -1032,6 +1033,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
diff --git a/Objects/stringlib/fastsearch.h b/Objects/stringlib/fastsearch.h
index b91082bd523cb..7403d8a3f701f 100644
--- a/Objects/stringlib/fastsearch.h
+++ b/Objects/stringlib/fastsearch.h
@@ -345,7 +345,7 @@ STRINGLIB(_preprocess)(const STRINGLIB_CHAR *needle, Py_ssize_t len_needle,
 }
 // Fill up a compressed Boyer-Moore "Bad Character" table
 Py_ssize_t not_found_shift = Py_MIN(len_needle, MAX_SHIFT);
- for (Py_ssize_t i = 0; i < TABLE_SIZE; i++) {
+ for (Py_ssize_t i = 0; i < (Py_ssize_t)TABLE_SIZE; i++) {
 p->table[i] = Py_SAFE_DOWNCAST(not_found_shift,
 Py_ssize_t, SHIFT_TYPE);
 }
diff --git a/configure b/configure
index 954acc03af2a9..3b477c42fce90 100755
--- a/configure
+++ b/configure
@@ -24763,7 +24763,7 @@ $as_echo_n "checking for stdlib extension module _ctypes_test... " >&6; }
 if test "$py_cv_module__ctypes_test" != "n/a"; then :
 
 if test "$TEST_MODULES" = yes; then :
- if true; then :
+ if test "$ac_cv_func_dlopen" = yes; then :
 py_cv_module__ctypes_test=yes
 else
 py_cv_module__ctypes_test=missing
diff --git a/configure.ac b/configure.ac
index 9bcb381e97de1..97ee28fbe7755 100644
--- a/configure.ac
+++ b/configure.ac
@@ -6977,7 +6977,7 @@ PY_STDLIB_MOD([_testbuffer], [test "$TEST_MODULES" = yes])
 PY_STDLIB_MOD([_testimportmultiple], [test "$TEST_MODULES" = yes], [test "$ac_cv_func_dlopen" = yes])
 PY_STDLIB_MOD([_testmultiphase], [test "$TEST_MODULES" = yes], [test "$ac_cv_func_dlopen" = yes])
 PY_STDLIB_MOD([_xxtestfuzz], [test "$TEST_MODULES" = yes])
-PY_STDLIB_MOD([_ctypes_test], [test "$TEST_MODULES" = yes], [], [], [-lm])
+PY_STDLIB_MOD([_ctypes_test], [test "$TEST_MODULES" = yes], [test "$ac_cv_func_dlopen" = yes], [], [-lm])
 
 dnl Limited API template modules.
 dnl The limited C API is not compatible with the Py_TRACE_REFS macro.


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /