[Lldb-commits] [PATCH] D67863: [LLDB] Cast -1 (as invalid socket) to the socket type before comparing

Martin Storsjö via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Sep 20 13:53:06 PDT 2019


mstorsjo created this revision.
mstorsjo added reviewers: hhb, labath, compnerd.
Herald added subscribers: JDevlieghere, abidh.
Herald added a project: LLDB.

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.


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D67863

Files:
  lldb/source/Host/common/Socket.cpp
  lldb/tools/lldb-vscode/lldb-vscode.cpp


Index: lldb/tools/lldb-vscode/lldb-vscode.cpp
===================================================================
--- lldb/tools/lldb-vscode/lldb-vscode.cpp
+++ lldb/tools/lldb-vscode/lldb-vscode.cpp
@@ -93,7 +93,7 @@
     } else {
       listen(sockfd, 5);
       socklen_t clilen = sizeof(cli_addr);
-      newsockfd = llvm::sys::RetryAfterSignal(-1, accept,
+      newsockfd = llvm::sys::RetryAfterSignal((SOCKET) -1, accept,
           sockfd, (struct sockaddr *)&cli_addr, &clilen);
       if (newsockfd < 0)
         if (g_vsc.log)
Index: lldb/source/Host/common/Socket.cpp
===================================================================
--- lldb/source/Host/common/Socket.cpp
+++ lldb/source/Host/common/Socket.cpp
@@ -476,10 +476,10 @@
   if (!child_processes_inherit) {
     flags |= SOCK_CLOEXEC;
   }
-  NativeSocket fd = llvm::sys::RetryAfterSignal(-1, ::accept4,
+  NativeSocket fd = llvm::sys::RetryAfterSignal((NativeSocket) -1, ::accept4,
       sockfd, addr, addrlen, flags);
 #else
-  NativeSocket fd = llvm::sys::RetryAfterSignal(-1, ::accept,
+  NativeSocket fd = llvm::sys::RetryAfterSignal((NativeSocket) -1, ::accept,
       sockfd, addr, addrlen);
 #endif
   if (fd == kInvalidSocketValue)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D67863.221109.patch
Type: text/x-patch
Size: 1218 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20190920/27d582ba/attachment-0001.bin>


More information about the lldb-commits mailing list