[+] Clang/Win32 compilation support

This commit is contained in:
Reece Wilson 2023-12-19 03:43:11 +00:00
parent 4dc2f94467
commit 2570aea213
16 changed files with 47 additions and 33 deletions

View File

@ -14,7 +14,8 @@
"c99-designator", "c99-designator",
"reorder-init-list", "reorder-init-list",
"ignored-attributes", "ignored-attributes",
"missing-declarations" "missing-declarations",
"microsoft-enum-forward-reference"
], ],
"notesClang": "missing-declarations was added to slience a macro hack. dw about it. it being '(struct {};)'. all the other options are my desire for c++ to be less stupid of a language, we all know whats unofficially supported and commonly suppressed in large projects.", "notesClang": "missing-declarations was added to slience a macro hack. dw about it. it being '(struct {};)'. all the other options are my desire for c++ to be less stupid of a language, we all know whats unofficially supported and commonly suppressed in large projects.",
"defines": [], "defines": [],

View File

@ -33,7 +33,7 @@ namespace Aurora::IO::Loop
AUKN_SYM bool WaitMultipleLoopSourcesEx(const AuList<AuSPtr<Loop::ILoopSource>> &lsList, AUKN_SYM bool WaitMultipleLoopSourcesEx(const AuList<AuSPtr<Loop::ILoopSource>> &lsList,
AuList<AuSPtr<Loop::ILoopSource>> &signaled, AuList<AuSPtr<Loop::ILoopSource>> &signaled,
AuUInt64 uFlags = { kWaitMultipleFlagAny }, AuUInt64 uFlags = kWaitMultipleFlagAny,
AuOptional<AuUInt32> optTimeoutMS = {}); AuOptional<AuUInt32> optTimeoutMS = {});
struct ILSSemaphore : virtual ILoopSource struct ILSSemaphore : virtual ILoopSource

View File

@ -26,7 +26,7 @@ struct _NETRESOURCEW;
enum _SE_OBJECT_TYPE; enum _SE_OBJECT_TYPE;
enum _MINIDUMP_TYPE; enum _MINIDUMP_TYPE;
#if defined(AURORA_COMPILER_MSVC) //#if defined(AURORA_COMPILER_MSVC)
struct _IP_ADAPTER_ADDRESSES_LH; struct _IP_ADAPTER_ADDRESSES_LH;
struct _IP_ADAPTER_ADDRESSES_XP; struct _IP_ADAPTER_ADDRESSES_XP;
#if (NTDDI_VERSION >= NTDDI_VISTA) #if (NTDDI_VERSION >= NTDDI_VISTA)
@ -39,7 +39,7 @@ enum _MINIDUMP_TYPE;
typedef _IP_ADAPTER_ADDRESSES_XP IP_ADAPTER_ADDRESSES; typedef _IP_ADAPTER_ADDRESSES_XP IP_ADAPTER_ADDRESSES;
typedef _IP_ADAPTER_ADDRESSES_XP *PIP_ADAPTER_ADDRESSES; typedef _IP_ADAPTER_ADDRESSES_XP *PIP_ADAPTER_ADDRESSES;
#endif #endif
#endif //#endif
namespace Aurora namespace Aurora
{ {

View File

@ -10,9 +10,7 @@
#if defined(AURORA_IS_MODERNNT_DERIVED) #if defined(AURORA_IS_MODERNNT_DERIVED)
#include <DbgHelp.h> #include <DbgHelp.h>
#endif #elif defined(AURORA_COMPILER_CLANG)
#if defined(AURORA_COMPILER_CLANG)
#include <cxxabi.h> #include <cxxabi.h>
#endif #endif

View File

@ -7,6 +7,10 @@
***/ ***/
#pragma once #pragma once
#if defined(AURORA_COMPILER_CLANG)
struct _ThrowInfo;
#endif
namespace Aurora::Debug namespace Aurora::Debug
{ {
AuString ReportSEH(HMODULE handle, void *exception, const void *throwInfo, const AuFunction<AuString()> &resolveFallback, const StackTrace &trace, const AuFunction<void(const AuString &)> &prereport); AuString ReportSEH(HMODULE handle, void *exception, const void *throwInfo, const AuFunction<AuString()> &resolveFallback, const StackTrace &trace, const AuFunction<void(const AuString &)> &prereport);

View File

@ -61,7 +61,7 @@ namespace Aurora::IO::FS
bool Wait(AuUInt32 timeout) override; bool Wait(AuUInt32 timeout) override;
AuSPtr<AuLoop::ILoopSource> NewLoopSource() override; AuSPtr<AuLoop::ILoopSource> NewLoopSource() override;
void Reset(); void Reset() override;
bool IDontWannaUsePorts(); bool IDontWannaUsePorts();

View File

@ -263,7 +263,10 @@ namespace Aurora::IO::FS
bool NTCachedPath::AddEvent(NTWatcher *parent, EWatchEvent type, const AuString &path) bool NTCachedPath::AddEvent(NTWatcher *parent, EWatchEvent type, const AuString &path)
{ {
AuCtorCode_t code; AuCtorCode_t code;
auto watchedFile = AuTryConstruct<WatchedFile>(code, this->userData, this->strTheCakeIsALie); WatchedFile watchedFile;
watchedFile.userData = this->userData;
watchedFile.path = AuMove(AuTryConstruct<AuString>(code, this->strTheCakeIsALie));
if (!code) if (!code)
{ {
return false; return false;
@ -272,7 +275,7 @@ namespace Aurora::IO::FS
WatchEvent event; WatchEvent event;
event.event = type; event.event = type;
event.watch = AuMove(watchedFile); event.watch = AuMove(watchedFile);
event.file = AuTryConstruct<AuString>(code, path); event.file = AuMove(AuTryConstruct<AuString>(code, path));
if (!code) if (!code)
{ {
return false; return false;
@ -387,7 +390,7 @@ namespace Aurora::IO::FS
REQUEST_OPLOCK_CURRENT_VERSION, REQUEST_OPLOCK_CURRENT_VERSION,
sizeof(REQUEST_OPLOCK_INPUT_BUFFER), sizeof(REQUEST_OPLOCK_INPUT_BUFFER),
OPLOCK_LEVEL_CACHE_READ | OPLOCK_LEVEL_CACHE_HANDLE, OPLOCK_LEVEL_CACHE_READ | OPLOCK_LEVEL_CACHE_HANDLE,
bFirstTime ? REQUEST_OPLOCK_INPUT_FLAG_REQUEST : REQUEST_OPLOCK_INPUT_FLAG_ACK, (DWORD)(bFirstTime ? REQUEST_OPLOCK_INPUT_FLAG_REQUEST : REQUEST_OPLOCK_INPUT_FLAG_ACK),
}; };
DWORD dwBytesReturned; DWORD dwBytesReturned;

View File

@ -339,7 +339,7 @@ namespace Aurora::IO::IPC
handle.PushId(EIPCHandleType::eIPCPrimitiveSemaphore, token); handle.PushId(EIPCHandleType::eIPCPrimitiveSemaphore, token);
auto semaphore = ::CreateSemaphoreA(nullptr, startingValue, AuNumericLimits<LONG>::max(), token.ToNTPath().c_str()); auto semaphore = ::CreateSemaphoreA(nullptr, startingValue, /*AuNumericLimits<LONG>::max()*/ LONG_MAX, token.ToNTPath().c_str());
if ((!semaphore) || if ((!semaphore) ||
(semaphore == INVALID_HANDLE_VALUE)) (semaphore == INVALID_HANDLE_VALUE))
{ {

View File

@ -19,8 +19,8 @@ namespace Aurora::IO::Loop
bool Set() override; bool Set() override;
bool Reset() override; bool Reset() override;
virtual bool ILSEvent::IsSignaled() override; virtual bool IsSignaled() override;
virtual bool ILSEvent::WaitOn(AuUInt32 timeout) override; virtual bool WaitOn(AuUInt32 timeout) override;
virtual ELoopSource ILSEvent::GetType() override; virtual ELoopSource GetType() override;
}; };
} }

View File

@ -12,7 +12,7 @@
namespace Aurora::IO::Loop namespace Aurora::IO::Loop
{ {
#if defined(AURORA_IS_MODERNNT_DERIVED) #if defined(AURORA_IS_MODERNNT_DERIVED)
static constexpr auto kInvalidHandle = (AuUInt)INVALID_HANDLE_VALUE; static constexpr auto kInvalidHandle = (const AuUInt)-1;
#else #else
static constexpr auto kInvalidHandle = -1; static constexpr auto kInvalidHandle = -1;
#endif #endif

View File

@ -17,8 +17,8 @@ namespace Aurora::IO::Loop
bool Unlock() override; bool Unlock() override;
bool ILSMutex::IsSignaled() override; bool IsSignaled() override;
bool ILSMutex::WaitOn(AuUInt32 timeout) override; bool WaitOn(AuUInt32 timeout) override;
ELoopSource ILSMutex::GetType() override; ELoopSource GetType() override;
}; };
} }

View File

@ -52,7 +52,7 @@ namespace Aurora::IO::Loop
bool LSSemaphore::TryInit(AuUInt32 initialCount) bool LSSemaphore::TryInit(AuUInt32 initialCount)
{ {
auto semaphore = ::CreateSemaphoreA(NULL, initialCount, AuNumericLimits<LONG>::max(), NULL); auto semaphore = ::CreateSemaphoreA(NULL, initialCount, /*AuNumericLimits<LONG>::max()*/ LONG_MAX, NULL);
if (!semaphore) if (!semaphore)
{ {
SysPushErrorGen("Out of OS resources?"); SysPushErrorGen("Out of OS resources?");
@ -68,7 +68,7 @@ namespace Aurora::IO::Loop
{ {
AuSPtr<LSSemaphore> ret; AuSPtr<LSSemaphore> ret;
auto semaphore = ::CreateSemaphoreA(NULL, initialCount, AuNumericLimits<LONG>::max(), NULL); auto semaphore = ::CreateSemaphoreA(NULL, initialCount, /*AuNumericLimits<LONG>::max()*/ LONG_MAX, NULL);
if (!semaphore) if (!semaphore)
{ {
SysPushErrorGen("Out of OS resources?"); SysPushErrorGen("Out of OS resources?");

View File

@ -21,8 +21,8 @@ namespace Aurora::IO::Loop
bool AddOne() override; bool AddOne() override;
bool AddMany(AuUInt32 uCount) override; bool AddMany(AuUInt32 uCount) override;
bool ILSSemaphore::IsSignaled() override; bool IsSignaled() override;
bool ILSSemaphore::WaitOn(AuUInt32 timeout) override; bool WaitOn(AuUInt32 timeout) override;
ELoopSource ILSSemaphore::GetType() override; ELoopSource GetType() override;
}; };
} }

View File

@ -109,7 +109,7 @@ namespace Aurora::IO::Net
WSABUF bufferArray[] { WSABUF bufferArray[] {
{ {
memoryView->length, (ULONG)memoryView->length,
memoryView->Begin<CHAR>() memoryView->Begin<CHAR>()
} }
}; };
@ -213,7 +213,7 @@ namespace Aurora::IO::Net
WSABUF bufferArray[] { WSABUF bufferArray[] {
{ {
memoryView->length, (ULONG)memoryView->length,
(CHAR *)memoryView->Begin<CHAR>() (CHAR *)memoryView->Begin<CHAR>()
} }
}; };

View File

@ -43,7 +43,7 @@ namespace Aurora::IO::Net
void SetBaseOffset(AuUInt64 uBaseOffset) override; void SetBaseOffset(AuUInt64 uBaseOffset) override;
void Reset(); void Reset() override;
void MakeSyncable(); void MakeSyncable();
void ForceNextWriteWait(); void ForceNextWriteWait();

View File

@ -11,7 +11,15 @@
#include "AuCivilTime.hpp" #include "AuCivilTime.hpp"
#include "Time.hpp" #include "Time.hpp"
#if defined(AURORA_IS_MODERNNT_DERIVED)
#if defined(AURORA_COMPILER_MSVC) || \
defined(_CRT_USE_CONFORMING_ANNEX_K_TIME)
#define TIME_MSFT_LIKE
#endif
#if defined(TIME_MSFT_LIKE)
#define timegm _mkgmtime #define timegm _mkgmtime
@ -108,12 +116,12 @@ namespace Aurora::Time
auto timet = MSToCTime(time); auto timet = MSToCTime(time);
if (shift == ETimezoneShift::eUTC) if (shift == ETimezoneShift::eUTC)
{ {
#if defined(AURORA_COMPILER_MSVC) #if defined(TIME_MSFT_LIKE)
auto tm = gmtime_s(&ret, &timet); auto tm = gmtime_s(&ret, &timet);
#else #else
auto tm = gmtime_r(&timet, &ret); auto tm = gmtime_r(&timet, &ret);
#endif #endif
#if defined(AURORA_COMPILER_MSVC) #if defined(TIME_MSFT_LIKE)
SysAssert(!tm, "couldn't convert civil time"); SysAssert(!tm, "couldn't convert civil time");
#else #else
SysAssert(tm, "couldn't convert civil time"); SysAssert(tm, "couldn't convert civil time");
@ -122,7 +130,7 @@ namespace Aurora::Time
} }
else else
{ {
#if defined(AURORA_COMPILER_MSVC) #if defined(TIME_MSFT_LIKE)
if (localtime_s(&ret, &timet)) if (localtime_s(&ret, &timet))
#else #else
if (!localtime_r(&timet, &ret)) if (!localtime_r(&timet, &ret))