[Lldb-commits] [lldb] r203781 - Hide some declarations from mingw.

Abid, Hafiz Hafiz_Abid at mentor.com
Mon Mar 17 05:09:24 PDT 2014

Probably I was not clear in the description. Previously whole of the file case surrounded by _MSC_VER which was changes to _WIN32 so that code can be used for other compilers too. But there are certain declarations which are probably only needed on MSVC so they were surrounded by _MSC_VER. I suspect some are not even needed for MSVC too e.g. struct timeval which seems to present in winsock2.h for both mingw and msvc. Defining snprintf to _snprintf is also a bit suspect as these functions have slightly different behaviour so I think it is better to restrict these definition to msvc.

Having said that, I am OK to go with your change if you still think that would be the better check.


From: Saleem Abdulrasool [mailto:compnerd at compnerd.org]
Sent: 15 March 2014 02:54
To: Abid, Hafiz
Cc: lldb-commits at cs.uiuc.edu
Subject: Re: [Lldb-commits] [lldb] r203781 - Hide some declarations from mingw.

On Thu, Mar 13, 2014 at 3:42 AM, Hafiz Abid Qadeer <hafiz_abid at mentor.com<mailto:hafiz_abid at mentor.com>> wrote:
Author: abidh
Date: Thu Mar 13 05:42:28 2014
New Revision: 203781

URL: http://llvm.org/viewvc/llvm-project?rev=203781&view=rev
Hide some declarations from mingw.

Given this description, I don't think that this change is the proper way to handle this.  Can you change the #ifdef _MSC_VER to if !defined(__MINGW32__) please?  _MSC_VER indicates that you are using either the Microsoft compiler or clang with Microsoft compatibility.


Modified: lldb/trunk/tools/driver/Platform.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/driver/Platform.cpp?rev=203781&r1=203780&r2=203781&view=diff
--- lldb/trunk/tools/driver/Platform.cpp (original)
+++ lldb/trunk/tools/driver/Platform.cpp Thu Mar 13 05:42:28 2014
@@ -84,6 +84,7 @@ tcgetattr (int fildes, struct termios *t
     return -1;

+#ifdef _MSC_VER
 signal (int sig, sighandler_t sigFunc)
@@ -106,5 +107,6 @@ signal (int sig, sighandler_t sigFunc)
     return 0;


Modified: lldb/trunk/tools/driver/Platform.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/driver/Platform.h?rev=203781&r1=203780&r2=203781&view=diff
--- lldb/trunk/tools/driver/Platform.h (original)
+++ lldb/trunk/tools/driver/Platform.h Thu Mar 13 05:42:28 2014
@@ -16,18 +16,13 @@

     // this will stop signal.h being included
     #define _INC_SIGNAL
     #include <io.h>
+#if defined( _MSC_VER )
     #include <eh.h>
     #include <inttypes.h>
     #include "lldb/Host/windows/windows.h"

-    struct timeval
-    {
-        long tv_sec;
-        long tv_usec;
-    };
     struct winsize
         long ws_col;
@@ -65,13 +60,8 @@
         speed_t c_ospeed;  // output speed

-    typedef long pid_t;
     #define STDIN_FILENO 0

-    #define PATH_MAX MAX_PATH
-    #define snprintf _snprintf
     extern int  ioctl( int d, int request, ... );
     extern int  kill ( pid_t pid, int sig      );
     extern int  tcsetattr( int fd, int optional_actions, const struct termios *termios_p );
@@ -86,7 +76,18 @@
     #define SIG_DFL ( (sighandler_t) -1 )
     // ignored
     #define SIG_IGN ( (sighandler_t) -2 )
+#ifdef _MSC_VER
+    struct timeval
+    {
+        long tv_sec;
+        long tv_usec;
+    };
+    typedef long pid_t;
+    #define snprintf _snprintf
     extern sighandler_t signal( int sig, sighandler_t );
+    #define PATH_MAX MAX_PATH


lldb-commits mailing list
lldb-commits at cs.uiuc.edu<mailto:lldb-commits at cs.uiuc.edu>

Saleem Abdulrasool
compnerd (at) compnerd (dot) org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20140317/6cb8ce02/attachment.html>

More information about the lldb-commits mailing list