From c4d5ed06cde28a4c209385a2513e338673834c80 Mon Sep 17 00:00:00 2001 From: Hafiz Abid Qadeer Date: Wed, 11 Feb 2015 10:14:13 +0000 Subject: [PATCH] Fix Mingw build. Following changes are done. Add missing headers. Replace _snprintf with snprintf. It is already changed to _snprintf for MSVC. Add a file in the build for autoconf. Call DynamicLoaderWindows::Terminate and DynamicLoaderWindows::Initialize only for MSVC build. Reviewed in http://reviews.llvm.org/D7536. llvm-svn: 228822 --- lldb/source/Host/common/SocketAddress.cpp | 5 ++++- lldb/source/Host/windows/Makefile | 2 ++ lldb/source/Utility/UriParser.cpp | 1 + lldb/source/lldb.cpp | 4 ++-- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/lldb/source/Host/common/SocketAddress.cpp b/lldb/source/Host/common/SocketAddress.cpp index fd7fbac..b6a7a08 100644 --- a/lldb/source/Host/common/SocketAddress.cpp +++ b/lldb/source/Host/common/SocketAddress.cpp @@ -9,10 +9,13 @@ #include "lldb/Host/SocketAddress.h" #include +#include // C Includes #if !defined(_WIN32) #include +#else +#include "lldb/Host/windows/win32.h" #endif #include #include @@ -54,7 +57,7 @@ const char* inet_ntop(int af, const void * src, { char tmp[INET6_ADDRSTRLEN] = {0}; const uint16_t* src16 = static_cast(src); - int full_size = _snprintf(tmp, sizeof(tmp), + int full_size = ::snprintf(tmp, sizeof(tmp), "%x:%x:%x:%x:%x:%x:%x:%x", ntohs(src16[0]), ntohs(src16[1]), ntohs(src16[2]), ntohs(src16[3]), ntohs(src16[4]), ntohs(src16[5]), ntohs(src16[6]), ntohs(src16[7]) diff --git a/lldb/source/Host/windows/Makefile b/lldb/source/Host/windows/Makefile index f85327a..a1eb3f8 100644 --- a/lldb/source/Host/windows/Makefile +++ b/lldb/source/Host/windows/Makefile @@ -11,4 +11,6 @@ LLDB_LEVEL := ../../.. LIBRARYNAME := lldbHostWindows BUILD_ARCHIVE = 1 +SOURCES = $(notdir $(wildcard $(PROJ_SRC_DIR)/*.cpp )) $(PROJ_SRC_DIR)/../posix/ConnectionFileDescriptorPosix.cpp + include $(LLDB_LEVEL)/Makefile diff --git a/lldb/source/Utility/UriParser.cpp b/lldb/source/Utility/UriParser.cpp index 1d4402f..86020d1 100644 --- a/lldb/source/Utility/UriParser.cpp +++ b/lldb/source/Utility/UriParser.cpp @@ -11,6 +11,7 @@ // C Includes #include +#include // C++ Includes // Other libraries and framework includes diff --git a/lldb/source/lldb.cpp b/lldb/source/lldb.cpp index 2ac8296..6988bc2 100644 --- a/lldb/source/lldb.cpp +++ b/lldb/source/lldb.cpp @@ -209,7 +209,7 @@ lldb_private::Initialize () //---------------------------------------------------------------------- ProcessLinux::Initialize(); #endif -#if defined(_WIN32) +#if defined(_MSC_VER) DynamicLoaderWindows::Initialize(); ProcessWindows::Initialize(); #endif @@ -298,7 +298,7 @@ lldb_private::Terminate () Debugger::SettingsTerminate (); -#if defined (_WIN32) +#if defined(_MSC_VER) DynamicLoaderWindows::Terminate(); #endif -- 2.7.4