[LLDB] Cast -1 (as invalid socket) to the socket type before comparing

This silences warnings about comparison of integers between unsigned
long long (which is what the Windows SOCKET type is) and signed int
when building in MinGW mode.

Differential Revision: https://reviews.llvm.org/D67863

llvm-svn: 372486
This commit is contained in:
Martin Storsjo 2019-09-21 19:10:15 +00:00
parent ed78dc8e43
commit 5534a67500
2 changed files with 7 additions and 6 deletions

View File

@ -476,11 +476,11 @@ NativeSocket Socket::AcceptSocket(NativeSocket sockfd, struct sockaddr *addr,
if (!child_processes_inherit) {
flags |= SOCK_CLOEXEC;
}
NativeSocket fd = llvm::sys::RetryAfterSignal(-1, ::accept4,
sockfd, addr, addrlen, flags);
NativeSocket fd = llvm::sys::RetryAfterSignal(
static_cast<NativeSocket>(-1), ::accept4, sockfd, addr, addrlen, flags);
#else
NativeSocket fd = llvm::sys::RetryAfterSignal(-1, ::accept,
sockfd, addr, addrlen);
NativeSocket fd = llvm::sys::RetryAfterSignal(
static_cast<NativeSocket>(-1), ::accept, sockfd, addr, addrlen);
#endif
if (fd == kInvalidSocketValue)
SetLastError(error);

View File

@ -93,8 +93,9 @@ SOCKET AcceptConnection(int portno) {
} else {
listen(sockfd, 5);
socklen_t clilen = sizeof(cli_addr);
newsockfd = llvm::sys::RetryAfterSignal(-1, accept,
sockfd, (struct sockaddr *)&cli_addr, &clilen);
newsockfd =
llvm::sys::RetryAfterSignal(static_cast<SOCKET>(-1), accept, sockfd,
(struct sockaddr *)&cli_addr, &clilen);
if (newsockfd < 0)
if (g_vsc.log)
*g_vsc.log << "error: accept (" << strerror(errno) << ")"