From b86a0690831cd9de3d52ec9da20e2fd9b708b7f4 Mon Sep 17 00:00:00 2001 From: Thonnat Date: Tue, 6 Jun 2017 10:33:30 +0200 Subject: [PATCH] Patch after reviewing --- src/common/assert.h | 2 +- src/common/logging/backend.cpp | 2 -- src/common/vector_math.h | 4 ++-- src/core/arm/arm_interface.h | 2 +- src/core/arm/dynarmic/arm_dynarmic.cpp | 4 ++-- src/core/arm/dynarmic/arm_dynarmic.h | 2 +- src/core/arm/dyncom/arm_dyncom_interpreter.cpp | 4 ++-- src/core/arm/dyncom/arm_dyncom_trans.h | 4 ++-- src/core/file_sys/archive_backend.cpp | 3 +-- src/core/hle/ipc.h | 4 ++-- src/core/hle/kernel/thread.cpp | 2 +- src/core/hle/kernel/thread.h | 2 +- src/video_core/regs_framebuffer.h | 4 ++-- 13 files changed, 18 insertions(+), 21 deletions(-) diff --git a/src/common/assert.h b/src/common/assert.h index 04e80c87a..2cc8ca921 100644 --- a/src/common/assert.h +++ b/src/common/assert.h @@ -41,7 +41,7 @@ __declspec(noinline, noreturn) } \ while (0) -#define UNREACHABLE() ASSERT_MSG(false, "Unreachable code!") +#define UNREACHABLE() assert_noinline_call([] { LOG_CRITICAL(Debug, "Assertion Failed!""Unreachable code!"); }) #define UNREACHABLE_MSG(...) ASSERT_MSG(false, __VA_ARGS__) #ifdef _DEBUG diff --git a/src/common/logging/backend.cpp b/src/common/logging/backend.cpp index 59f58b40a..28240644b 100644 --- a/src/common/logging/backend.cpp +++ b/src/common/logging/backend.cpp @@ -89,7 +89,6 @@ const char* GetLogClassName(Class log_class) { case Class::Count: default: UNREACHABLE(); - return {}; } } @@ -107,7 +106,6 @@ const char* GetLevelName(Level log_level) { case Level::Count: default: UNREACHABLE(); - return {}; } #undef LVL } diff --git a/src/common/vector_math.h b/src/common/vector_math.h index 95e98b0a3..b3e98a7c8 100644 --- a/src/common/vector_math.h +++ b/src/common/vector_math.h @@ -248,7 +248,7 @@ public: z -= other.z; } template ::value>::type> - Vec3 operator-() const { + Vec3 operator-() const { return MakeVec(-x, -y, -z); } Vec3 operator*(const Vec3& other) const { @@ -463,7 +463,7 @@ public: w -= other.w; } template ::value>::type> - Vec4 operator-() const { + Vec4 operator-() const { return MakeVec(-x, -y, -z, -w); } Vec4 operator*(const Vec4& other) const { diff --git a/src/core/arm/arm_interface.h b/src/core/arm/arm_interface.h index 258a11dd0..ccd43f431 100644 --- a/src/core/arm/arm_interface.h +++ b/src/core/arm/arm_interface.h @@ -125,7 +125,7 @@ public: * Advance the CPU core by the specified number of ticks (e.g. to simulate CPU execution time) * @param ticks Number of ticks to advance the CPU core */ - virtual void AddTicks(size_t ticks) = 0; + virtual void AddTicks(u64 ticks) = 0; /** * Saves the current CPU context diff --git a/src/core/arm/dynarmic/arm_dynarmic.cpp b/src/core/arm/dynarmic/arm_dynarmic.cpp index 709070008..e12c5b965 100644 --- a/src/core/arm/dynarmic/arm_dynarmic.cpp +++ b/src/core/arm/dynarmic/arm_dynarmic.cpp @@ -124,7 +124,7 @@ void ARM_Dynarmic::SetCP15Register(CP15Register reg, u32 value) { interpreter_state->CP15[reg] = value; } -void ARM_Dynarmic::AddTicks(size_t ticks) { +void ARM_Dynarmic::AddTicks(u64 ticks) { down_count -= ticks; if (down_count < 0) { CoreTiming::Advance(); @@ -136,7 +136,7 @@ MICROPROFILE_DEFINE(ARM_Jit, "ARM JIT", "ARM JIT", MP_RGB(255, 64, 64)); void ARM_Dynarmic::ExecuteInstructions(int num_instructions) { MICROPROFILE_SCOPE(ARM_Jit); - size_t ticks_executed = jit->Run(static_cast(num_instructions)); + u64 ticks_executed = jit->Run(static_cast(num_instructions)); AddTicks(ticks_executed); } diff --git a/src/core/arm/dynarmic/arm_dynarmic.h b/src/core/arm/dynarmic/arm_dynarmic.h index 367069ebf..834dc989e 100644 --- a/src/core/arm/dynarmic/arm_dynarmic.h +++ b/src/core/arm/dynarmic/arm_dynarmic.h @@ -27,7 +27,7 @@ public: u32 GetCP15Register(CP15Register reg) override; void SetCP15Register(CP15Register reg, u32 value) override; - void AddTicks(size_t ticks) override; + void AddTicks(u64 ticks) override; void SaveContext(ThreadContext& ctx) override; void LoadContext(const ThreadContext& ctx) override; diff --git a/src/core/arm/dyncom/arm_dyncom_interpreter.cpp b/src/core/arm/dyncom/arm_dyncom_interpreter.cpp index e9d468fc8..32359b249 100644 --- a/src/core/arm/dyncom/arm_dyncom_interpreter.cpp +++ b/src/core/arm/dyncom/arm_dyncom_interpreter.cpp @@ -759,7 +759,7 @@ static ThumbDecodeStatus DecodeThumbInstruction(u32 inst, u32 addr, u32* arm_ins ThumbDecodeStatus ret = TranslateThumbInstruction(addr, inst, arm_inst, inst_size); if (ret == ThumbDecodeStatus::BRANCH) { int inst_index; - int table_length = static_cast(arm_instruction_trans_len); + size_t table_length = arm_instruction_trans_len; u32 tinstr = GetThumbInstruction(inst, addr); switch ((tinstr & 0xF800) >> 11) { @@ -848,7 +848,7 @@ static int InterpreterTranslateBlock(ARMul_State* cpu, int& bb_start, u32 addr) ARM_INST_PTR inst_base = nullptr; TransExtData ret = TransExtData::NON_BRANCH; int size = 0; // instruction size of basic block - bb_start = static_cast(trans_cache_buf_top); + bb_start = trans_cache_buf_top; u32 phys_addr = addr; u32 pc_start = cpu->Reg[15]; diff --git a/src/core/arm/dyncom/arm_dyncom_trans.h b/src/core/arm/dyncom/arm_dyncom_trans.h index 597e293ca..fb6fceaeb 100644 --- a/src/core/arm/dyncom/arm_dyncom_trans.h +++ b/src/core/arm/dyncom/arm_dyncom_trans.h @@ -18,7 +18,7 @@ enum class TransExtData { SINGLE_STEP = (1 << 8) }; -#ifdef _WIN32 +#ifdef _MSC_VER #pragma warning( push ) #pragma warning( disable : 4200) #endif // WIN @@ -28,7 +28,7 @@ struct arm_inst { TransExtData br; char component[0]; }; -#ifdef _WIN32 +#ifdef _MSC_VER #pragma warning( pop ) #endif // WIN diff --git a/src/core/file_sys/archive_backend.cpp b/src/core/file_sys/archive_backend.cpp index 5212da984..e4634ce3b 100644 --- a/src/core/file_sys/archive_backend.cpp +++ b/src/core/file_sys/archive_backend.cpp @@ -90,8 +90,7 @@ std::u16string Path::AsU16Str() const { LOG_ERROR(Service_FS, "LowPathType cannot be converted to u16string!"); return {}; default: - LOG_ERROR(Service_FS, "Bad conversion type for LowPathType!"); - return {}; + UNREACHABLE(); } } diff --git a/src/core/hle/ipc.h b/src/core/hle/ipc.h index 191c6a847..303ca090d 100644 --- a/src/core/hle/ipc.h +++ b/src/core/hle/ipc.h @@ -83,8 +83,8 @@ union Header { * @note While @p normal_params_size is equivalent to the number of normal parameters, * @p translate_params_size includes the size occupied by the translate parameters headers. */ -inline u32 MakeHeader(u16 command_id, u32 normal_params_size, - u32 translate_params_size) { +inline u32 MakeHeader(u16 command_id, unsigned int normal_params_size, + unsigned int translate_params_size) { Header header{}; header.command_id.Assign(command_id); header.normal_params_size.Assign(normal_params_size); diff --git a/src/core/hle/kernel/thread.cpp b/src/core/hle/kernel/thread.cpp index 66f30bd88..3a674f095 100644 --- a/src/core/hle/kernel/thread.cpp +++ b/src/core/hle/kernel/thread.cpp @@ -522,7 +522,7 @@ void Thread::SetWaitSynchronizationOutput(s32 output) { context.cpu_registers[1] = output; } -s64 Thread::GetWaitObjectIndex(WaitObject* object) const { +size_t Thread::GetWaitObjectIndex(WaitObject* object) const { ASSERT_MSG(!wait_objects.empty(), "Thread is not waiting for anything"); auto match = std::find(wait_objects.rbegin(), wait_objects.rend(), object); return std::distance(match, wait_objects.rend()) - 1; diff --git a/src/core/hle/kernel/thread.h b/src/core/hle/kernel/thread.h index 5da803fbd..1a726b0bb 100644 --- a/src/core/hle/kernel/thread.h +++ b/src/core/hle/kernel/thread.h @@ -142,7 +142,7 @@ public: * object in the list. * @param object Object to query the index of. */ - s64 GetWaitObjectIndex(WaitObject* object) const; + size_t GetWaitObjectIndex(WaitObject* object) const; /** * Stops a thread, invalidating it from further use diff --git a/src/video_core/regs_framebuffer.h b/src/video_core/regs_framebuffer.h index a43b2b046..69381f5a7 100644 --- a/src/video_core/regs_framebuffer.h +++ b/src/video_core/regs_framebuffer.h @@ -259,7 +259,7 @@ struct FramebufferRegs { default: LOG_CRITICAL(HW_GPU, "Unknown depth format %u", format); UNIMPLEMENTED(); - return -1; + return 0; } } @@ -274,7 +274,7 @@ struct FramebufferRegs { default: LOG_CRITICAL(HW_GPU, "Unknown depth format %u", format); UNIMPLEMENTED(); - return -1; + return 0; } }