mirror of
https://github.com/thunderbrewhq/squall.git
synced 2026-02-04 08:59:07 +00:00
chore(build): resolve MSVC warnings
This commit is contained in:
parent
df14314ea1
commit
92b0c4778f
6 changed files with 19 additions and 10 deletions
|
|
@ -43,6 +43,8 @@ add_library(storm STATIC
|
||||||
${STORM_SOURCES}
|
${STORM_SOURCES}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
target_compile_definitions(storm PRIVATE _CRT_SECURE_NO_WARNINGS)
|
||||||
|
|
||||||
target_include_directories(storm
|
target_include_directories(storm
|
||||||
PUBLIC
|
PUBLIC
|
||||||
${PROJECT_SOURCE_DIR}
|
${PROJECT_SOURCE_DIR}
|
||||||
|
|
|
||||||
|
|
@ -43,12 +43,12 @@ THandle TSExportTableSimpleReuse<T, THandle>::GenerateUniqueHandle() {
|
||||||
this->m_wrapped = 1;
|
this->m_wrapped = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this->m_wrapped || !this->Ptr(reinterpret_cast<THandle>(this->m_sequence))) {
|
if (!this->m_wrapped || !this->Ptr(reinterpret_cast<THandle>(static_cast<uintptr_t>(this->m_sequence)))) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return reinterpret_cast<THandle>(this->m_sequence);
|
return reinterpret_cast<THandle>(static_cast<uintptr_t>(this->m_sequence));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class T, class THandle>
|
template <class T, class THandle>
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,7 @@ T* TSExportTableSyncReuse<T, THandle, TLockedHandle, TSync>::NewLock(THandle* ha
|
||||||
template <class T, class THandle, class TLockedHandle, class TSync>
|
template <class T, class THandle, class TLockedHandle, class TSync>
|
||||||
void TSExportTableSyncReuse<T, THandle, TLockedHandle, TSync>::SyncEnterLock(TLockedHandle* lockedHandlePtr, int32_t forWriting) {
|
void TSExportTableSyncReuse<T, THandle, TLockedHandle, TSync>::SyncEnterLock(TLockedHandle* lockedHandlePtr, int32_t forWriting) {
|
||||||
this->m_sync.Enter(forWriting);
|
this->m_sync.Enter(forWriting);
|
||||||
*lockedHandlePtr = reinterpret_cast<TLockedHandle>(forWriting ? 1 : -1);
|
*lockedHandlePtr = reinterpret_cast<TLockedHandle>(static_cast<intptr_t>(forWriting ? 1 : -1));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class T, class THandle, class TLockedHandle, class TSync>
|
template <class T, class THandle, class TLockedHandle, class TSync>
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,14 @@
|
||||||
#include "storm/Handle.hpp"
|
#include "storm/Handle.hpp"
|
||||||
#include "test/Test.hpp"
|
#include "test/Test.hpp"
|
||||||
|
|
||||||
|
#define UNUSED(x) ((void)x)
|
||||||
|
|
||||||
TEST_CASE("DECLARE_STORM_HANDLE", "[handle]") {
|
TEST_CASE("DECLARE_STORM_HANDLE", "[handle]") {
|
||||||
SECTION("declares handle") {
|
SECTION("declares handle") {
|
||||||
DECLARE_STORM_HANDLE(HTEST);
|
DECLARE_STORM_HANDLE(HTEST);
|
||||||
HTEST test;
|
HTEST test;
|
||||||
|
|
||||||
|
UNUSED(test);
|
||||||
SUCCEED();
|
SUCCEED();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -18,6 +21,8 @@ TEST_CASE("DECLARE_STORM_CHILD_HANDLE", "[handle]") {
|
||||||
HPARENT parent;
|
HPARENT parent;
|
||||||
HCHILD child;
|
HCHILD child;
|
||||||
|
|
||||||
|
UNUSED(parent);
|
||||||
|
UNUSED(child);
|
||||||
SUCCEED();
|
SUCCEED();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
#include "storm/Hash.hpp"
|
#include "storm/Hash.hpp"
|
||||||
#include "storm/Thread.hpp"
|
#include "storm/Thread.hpp"
|
||||||
#include "test/Test.hpp"
|
#include "test/Test.hpp"
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
struct TestHashObject : TSHashObject<TestHashObject, HASHKEY_STRI> {
|
struct TestHashObject : TSHashObject<TestHashObject, HASHKEY_STRI> {
|
||||||
uint32_t index = 255;
|
uint32_t index = 255;
|
||||||
|
|
@ -11,15 +12,16 @@ struct TestExportObject : TSHashObject<TestHashObject, HASHKEY_NONE> {
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef void* TestExportObjectHandle;
|
typedef void* TestExportObjectHandle;
|
||||||
|
|
||||||
typedef void* TestExportLockedHandle;
|
typedef void* TestExportLockedHandle;
|
||||||
|
|
||||||
|
#define MAKEINTPTR(x) reinterpret_cast<void*>(static_cast<uintptr_t>(x));
|
||||||
|
|
||||||
TEST_CASE("HASHKEY_PTR", "[hash]") {
|
TEST_CASE("HASHKEY_PTR", "[hash]") {
|
||||||
SECTION("constructs correctly") {
|
SECTION("constructs correctly") {
|
||||||
HASHKEY_PTR key1;
|
HASHKEY_PTR key1;
|
||||||
REQUIRE(key1.GetPtr() == nullptr);
|
REQUIRE(key1.GetPtr() == nullptr);
|
||||||
|
|
||||||
void* ptr = reinterpret_cast<void*>(0xDEAFBEEF);
|
void* ptr = MAKEINTPTR(0xDEAFBEEF);
|
||||||
HASHKEY_PTR key2 = { ptr };
|
HASHKEY_PTR key2 = { ptr };
|
||||||
REQUIRE(key2.GetPtr() == ptr);
|
REQUIRE(key2.GetPtr() == ptr);
|
||||||
}
|
}
|
||||||
|
|
@ -27,9 +29,9 @@ TEST_CASE("HASHKEY_PTR", "[hash]") {
|
||||||
|
|
||||||
TEST_CASE("HASHKEY_PTR::operator=") {
|
TEST_CASE("HASHKEY_PTR::operator=") {
|
||||||
SECTION("assigns from another key") {
|
SECTION("assigns from another key") {
|
||||||
void* ptr1 = reinterpret_cast<void*>(0xDEAFBEEF);
|
void* ptr1 = MAKEINTPTR(0xDEAFBEEF);
|
||||||
HASHKEY_PTR key1 = { ptr1 };
|
HASHKEY_PTR key1 = { ptr1 };
|
||||||
void* ptr2 = reinterpret_cast<void*>(0xFEEDFACE);
|
void* ptr2 = MAKEINTPTR(0xFEEDFACE);
|
||||||
HASHKEY_PTR key2 = { ptr2 };
|
HASHKEY_PTR key2 = { ptr2 };
|
||||||
REQUIRE (!(key1 == key2));
|
REQUIRE (!(key1 == key2));
|
||||||
|
|
||||||
|
|
@ -40,12 +42,12 @@ TEST_CASE("HASHKEY_PTR::operator=") {
|
||||||
|
|
||||||
TEST_CASE("HASHKEY_PTR::operator==") {
|
TEST_CASE("HASHKEY_PTR::operator==") {
|
||||||
SECTION("compares to another key") {
|
SECTION("compares to another key") {
|
||||||
void* ptr1 = reinterpret_cast<void*>(0xDEAFBEEF);
|
void* ptr1 = MAKEINTPTR(0xDEAFBEEF);
|
||||||
HASHKEY_PTR key1 = { ptr1 };
|
HASHKEY_PTR key1 = { ptr1 };
|
||||||
HASHKEY_PTR key2 = { ptr1 };
|
HASHKEY_PTR key2 = { ptr1 };
|
||||||
REQUIRE(key1 == key2);
|
REQUIRE(key1 == key2);
|
||||||
|
|
||||||
void* ptr2 = reinterpret_cast<void*>(0xFEEDFACE);
|
void* ptr2 = MAKEINTPTR(0xFEEDFACE);
|
||||||
HASHKEY_PTR key3 = { ptr2 };
|
HASHKEY_PTR key3 = { ptr2 };
|
||||||
REQUIRE(!(key1 == key3));
|
REQUIRE(!(key1 == key3));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ TEST_CASE("SUniSGetUTF8", "[unicode]") {
|
||||||
int32_t chars = 0;
|
int32_t chars = 0;
|
||||||
auto code = SUniSGetUTF8(reinterpret_cast<const uint8_t*>(string), &chars);
|
auto code = SUniSGetUTF8(reinterpret_cast<const uint8_t*>(string), &chars);
|
||||||
|
|
||||||
REQUIRE(code == -1u);
|
REQUIRE(code == ~0u);
|
||||||
REQUIRE(chars == 0);
|
REQUIRE(chars == 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue