diff --git a/tests/A32/fuzz_arm.cpp b/tests/A32/fuzz_arm.cpp index 41643682..7f9bcfa8 100644 --- a/tests/A32/fuzz_arm.cpp +++ b/tests/A32/fuzz_arm.cpp @@ -126,7 +126,7 @@ u32 GenRandomInst(u32 pc, bool is_last_inst) { while (true) { const size_t index = RandInt(0, instructions.generators.size() - 1); const u32 inst = instructions.generators[index].Generate(); - + if (std::any_of(instructions.invalid.begin(), instructions.invalid.end(), [inst](const auto& invalid) { return invalid.Match(inst); })) { continue; } @@ -150,7 +150,7 @@ static void RunTestInstance(Dynarmic::A32::Jit& jit, A32Unicorn& uni const std::vector& instructions, const u32 cpsr, const u32 fpscr) { const u32 initial_pc = regs[15]; const u32 num_words = initial_pc / sizeof(u32); - const u32 code_mem_size = num_words + instructions.size(); + const u32 code_mem_size = num_words + static_cast(instructions.size()); jit_env.code_mem.resize(code_mem_size + 1); uni_env.code_mem.resize(code_mem_size + 1); diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 21f86e31..a4d7c044 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -26,7 +26,6 @@ if (DYNARMIC_TESTS_USE_UNICORN) unicorn_emu/a32_unicorn.h unicorn_emu/a64_unicorn.cpp unicorn_emu/a64_unicorn.h - unicorn_emu/unicorn_load.cpp ) target_link_libraries(dynarmic_tests PRIVATE Unicorn::Unicorn) endif() diff --git a/tests/unicorn_emu/a32_unicorn.cpp b/tests/unicorn_emu/a32_unicorn.cpp index 29d0ecc6..25c04b97 100644 --- a/tests/unicorn_emu/a32_unicorn.cpp +++ b/tests/unicorn_emu/a32_unicorn.cpp @@ -87,14 +87,14 @@ constexpr std::array gpr_ids{ template Unicorn::A32::RegisterArray A32Unicorn::GetRegisters() const { - Unicorn::A32::RegisterArray regs; + Unicorn::A32::RegisterArray regs{}; Unicorn::A32::RegisterPtrArray ptrs; for (size_t i = 0; i < ptrs.size(); ++i) { ptrs[i] = ®s[i]; } CHECKED(uc_reg_read_batch(uc, const_cast(gpr_ids.data()), - reinterpret_cast(ptrs.data()), Unicorn::A32::num_gprs)); + reinterpret_cast(ptrs.data()), static_cast(Unicorn::A32::num_gprs))); return regs; } @@ -106,7 +106,7 @@ void A32Unicorn::SetRegisters(const RegisterArray& value) { } CHECKED(uc_reg_write_batch(uc, const_cast(gpr_ids.data()), - reinterpret_cast(const_cast(ptrs.data())), ptrs.size())); + reinterpret_cast(const_cast(ptrs.data())), static_cast(ptrs.size()))); } using DoubleExtRegPtrArray = std::array; @@ -121,13 +121,13 @@ constexpr std::array double_ext_reg_ids{ template Unicorn::A32::ExtRegArray A32Unicorn::GetExtRegs() const { - Unicorn::A32::ExtRegArray ext_regs; + Unicorn::A32::ExtRegArray ext_regs{}; DoubleExtRegPtrArray ptrs; for (size_t i = 0; i < ptrs.size(); ++i) ptrs[i] = &ext_regs[i*2]; CHECKED(uc_reg_read_batch(uc, const_cast(double_ext_reg_ids.data()), - reinterpret_cast(ptrs.data()), ptrs.size())); + reinterpret_cast(ptrs.data()), static_cast(ptrs.size()))); return ext_regs; } @@ -140,7 +140,7 @@ void A32Unicorn::SetExtRegs(const ExtRegArray& value) { } CHECKED(uc_reg_write_batch(uc, const_cast(double_ext_reg_ids.data()), - reinterpret_cast(const_cast(ptrs.data())), ptrs.size())); + reinterpret_cast(const_cast(ptrs.data())), static_cast(ptrs.size()))); } template diff --git a/tests/unicorn_emu/a32_unicorn.h b/tests/unicorn_emu/a32_unicorn.h index bbac40f1..5f56aa0e 100644 --- a/tests/unicorn_emu/a32_unicorn.h +++ b/tests/unicorn_emu/a32_unicorn.h @@ -9,7 +9,13 @@ #include #include +#ifdef _MSC_VER +#pragma warning(push, 0) #include +#pragma warning(pop) +#else +#include +#endif #include "common/common_types.h" diff --git a/tests/unicorn_emu/a64_unicorn.cpp b/tests/unicorn_emu/a64_unicorn.cpp index 1255bc07..f7103005 100644 --- a/tests/unicorn_emu/a64_unicorn.cpp +++ b/tests/unicorn_emu/a64_unicorn.cpp @@ -71,13 +71,13 @@ constexpr std::array gpr_ids{ }; A64Unicorn::RegisterArray A64Unicorn::GetRegisters() const { - RegisterArray regs; + RegisterArray regs{}; RegisterPtrArray ptrs; for (size_t i = 0; i < ptrs.size(); ++i) ptrs[i] = ®s[i]; CHECKED(uc_reg_read_batch(uc, const_cast(gpr_ids.data()), - reinterpret_cast(ptrs.data()), num_gprs)); + reinterpret_cast(ptrs.data()), static_cast(num_gprs))); return regs; } @@ -87,7 +87,7 @@ void A64Unicorn::SetRegisters(const RegisterArray& value) { ptrs[i] = &value[i]; CHECKED(uc_reg_write_batch(uc, const_cast(gpr_ids.data()), - reinterpret_cast(const_cast(ptrs.data())), num_gprs)); + reinterpret_cast(const_cast(ptrs.data())), static_cast(num_gprs))); } constexpr std::array vec_ids{ @@ -98,13 +98,13 @@ constexpr std::array vec_ids{ }; A64Unicorn::VectorArray A64Unicorn::GetVectors() const { - VectorArray vecs; + VectorArray vecs{}; VectorPtrArray ptrs; for (size_t i = 0; i < ptrs.size(); ++i) ptrs[i] = &vecs[i]; CHECKED(uc_reg_read_batch(uc, const_cast(vec_ids.data()), - reinterpret_cast(ptrs.data()), num_vecs)); + reinterpret_cast(ptrs.data()), static_cast(num_vecs))); return vecs; } @@ -115,7 +115,7 @@ void A64Unicorn::SetVectors(const VectorArray& value) { ptrs[i] = &value[i]; CHECKED(uc_reg_write_batch(uc, const_cast(vec_ids.data()), - reinterpret_cast(const_cast(ptrs.data())), num_vecs)); + reinterpret_cast(const_cast(ptrs.data())), static_cast(num_vecs))); } u32 A64Unicorn::GetFpcr() const { diff --git a/tests/unicorn_emu/a64_unicorn.h b/tests/unicorn_emu/a64_unicorn.h index 5bf7bee8..95a1aa12 100644 --- a/tests/unicorn_emu/a64_unicorn.h +++ b/tests/unicorn_emu/a64_unicorn.h @@ -9,7 +9,13 @@ #include #include +#ifdef _MSC_VER +#pragma warning(push, 0) #include +#pragma warning(pop) +#else +#include +#endif #include "common/common_types.h" #include "A64/testenv.h" diff --git a/tests/unicorn_emu/unicorn_load.cpp b/tests/unicorn_emu/unicorn_load.cpp deleted file mode 100644 index 3a28dac5..00000000 --- a/tests/unicorn_emu/unicorn_load.cpp +++ /dev/null @@ -1,24 +0,0 @@ -/* This file is part of the dynarmic project. - * Copyright (c) 2018 MerryMage - * This software may be used and distributed according to the terms of the GNU - * General Public License version 2 or any later version. - */ - -// Load Unicorn DLL once on Windows using RAII -#ifdef _WIN32 -#include -#include - -#include "common/assert.h" - -static struct LoadDll { -public: - LoadDll() { - ASSERT(uc_dyn_load(NULL, 0)); - } - ~LoadDll() { - ASSERT(uc_dyn_free()); - } - static LoadDll g_load_dll; -} load_dll; -#endif