Skip to content

Commit 89a1682

Browse files
committed
fix: clang-cl issues
1 parent f420a94 commit 89a1682

5 files changed

Lines changed: 34 additions & 5 deletions

File tree

include/REL/HookObject.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ namespace REL
3030
HookObject(const std::uintptr_t a_address, const HOOK_TYPE a_type);
3131
HookObject(const std::uintptr_t a_address, const HOOK_TYPE a_type, const HOOK_STEP a_step);
3232
HookObject(const std::uintptr_t a_address, const HOOK_STEP a_step);
33+
HookObject(const std::uintptr_t a_address, const char* a_name, const HOOK_STEP a_step);
3334
HookObject(const std::uintptr_t a_address, const char* a_name, const HOOK_TYPE a_type);
3435
HookObject(const std::uintptr_t a_address, const char* a_name, const HOOK_TYPE a_type, const HOOK_STEP a_step);
3536

include/REL/Relocation.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ namespace REL
157157
noexcept(std::is_nothrow_invocable_v<F, First, Rest...>)
158158
{
159159
using result_t = std::invoke_result_t<F, First, Rest...>;
160-
std::aligned_storage_t<sizeof(result_t), alignof(result_t)> result;
160+
alignas(result_t) std::array<std::byte, sizeof(result_t)> result;
161161

162162
using func_t = member_function_non_pod_type_t<F>;
163163
auto func = REX::UNRESTRICTED_CAST<func_t*>(std::forward<F>(a_func));

src/REL/HookObject.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
#pragma once
2-
1+
#include "REL/HookObject.h"
32
#include "REL/HookStore.h"
43

54
namespace REL
@@ -38,6 +37,12 @@ namespace REL
3837
m_name = std::to_string(m_handle);
3938
}
4039

40+
HookObject::HookObject(const std::uintptr_t a_address, const char* a_name, const HOOK_STEP a_step) :
41+
m_address(a_address), m_name(a_name), m_step(a_step)
42+
{
43+
m_handle = HookStore::GetSingleton()->Add(this);
44+
}
45+
4146
HookObject::HookObject(const std::uintptr_t a_address, const char* a_name, const HOOK_TYPE a_type) :
4247
m_address(a_address), m_name(a_name), m_type(a_type)
4348
{

src/REX/REX/LOG.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ namespace REX
6060

6161
namespace REX::IMPL
6262
{
63-
[[noreturn]] void FAIL(const std::source_location a_loc, const std::string_view a_fmt)
63+
void FAIL(const std::source_location a_loc, const std::string_view a_fmt)
6464
{
6565
const auto body = [&]() {
6666
constexpr std::array directories{
@@ -116,7 +116,7 @@ namespace REX::IMPL
116116
REX::W32::TerminateProcess(REX::W32::GetCurrentProcess(), 1);
117117
}
118118

119-
[[noreturn]] void FAIL(const std::source_location a_loc, const std::wstring_view a_fmt)
119+
void FAIL(const std::source_location a_loc, const std::wstring_view a_fmt)
120120
{
121121
const auto body = [&]() {
122122
constexpr std::array directories{

xmake.lua

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,4 +105,27 @@ target("commonlib-shared", function()
105105
"cl::/we4715", -- not all control paths return a value
106106
{ public = true }
107107
)
108+
109+
-- add flags (clang-cl)
110+
add_cxxflags(
111+
"clang_cl::-fms-compatibility",
112+
"clang_cl::-fms-extensions",
113+
{ public = true }
114+
)
115+
116+
-- add flags (clang-cl: disable warnings)
117+
add_cxxflags(
118+
"clang_cl::-Wno-delete-non-abstract-non-virtual-dtor",
119+
"clang_cl::-Wno-deprecated-volatile",
120+
"clang_cl::-Wno-ignored-qualifiers",
121+
"clang_cl::-Wno-inconsistent-missing-override",
122+
"clang_cl::-Wno-invalid-offsetof",
123+
"clang_cl::-Wno-microsoft-include",
124+
"clang_cl::-Wno-overloaded-virtual",
125+
"clang_cl::-Wno-pragma-system-header-outside-header",
126+
"clang_cl::-Wno-reinterpret-base-class",
127+
"clang_cl::-Wno-switch",
128+
"clang_cl::-Wno-unused-private-field",
129+
{ public = true }
130+
)
108131
end)

0 commit comments

Comments
 (0)