Merge pull request #1743 from sirzooro/cygwin-mingw-compilation-fix

Fixed compilation using MinGW from Cygwin 32 and 64 bit
This commit is contained in:
David Anderson 2017-02-02 23:43:01 -08:00 committed by GitHub
commit 3aa6b289cd
3 changed files with 12 additions and 7 deletions

View File

@ -365,8 +365,13 @@ int diagnostics_init(
#if defined(_WIN32)
//_set_abort_behavior(NULL, _WRITE_ABORT_MSG);
#ifdef __MINGW32__
std::set_terminate(boinc_term_func);
std::set_unexpected(boinc_term_func);
#else
set_terminate(boinc_term_func);
set_unexpected(boinc_term_func);
#endif
#if defined(_DEBUG)

View File

@ -306,7 +306,7 @@ int diagnostics_update_thread_list() {
// Enumerate the threads
for(uiSystemIndex = 0; uiSystemIndex < pProcesses->ThreadCount; uiSystemIndex++) {
pThread = &pProcesses->Threads[uiSystemIndex];
pThreadEntry = diagnostics_find_thread_entry((DWORD)pThread->ClientId.UniqueThread);
pThreadEntry = diagnostics_find_thread_entry((DWORD)(uintptr_t)pThread->ClientId.UniqueThread);
if (pThreadEntry) {
pThreadEntry->crash_kernel_time = (FLOAT)pThread->KernelTime.QuadPart;
@ -320,12 +320,12 @@ int diagnostics_update_thread_list() {
hThread = OpenThread(
THREAD_ALL_ACCESS,
FALSE,
(DWORD)(pThread->ClientId.UniqueThread)
(DWORD)(uintptr_t)(pThread->ClientId.UniqueThread)
);
pThreadEntry = new BOINC_THREADLISTENTRY;
diagnostics_init_thread_entry(pThreadEntry);
pThreadEntry->thread_id = (DWORD)(pThread->ClientId.UniqueThread);
pThreadEntry->thread_id = (DWORD)(uintptr_t)(pThread->ClientId.UniqueThread);
pThreadEntry->thread_handle = hThread;
pThreadEntry->crash_kernel_time = (FLOAT)pThread->KernelTime.QuadPart;
pThreadEntry->crash_user_time = (FLOAT)pThread->UserTime.QuadPart;

View File

@ -27,7 +27,7 @@ typedef LONG NTSTATUS;
typedef LONG KPRIORITY;
//MinGW-W64 defines this struct in its own header
#ifndef HAVE_CLIENT_ID
#if !defined(HAVE_CLIENT_ID) && !defined(__MINGW32__)
typedef struct _CLIENT_ID {
DWORD UniqueProcess;
DWORD UniqueThread;
@ -35,7 +35,7 @@ typedef struct _CLIENT_ID {
#endif
//MinGW-W64 defines this struct in its own header
#ifndef HAVE_VM_COUNTERS
#if !defined(HAVE_VM_COUNTERS) && !defined(__MINGW32__)
typedef struct _VM_COUNTERS {
#ifdef _WIN64
// the following was inferred by painful reverse engineering
@ -67,7 +67,7 @@ typedef struct _VM_COUNTERS {
#endif
//MinGW-W64 defines this struct in its own header
#ifndef HAVE_SYSTEM_THREADS
#if !defined(HAVE_SYSTEM_THREADS) && !defined(__MINGW32__)
typedef struct _SYSTEM_THREADS {
LARGE_INTEGER KernelTime;
LARGE_INTEGER UserTime;
@ -112,7 +112,7 @@ typedef struct _SYSTEM_PROCESSES {
#endif
//MinGW-W64 defines this struct in its own header
#ifndef HAVE_THREAD_STATE
#if !defined(HAVE_THREAD_STATE) && !defined(__MINGW32__)
typedef enum _THREAD_STATE {
StateInitialized,
StateReady,