From: Martin Storsjo Date: Mon, 23 Sep 2019 12:03:56 +0000 (+0000) Subject: [LLDB] Check for _WIN32 instead of _MSC_VER for code specific to windows in general X-Git-Tag: llvmorg-11-init~8583 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8b98f12a7ab8c99044f6ab9278da08d96cb0e3e2;p=platform%2Fupstream%2Fllvm.git [LLDB] Check for _WIN32 instead of _MSC_VER for code specific to windows in general These ifdefs contain code that isn't specific to MSVC but useful for any windows target, like MinGW. Differential Revision: https://reviews.llvm.org/D67893 llvm-svn: 372592 --- diff --git a/lldb/source/Core/IOHandler.cpp b/lldb/source/Core/IOHandler.cpp index 9f47f1c..f654428 100644 --- a/lldb/source/Core/IOHandler.cpp +++ b/lldb/source/Core/IOHandler.cpp @@ -579,7 +579,7 @@ void IOHandlerEditline::PrintAsync(Stream *stream, const char *s, size_t len) { else #endif { -#ifdef _MSC_VER +#ifdef _WIN32 const char *prompt = GetPrompt(); if (prompt) { // Back up over previous prompt using Windows API @@ -594,7 +594,7 @@ void IOHandlerEditline::PrintAsync(Stream *stream, const char *s, size_t len) { } #endif IOHandler::PrintAsync(stream, s, len); -#ifdef _MSC_VER +#ifdef _WIN32 if (prompt) IOHandler::PrintAsync(GetOutputStreamFile().get(), prompt, strlen(prompt)); diff --git a/lldb/source/Host/common/UDPSocket.cpp b/lldb/source/Host/common/UDPSocket.cpp index 03ad7f5..7accbb6 100644 --- a/lldb/source/Host/common/UDPSocket.cpp +++ b/lldb/source/Host/common/UDPSocket.cpp @@ -80,7 +80,7 @@ Status UDPSocket::Connect(llvm::StringRef name, bool child_processes_inherit, &service_info_list); if (err != 0) { error.SetErrorStringWithFormat( -#if defined(_MSC_VER) && defined(UNICODE) +#if defined(_WIN32) && defined(UNICODE) "getaddrinfo(%s, %s, &hints, &info) returned error %i (%S)", #else "getaddrinfo(%s, %s, &hints, &info) returned error %i (%s)", diff --git a/lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp b/lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp index a842563..9b35640 100644 --- a/lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp +++ b/lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp @@ -564,7 +564,7 @@ ConnectionFileDescriptor::BytesAvailable(const Timeout &timeout, select_helper.SetTimeout(*timeout); select_helper.FDSetRead(handle); -#if defined(_MSC_VER) +#if defined(_WIN32) // select() won't accept pipes on Windows. The entire Windows codepath // needs to be converted over to using WaitForMultipleObjects and event // HANDLEs, but for now at least this will allow ::select() to not return diff --git a/lldb/source/Utility/SelectHelper.cpp b/lldb/source/Utility/SelectHelper.cpp index ff21d99..9f5ca58 100644 --- a/lldb/source/Utility/SelectHelper.cpp +++ b/lldb/source/Utility/SelectHelper.cpp @@ -92,7 +92,7 @@ static void updateMaxFd(llvm::Optional &vold, lldb_private::Status SelectHelper::Select() { lldb_private::Status error; -#ifdef _MSC_VER +#ifdef _WIN32 // On windows FD_SETSIZE limits the number of file descriptors, not their // numeric value. lldbassert(m_fd_map.size() <= FD_SETSIZE); @@ -107,7 +107,7 @@ lldb_private::Status SelectHelper::Select() { for (auto &pair : m_fd_map) { pair.second.PrepareForSelect(); const lldb::socket_t fd = pair.first; -#if !defined(__APPLE__) && !defined(_MSC_VER) +#if !defined(__APPLE__) && !defined(_WIN32) lldbassert(fd < static_cast(FD_SETSIZE)); if (fd >= static_cast(FD_SETSIZE)) { error.SetErrorStringWithFormat("%i is too large for select()", fd); diff --git a/lldb/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp b/lldb/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp index 64d4338..b9b5163 100644 --- a/lldb/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp +++ b/lldb/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp @@ -31,7 +31,7 @@ #include "lldb/Utility/ArchSpec.h" #include "lldb/Utility/FileSpec.h" -#if defined(_MSC_VER) +#if defined(_WIN32) #include "lldb/Host/windows/windows.h" #include #endif @@ -46,7 +46,7 @@ public: // Initialize and TearDown the plugin every time, so we get a brand new // AST every time so that modifications to the AST from each test don't // leak into the next test. -#if defined(_MSC_VER) +#if defined(_WIN32) ::CoInitializeEx(nullptr, COINIT_MULTITHREADED); #endif @@ -69,7 +69,7 @@ public: HostInfo::Terminate(); FileSystem::Terminate(); -#if defined(_MSC_VER) +#if defined(_WIN32) ::CoUninitialize(); #endif }