Skip to content

Commit 774ef28

Browse files
authored
gh-84461: Silence some compiler warnings on WASM (GH-93978)
1 parent affa9f2 commit 774ef28

File tree

7 files changed

+12
-8
lines changed

7 files changed

+12
-8
lines changed

Modules/_io/bufferedio.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ _enter_buffered_busy(buffered *self)
328328
: buffered_closed(self)))
329329

330330
#define CHECK_CLOSED(self, error_msg) \
331-
if (IS_CLOSED(self) & (Py_SAFE_DOWNCAST(READAHEAD(self), Py_off_t, Py_ssize_t) == 0)) { \
331+
if (IS_CLOSED(self) && (Py_SAFE_DOWNCAST(READAHEAD(self), Py_off_t, Py_ssize_t) == 0)) { \
332332
PyErr_SetString(PyExc_ValueError, error_msg); \
333333
return NULL; \
334334
} \

Modules/getnameinfo.c

+1-2
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,8 @@ getnameinfo(sa, salen, host, hostlen, serv, servlen, flags)
104104
u_long v4a;
105105
#ifdef ENABLE_IPV6
106106
u_char pfx;
107-
#endif
108107
int h_error;
108+
#endif
109109
char numserv[512];
110110
char numaddr[512];
111111

@@ -181,7 +181,6 @@ getnameinfo(sa, salen, host, hostlen, serv, servlen, flags)
181181
hp = getipnodebyaddr(addr, gni_afd->a_addrlen, gni_afd->a_af, &h_error);
182182
#else
183183
hp = gethostbyaddr(addr, gni_afd->a_addrlen, gni_afd->a_af);
184-
h_error = h_errno;
185184
#endif
186185

187186
if (hp) {

Modules/signalmodule.c

+5-2
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,8 @@ compare_handler(PyObject *func, PyObject *dfl_ign_handler)
189189
return PyObject_RichCompareBool(func, dfl_ign_handler, Py_EQ) == 1;
190190
}
191191

192-
#ifdef HAVE_GETITIMER
193-
/* auxiliary functions for setitimer */
192+
#ifdef HAVE_SETITIMER
193+
/* auxiliary function for setitimer */
194194
static int
195195
timeval_from_double(PyObject *obj, struct timeval *tv)
196196
{
@@ -206,7 +206,10 @@ timeval_from_double(PyObject *obj, struct timeval *tv)
206206
}
207207
return _PyTime_AsTimeval(t, tv, _PyTime_ROUND_CEILING);
208208
}
209+
#endif
209210

211+
#if defined(HAVE_SETITIMER) || defined(HAVE_GETITIMER)
212+
/* auxiliary functions for get/setitimer */
210213
Py_LOCAL_INLINE(double)
211214
double_from_timeval(struct timeval *tv)
212215
{

Modules/socketmodule.c

+2
Original file line numberDiff line numberDiff line change
@@ -1016,6 +1016,7 @@ init_sockobject(PySocketSockObject *s,
10161016
}
10171017

10181018

1019+
#ifdef HAVE_SOCKETPAIR
10191020
/* Create a new socket object.
10201021
This just creates the object and initializes it.
10211022
If the creation fails, return NULL and set an exception (implicit
@@ -1035,6 +1036,7 @@ new_sockobject(SOCKET_T fd, int family, int type, int proto)
10351036
}
10361037
return s;
10371038
}
1039+
#endif
10381040

10391041

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

Objects/stringlib/fastsearch.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ STRINGLIB(_preprocess)(const STRINGLIB_CHAR *needle, Py_ssize_t len_needle,
355355
}
356356
// Fill up a compressed Boyer-Moore "Bad Character" table
357357
Py_ssize_t not_found_shift = Py_MIN(len_needle, MAX_SHIFT);
358-
for (Py_ssize_t i = 0; i < TABLE_SIZE; i++) {
358+
for (Py_ssize_t i = 0; i < (Py_ssize_t)TABLE_SIZE; i++) {
359359
p->table[i] = Py_SAFE_DOWNCAST(not_found_shift,
360360
Py_ssize_t, SHIFT_TYPE);
361361
}

configure

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

configure.ac

+1-1
Original file line numberDiff line numberDiff line change
@@ -6911,7 +6911,7 @@ PY_STDLIB_MOD([_testbuffer], [test "$TEST_MODULES" = yes])
69116911
PY_STDLIB_MOD([_testimportmultiple], [test "$TEST_MODULES" = yes], [test "$ac_cv_func_dlopen" = yes])
69126912
PY_STDLIB_MOD([_testmultiphase], [test "$TEST_MODULES" = yes], [test "$ac_cv_func_dlopen" = yes])
69136913
PY_STDLIB_MOD([_xxtestfuzz], [test "$TEST_MODULES" = yes])
6914-
PY_STDLIB_MOD([_ctypes_test], [test "$TEST_MODULES" = yes], [], [], [-lm])
6914+
PY_STDLIB_MOD([_ctypes_test], [test "$TEST_MODULES" = yes], [test "$ac_cv_func_dlopen" = yes], [], [-lm])
69156915

69166916
dnl Limited API template modules.
69176917
dnl The limited C API is not compatible with the Py_TRACE_REFS macro.

0 commit comments

Comments
 (0)