[Lldb-commits] [lldb] r203781 - Hide some declarations from mingw.
Saleem Abdulrasool
compnerd at compnerd.org
Mon Mar 17 21:21:10 PDT 2014
On Mon, Mar 17, 2014 at 5:09 AM, Abid, Hafiz <Hafiz_Abid at mentor.com> wrote:
> 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.
>
Ah, it was indeed the commit message that was misleading. I think that the
_MSC_VER is still slightly misleading as it is simply there to indicate
that you are running against a pure MSVCRT environment rather than cygwin
or MinGW. But, I dont know of a better way to indicate that (in LLVM we
would just use LLVM_ON_WIN32).
I do agree with your sentiment on simply defining snprintf to _snprintf as
being dubious given the slightly different semantics of the two calls.
Thanks for the clarification!
>
Thanks,
>
> Abid
>
>
>
> *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>
> 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
> Log:
> 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
> lldb/trunk/tools/driver/Platform.h
>
> 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
> sighandler_t
> signal (int sig, sighandler_t sigFunc)
> {
> @@ -106,5 +107,6 @@ signal (int sig, sighandler_t sigFunc)
> }
> return 0;
> }
> +#endif
>
> #endif
>
> 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>
> +#endif
> #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
> +#endif
>
> #else
>
>
>
> _______________________________________________
> lldb-commits mailing list
> lldb-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits
>
>
>
> --
> Saleem Abdulrasool
> compnerd (at) compnerd (dot) org
>
--
Saleem Abdulrasool
compnerd (at) compnerd (dot) org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20140317/d873d58d/attachment.html>
More information about the lldb-commits
mailing list