diff --git a/lldb/include/lldb/Host/windows/PosixApi.h b/lldb/include/lldb/Host/windows/PosixApi.h --- a/lldb/include/lldb/Host/windows/PosixApi.h +++ b/lldb/include/lldb/Host/windows/PosixApi.h @@ -45,6 +45,15 @@ #define S_IRWXG 0 #define S_IRWXO 0 +#ifdef __MINGW32__ +// pyconfig.h typedefs this. We require python headers to be included before +// any LLDB headers, but there's no way to prevent python's pid_t definition +// from leaking, so this is the best option. +#ifndef NO_PID_T +#include +#endif +#endif // __MINGW32__ + #ifdef _MSC_VER // PRIxxx format macros for printf() @@ -80,6 +89,8 @@ char *strcasestr(const char *s, const char *find); char *realpath(const char *name, char *resolved); +#ifdef _MSC_VER + int usleep(uint32_t useconds); char *basename(char *path); char *dirname(char *path); @@ -87,6 +98,8 @@ int strcasecmp(const char *s1, const char *s2); int strncasecmp(const char *s1, const char *s2, size_t n); +#endif // _MSC_VER + // empty functions inline int posix_openpt(int flag) { LLVM_BUILTIN_UNREACHABLE; } diff --git a/lldb/source/Host/windows/FileSystem.cpp b/lldb/source/Host/windows/FileSystem.cpp --- a/lldb/source/Host/windows/FileSystem.cpp +++ b/lldb/source/Host/windows/FileSystem.cpp @@ -8,6 +8,7 @@ #include "lldb/Host/windows/windows.h" +#include #include #include #include diff --git a/lldb/source/Initialization/SystemInitializerCommon.cpp b/lldb/source/Initialization/SystemInitializerCommon.cpp --- a/lldb/source/Initialization/SystemInitializerCommon.cpp +++ b/lldb/source/Initialization/SystemInitializerCommon.cpp @@ -25,6 +25,7 @@ #if defined(_WIN32) #include "Plugins/Process/Windows/Common/ProcessWindowsLog.h" #include "lldb/Host/windows/windows.h" +#include #endif #include "llvm/Support/TargetSelect.h" diff --git a/lldb/tools/driver/Platform.h b/lldb/tools/driver/Platform.h --- a/lldb/tools/driver/Platform.h +++ b/lldb/tools/driver/Platform.h @@ -15,6 +15,9 @@ #if defined(_MSC_VER) #include #endif +#if HAVE_SYS_TYPES_H +#include +#endif #include "lldb/Host/windows/windows.h" #include diff --git a/lldb/tools/lldb-vscode/VSCode.cpp b/lldb/tools/lldb-vscode/VSCode.cpp --- a/lldb/tools/lldb-vscode/VSCode.cpp +++ b/lldb/tools/lldb-vscode/VSCode.cpp @@ -15,8 +15,10 @@ #include "llvm/Support/FormatVariadic.h" #if defined(_WIN32) +#ifndef __MINGW32__ #define NOMINMAX #include +#endif // __MINGW32__ #include #include #endif diff --git a/lldb/tools/lldb-vscode/lldb-vscode.cpp b/lldb/tools/lldb-vscode/lldb-vscode.cpp --- a/lldb/tools/lldb-vscode/lldb-vscode.cpp +++ b/lldb/tools/lldb-vscode/lldb-vscode.cpp @@ -50,7 +50,9 @@ #include "VSCode.h" #if defined(_WIN32) +#ifndef PATH_MAX #define PATH_MAX MAX_PATH +#endif typedef int socklen_t; constexpr const char *dev_null_path = "nul";