[+] 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",
"reorder-init-list",
"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.",
"defines": [],

View File

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

View File

@ -26,7 +26,7 @@ struct _NETRESOURCEW;
enum _SE_OBJECT_TYPE;
enum _MINIDUMP_TYPE;
#if defined(AURORA_COMPILER_MSVC)
//#if defined(AURORA_COMPILER_MSVC)
struct _IP_ADAPTER_ADDRESSES_LH;
struct _IP_ADAPTER_ADDRESSES_XP;
#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 *PIP_ADAPTER_ADDRESSES;
#endif
#endif
//#endif
namespace Aurora
{

View File

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

View File

@ -7,6 +7,10 @@
***/
#pragma once
#if defined(AURORA_COMPILER_CLANG)
struct _ThrowInfo;
#endif
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);

View File

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

View File

@ -263,7 +263,10 @@ namespace Aurora::IO::FS
bool NTCachedPath::AddEvent(NTWatcher *parent, EWatchEvent type, const AuString &path)
{
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)
{
return false;
@ -272,7 +275,7 @@ namespace Aurora::IO::FS
WatchEvent event;
event.event = type;
event.watch = AuMove(watchedFile);
event.file = AuTryConstruct<AuString>(code, path);
event.file = AuMove(AuTryConstruct<AuString>(code, path));
if (!code)
{
return false;
@ -387,7 +390,7 @@ namespace Aurora::IO::FS
REQUEST_OPLOCK_CURRENT_VERSION,
sizeof(REQUEST_OPLOCK_INPUT_BUFFER),
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;

View File

@ -339,7 +339,7 @@ namespace Aurora::IO::IPC
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) ||
(semaphore == INVALID_HANDLE_VALUE))
{

View File

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

View File

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

View File

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

View File

@ -52,7 +52,7 @@ namespace Aurora::IO::Loop
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)
{
SysPushErrorGen("Out of OS resources?");
@ -68,7 +68,7 @@ namespace Aurora::IO::Loop
{
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)
{
SysPushErrorGen("Out of OS resources?");

View File

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

View File

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

View File

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

View File

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