Skip to content

Commit cc8e6d2

Browse files
authored
GH-131296: Suppress clang-cl warnings in socketmodule.c (GH-131821)
1 parent 28d91d0 commit cc8e6d2

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

Modules/socketmodule.c

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -716,12 +716,6 @@ select_error(void)
716716
# define SOCK_INPROGRESS_ERR EINPROGRESS
717717
#endif
718718

719-
#ifdef _MSC_VER
720-
# define SUPPRESS_DEPRECATED_CALL __pragma(warning(suppress: 4996))
721-
#else
722-
# define SUPPRESS_DEPRECATED_CALL
723-
#endif
724-
725719
/* Convenience function to raise an error according to errno
726720
and return a NULL pointer from a function. */
727721

@@ -3366,7 +3360,7 @@ sock_setsockopt(PyObject *self, PyObject *args)
33663360
&level, &optname, &flag)) {
33673361
#ifdef MS_WINDOWS
33683362
if (optname == SIO_TCP_SET_ACK_FREQUENCY) {
3369-
int dummy;
3363+
DWORD dummy;
33703364
res = WSAIoctl(get_sock_fd(s), SIO_TCP_SET_ACK_FREQUENCY, &flag,
33713365
sizeof(flag), NULL, 0, &dummy, NULL, NULL);
33723366
if (res >= 0) {
@@ -6195,8 +6189,10 @@ socket_gethostbyname_ex(PyObject *self, PyObject *args)
61956189
#ifdef USE_GETHOSTBYNAME_LOCK
61966190
PyThread_acquire_lock(netdb_lock, 1);
61976191
#endif
6198-
SUPPRESS_DEPRECATED_CALL
6192+
_Py_COMP_DIAG_PUSH
6193+
_Py_COMP_DIAG_IGNORE_DEPR_DECLS
61996194
h = gethostbyname(name);
6195+
_Py_COMP_DIAG_POP
62006196
#endif /* HAVE_GETHOSTBYNAME_R */
62016197
Py_END_ALLOW_THREADS
62026198
/* Some C libraries would require addr.__ss_family instead of
@@ -6300,8 +6296,10 @@ socket_gethostbyaddr(PyObject *self, PyObject *args)
63006296
#ifdef USE_GETHOSTBYNAME_LOCK
63016297
PyThread_acquire_lock(netdb_lock, 1);
63026298
#endif
6303-
SUPPRESS_DEPRECATED_CALL
6299+
_Py_COMP_DIAG_PUSH
6300+
_Py_COMP_DIAG_IGNORE_DEPR_DECLS
63046301
h = gethostbyaddr(ap, al, af);
6302+
_Py_COMP_DIAG_POP
63056303
#endif /* HAVE_GETHOSTBYNAME_R */
63066304
Py_END_ALLOW_THREADS
63076305
ret = gethost_common(state, h, SAS2SA(&addr), sizeof(addr), af);
@@ -6718,8 +6716,10 @@ _socket_inet_aton_impl(PyObject *module, const char *ip_addr)
67186716
packed_addr = INADDR_BROADCAST;
67196717
} else {
67206718

6721-
SUPPRESS_DEPRECATED_CALL
6719+
_Py_COMP_DIAG_PUSH
6720+
_Py_COMP_DIAG_IGNORE_DEPR_DECLS
67226721
packed_addr = inet_addr(ip_addr);
6722+
_Py_COMP_DIAG_POP
67236723

67246724
if (packed_addr == INADDR_NONE) { /* invalid address */
67256725
PyErr_SetString(PyExc_OSError,
@@ -6762,8 +6762,10 @@ _socket_inet_ntoa_impl(PyObject *module, Py_buffer *packed_ip)
67626762
memcpy(&packed_addr, packed_ip->buf, packed_ip->len);
67636763
PyBuffer_Release(packed_ip);
67646764

6765-
SUPPRESS_DEPRECATED_CALL
6765+
_Py_COMP_DIAG_PUSH
6766+
_Py_COMP_DIAG_IGNORE_DEPR_DECLS
67666767
return PyUnicode_FromString(inet_ntoa(packed_addr));
6768+
_Py_COMP_DIAG_POP
67676769
}
67686770
#endif // HAVE_INET_NTOA
67696771

0 commit comments

Comments
 (0)