Skip to content

Commit 9a242ab

Browse files
committed
fix clangcl warnings in socketmodule.c
1 parent af2afd7 commit 9a242ab

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
@@ -671,12 +671,6 @@ select_error(void)
671671
# define SOCK_INPROGRESS_ERR EINPROGRESS
672672
#endif
673673

674-
#ifdef _MSC_VER
675-
# define SUPPRESS_DEPRECATED_CALL __pragma(warning(suppress: 4996))
676-
#else
677-
# define SUPPRESS_DEPRECATED_CALL
678-
#endif
679-
680674
/* Convenience function to raise an error according to errno
681675
and return a NULL pointer from a function. */
682676

@@ -3237,7 +3231,7 @@ sock_setsockopt(PyObject *self, PyObject *args)
32373231
&level, &optname, &flag)) {
32383232
#ifdef MS_WINDOWS
32393233
if (optname == SIO_TCP_SET_ACK_FREQUENCY) {
3240-
int dummy;
3234+
DWORD dummy;
32413235
res = WSAIoctl(get_sock_fd(s), SIO_TCP_SET_ACK_FREQUENCY, &flag,
32423236
sizeof(flag), NULL, 0, &dummy, NULL, NULL);
32433237
if (res >= 0) {
@@ -6066,8 +6060,10 @@ socket_gethostbyname_ex(PyObject *self, PyObject *args)
60666060
#ifdef USE_GETHOSTBYNAME_LOCK
60676061
PyThread_acquire_lock(netdb_lock, 1);
60686062
#endif
6069-
SUPPRESS_DEPRECATED_CALL
6063+
_Py_COMP_DIAG_PUSH
6064+
_Py_COMP_DIAG_IGNORE_DEPR_DECLS
60706065
h = gethostbyname(name);
6066+
_Py_COMP_DIAG_POP
60716067
#endif /* HAVE_GETHOSTBYNAME_R */
60726068
Py_END_ALLOW_THREADS
60736069
/* Some C libraries would require addr.__ss_family instead of
@@ -6171,8 +6167,10 @@ socket_gethostbyaddr(PyObject *self, PyObject *args)
61716167
#ifdef USE_GETHOSTBYNAME_LOCK
61726168
PyThread_acquire_lock(netdb_lock, 1);
61736169
#endif
6174-
SUPPRESS_DEPRECATED_CALL
6170+
_Py_COMP_DIAG_PUSH
6171+
_Py_COMP_DIAG_IGNORE_DEPR_DECLS
61756172
h = gethostbyaddr(ap, al, af);
6173+
_Py_COMP_DIAG_POP
61766174
#endif /* HAVE_GETHOSTBYNAME_R */
61776175
Py_END_ALLOW_THREADS
61786176
ret = gethost_common(state, h, SAS2SA(&addr), sizeof(addr), af);
@@ -6649,8 +6647,10 @@ _socket_socket_inet_aton_impl(PySocketSockObject *self, const char *ip_addr)
66496647
packed_addr = INADDR_BROADCAST;
66506648
} else {
66516649

6652-
SUPPRESS_DEPRECATED_CALL
6650+
_Py_COMP_DIAG_PUSH
6651+
_Py_COMP_DIAG_IGNORE_DEPR_DECLS
66536652
packed_addr = inet_addr(ip_addr);
6653+
_Py_COMP_DIAG_POP
66546654

66556655
if (packed_addr == INADDR_NONE) { /* invalid address */
66566656
PyErr_SetString(PyExc_OSError,
@@ -6693,8 +6693,10 @@ _socket_socket_inet_ntoa_impl(PySocketSockObject *self, Py_buffer *packed_ip)
66936693
memcpy(&packed_addr, packed_ip->buf, packed_ip->len);
66946694
PyBuffer_Release(packed_ip);
66956695

6696-
SUPPRESS_DEPRECATED_CALL
6696+
_Py_COMP_DIAG_PUSH
6697+
_Py_COMP_DIAG_IGNORE_DEPR_DECLS
66976698
return PyUnicode_FromString(inet_ntoa(packed_addr));
6699+
_Py_COMP_DIAG_POP
66986700
}
66996701
#endif // HAVE_INET_NTOA
67006702

0 commit comments

Comments
 (0)