Fix multiple build errors when compiling with MinGW.

This commit is contained in:
Rokas Kupstys 2019-08-04 12:00:38 +03:00
parent eed7039853
commit b391e4c21a
6 changed files with 26 additions and 2 deletions

View File

@ -35,6 +35,19 @@ CallstackEntry cb_data[MaxCbTrace];
extern "C" { t_RtlWalkFrameChain RtlWalkFrameChain = 0; }
#if defined __MINGW32__ && API_VERSION_NUMBER < 12
extern "C" {
// Actual required API_VERSION_NUMBER is unknown because it is undocumented. These functions are not present in at least v11.
DWORD IMAGEAPI SymAddrIncludeInlineTrace(HANDLE hProcess, DWORD64 Address);
BOOL IMAGEAPI SymQueryInlineTrace(HANDLE hProcess, DWORD64 StartAddress, DWORD StartContext, DWORD64 StartRetAddress,
DWORD64 CurAddress, LPDWORD CurContext, LPDWORD CurFrameIndex);
BOOL IMAGEAPI SymFromInlineContext(HANDLE hProcess, DWORD64 Address, ULONG InlineContext, PDWORD64 Displacement,
PSYMBOL_INFO Symbol);
BOOL IMAGEAPI SymGetLineFromInlineContext(HANDLE hProcess, DWORD64 qwAddr, ULONG InlineContext,
DWORD64 qwModuleBaseAddress, PDWORD pdwDisplacement, PIMAGEHLP_LINE64 Line64);
};
#endif
void InitCallstack()
{
#ifdef UNICODE

View File

@ -235,7 +235,7 @@ static int64_t SetupHwTimer()
#elif defined TRACY_HW_TIMER && ( defined __i386 || defined _M_IX86 || defined __x86_64__ || defined _M_X64 )
static inline void CpuId( uint32_t* regs, uint32_t leaf )
{
#if defined _MSC_VER || defined __CYGWIN__
#if defined _WIN32 || defined __CYGWIN__
__cpuidex( (int*)regs, leaf, 0 );
#else
__get_cpuid( leaf, regs, regs+1, regs+2, regs+3 );

View File

@ -436,7 +436,11 @@ IpAddress::~IpAddress()
void IpAddress::Set( const struct sockaddr& addr )
{
#if __MINGW32__
auto ai = (struct sockaddr_in*)&addr;
#else
auto ai = (const struct sockaddr_in*)&addr;
#endif
inet_ntop( AF_INET, &ai->sin_addr, m_text, 17 );
m_number = ai->sin_addr.s_addr;
}

View File

@ -1,4 +1,4 @@
#ifdef _MSC_VER
#ifdef _WIN32
# include <ws2tcpip.h>
#else
# include <arpa/inet.h>

View File

@ -1,12 +1,16 @@
#ifdef _MSC_VER
# pragma warning( disable: 4244 ) // conversion from don't care to whatever, possible loss of data
#endif
#ifdef __MINGW32__
# define __STDC_FORMAT_MACROS
#endif
#include <assert.h>
#include <inttypes.h>
#include <math.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h> // llabs()
#include <string.h>
#include "TracyPrint.hpp"

View File

@ -1,3 +1,6 @@
#ifdef __MINGW32__
# define __STDC_FORMAT_MACROS
#endif
#include <assert.h>
#include <inttypes.h>
#include <string>