Patches to make it possible to compile with mingw, pt. 1

This commit is contained in:
twinaphex 2017-08-29 18:27:46 +02:00
parent 9888d774c8
commit 418e341b32
5 changed files with 10 additions and 2 deletions

View File

@ -88,6 +88,10 @@ inline void AtomicStoreRelease(volatile T& dest, U value)
dest = (T)value; // 32-bit writes are always atomic dest = (T)value; // 32-bit writes are always atomic
} }
#ifdef __MINGW32__
void *_InterlockedExchangePointer_acq(void *volatile *, void volatile *);
#endif
template <typename T, typename U> template <typename T, typename U>
inline T* AtomicExchangeAcquire(T* volatile& loc, U newval) inline T* AtomicExchangeAcquire(T* volatile& loc, U newval)
{ {

View File

@ -64,7 +64,9 @@ private:
// Check MSC ver // Check MSC ver
#if !defined _MSC_VER || _MSC_VER <= 1000 #if !defined _MSC_VER || _MSC_VER <= 1000
#ifndef __MINGW32__
#error needs at least version 1000 of MSC #error needs at least version 1000 of MSC
#endif
#endif #endif
// Memory leak checks // Memory leak checks

View File

@ -77,7 +77,7 @@ ConsoleListener::~ConsoleListener()
Close(); Close();
} }
#ifdef _WIN32 #if defined(_WIN32) && !defined(__MINGW32__)
// Handle console event // Handle console event
bool WINAPI ConsoleHandler(DWORD msgType) bool WINAPI ConsoleHandler(DWORD msgType)
{ {

View File

@ -26,12 +26,14 @@
#include "Common.h" #include "Common.h"
#ifdef _WIN32 #ifdef _WIN32
#ifndef __MINGW32__
inline struct tm* localtime_r(const time_t *clock, struct tm *result) { inline struct tm* localtime_r(const time_t *clock, struct tm *result) {
if (localtime_s(result, clock) == 0) if (localtime_s(result, clock) == 0)
return result; return result;
return NULL; return NULL;
} }
#endif #endif
#endif
namespace File { namespace File {

View File

@ -33,7 +33,7 @@ extern bool MsgAlert(bool yes_no, int Style, const char* format, ...)
void SetEnableAlert(bool enable); void SetEnableAlert(bool enable);
#ifndef GEKKO #ifndef GEKKO
#ifdef _WIN32 #if defined(_WIN32) && !defined(__MINGW32__)
#define PanicAlert(format, ...) MsgAlert(false, WARNING, format, __VA_ARGS__) #define PanicAlert(format, ...) MsgAlert(false, WARNING, format, __VA_ARGS__)
#define PanicYesNo(format, ...) MsgAlert(true, WARNING, format, __VA_ARGS__) #define PanicYesNo(format, ...) MsgAlert(true, WARNING, format, __VA_ARGS__)
#else #else