[Lldb-commits] [PATCH] Make build work on MinGW

Zachary Turner zturner at google.com
Thu Jul 31 14:44:33 PDT 2014


On Thu, Jul 31, 2014 at 2:30 PM, Keno Fischer <kfischer at college.harvard.edu>
wrote:

>
> ================
> Comment at: source/Utility/PseudoTerminal.cpp:23-27
> @@ -22,2 +22,7 @@
> +
> +#ifndef __MINGW32__
> +#ifndef LLDB_DISABLE_PYTHON
>  typedef uint32_t pid_t;
> +#endif
> +#endif
>  // empty functions
> ----------------
> Zachary Turner wrote:
> > Little confused about what's going on here and why we're messing with
> pid_t in two different places (this file and win32.h) with different
> conditions.  Is it possible to centralize all the logic about what's going
> on with pid_t into win32.h?
> Yes, I think that would be a good idea. I was trying to do the inverse
> condition of the one in win32.h here, to avoid it being defined twice. I
> think we should unify it in win32.h if possible.
>
I thought that might be what it was, but inverse would be #if
!defined(__MINGW32__) || !defined(LLDB_DISABLE_PYTHON).  But then after you
fix the original case, the inverse will be different.

I thought about this some and here's what I think:  The correct condition
in win32.h is #if defined(LLDB_DISABLE_PYTHON) && !defined(__MINGW32__)

In PseudoTerminal.cpp I think you can use simply #if !defined(__MINGW32__)

Note that the two aren't strict inverses.  If __MINGW32__ is defined, you
never want pid_t because mingw headers already provide it.  So in neither
case should it be defined.

Python.h on native Win32 typedefs it separately though.  So in the header
file, which is supposed to be general purpose and shouldn't conflict with
Python.h, we only typedef pid_t if python is disabled since there's no
chance of a conflict.  If Python is NOT disabled, then don't do anything,
since it would make the two headers incompatible.

In PseudoTerminal.cpp, we know we aren't ever going to include Python.h, so
we can just always typedef it.

It's kind of confusing though, so I hope I did that right.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20140731/d5d2679e/attachment.html>


More information about the lldb-commits mailing list