From a5fe740e302523f765aaf7359986eb183eaef45d Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Thu, 9 Jul 2020 13:29:58 +1000 Subject: [PATCH] Fix a bunch of compiler warnings --- src/common/vulkan/context.cpp | 2 -- src/common/vulkan/swap_chain.cpp | 2 +- src/core/gpu_hw_opengl.cpp | 2 +- src/core/gte.cpp | 7 ++++--- src/core/namco_guncon.cpp | 2 -- src/core/spu.cpp | 1 - src/core/system.cpp | 4 ++-- src/duckstation-libretro/libretro_opengl_host_display.h | 2 +- src/duckstation-qt/qtprogresscallback.cpp | 2 +- src/frontend-common/common_host_interface.cpp | 2 +- src/frontend-common/common_host_interface.h | 8 ++++---- 11 files changed, 15 insertions(+), 19 deletions(-) diff --git a/src/common/vulkan/context.cpp b/src/common/vulkan/context.cpp index a9b932edb..7077ccc7d 100644 --- a/src/common/vulkan/context.cpp +++ b/src/common/vulkan/context.cpp @@ -684,8 +684,6 @@ bool Context::CreateCommandBuffers() void Context::DestroyCommandBuffers() { - VkDevice device = m_device; - for (FrameResources& resources : m_frame_resources) { for (auto& it : resources.cleanup_resources) diff --git a/src/common/vulkan/swap_chain.cpp b/src/common/vulkan/swap_chain.cpp index 9b5db6ffc..9a1cd78d5 100644 --- a/src/common/vulkan/swap_chain.cpp +++ b/src/common/vulkan/swap_chain.cpp @@ -75,7 +75,7 @@ static void DestroyMetalLayer(WindowInfo& wi) namespace Vulkan { SwapChain::SwapChain(const WindowInfo& wi, VkSurfaceKHR surface, bool vsync) - : m_wi(wi), m_surface(surface), m_vsync_enabled(vsync) + : m_wi(wi), m_vsync_enabled(vsync), m_surface(surface) { } diff --git a/src/core/gpu_hw_opengl.cpp b/src/core/gpu_hw_opengl.cpp index 44a1491db..c7ad60e2b 100644 --- a/src/core/gpu_hw_opengl.cpp +++ b/src/core/gpu_hw_opengl.cpp @@ -839,7 +839,7 @@ void GPU_HW_OpenGL::UpdateVRAM(u32 x, u32 y, u32 width, u32 height, const void* // update texture data glTexSubImage2D(GL_TEXTURE_2D, 0, x, flipped_y, width, height, GL_RGBA, GL_UNSIGNED_BYTE, - reinterpret_cast(map_result.buffer_offset)); + reinterpret_cast(static_cast(map_result.buffer_offset))); m_texture_stream_buffer->Unbind(); if (m_resolution_scale > 1) diff --git a/src/core/gte.cpp b/src/core/gte.cpp index e9bb0e948..10c68dbf6 100644 --- a/src/core/gte.cpp +++ b/src/core/gte.cpp @@ -411,9 +411,10 @@ void Core::MulMatVecBuggy(const s16 M[3][3], const s32 T[3], const s16 Vx, const #define dot3(i) \ do \ { \ - TruncateAndSetIR( \ - SignExtendMACResult(SignExtendMACResult((s64(T[i]) << 12) + (s64(M[i][0]) * s64(Vx)))) >> shift, \ - false); \ + TruncateAndSetIR(static_cast(SignExtendMACResult(SignExtendMACResult( \ + (s64(T[i]) << 12) + (s64(M[i][0]) * s64(Vx)))) >> \ + shift), \ + false); \ TruncateAndSetMACAndIR(SignExtendMACResult((s64(M[i][1]) * s64(Vy))) + (s64(M[i][2]) * s64(Vz)), \ shift, lm); \ } while (0) diff --git a/src/core/namco_guncon.cpp b/src/core/namco_guncon.cpp index e98268caa..bd90dc434 100644 --- a/src/core/namco_guncon.cpp +++ b/src/core/namco_guncon.cpp @@ -1,6 +1,5 @@ #include "namco_guncon.h" #include "common/assert.h" -#include "common/log.h" #include "common/state_wrapper.h" #include "gpu.h" #include "host_display.h" @@ -8,7 +7,6 @@ #include "resources.h" #include "system.h" #include -Log_SetChannel(NamcoGunCon); NamcoGunCon::NamcoGunCon(System* system) : m_system(system) {} diff --git a/src/core/spu.cpp b/src/core/spu.cpp index 369b364f2..c293daacf 100644 --- a/src/core/spu.cpp +++ b/src/core/spu.cpp @@ -1477,7 +1477,6 @@ std::tuple SPU::SampleVoice(u32 voice_index) if (IsPitchModulationEnabled(voice_index)) { const s32 factor = std::clamp(m_voices[voice_index - 1].last_volume, -0x8000, 0x7FFF) + 0x8000; - const u16 old_step = step; step = Truncate16(static_cast((SignExtend32(step) * factor) >> 15)); } step = std::min(step, 0x3FFF); diff --git a/src/core/system.cpp b/src/core/system.cpp index 27878c4d6..6f4012353 100644 --- a/src/core/system.cpp +++ b/src/core/system.cpp @@ -867,9 +867,9 @@ void System::UpdateMemoryCards() { m_pad->SetMemoryCard(i, nullptr); - const MemoryCardType type = settings.memory_card_types[i]; std::unique_ptr card; - switch (settings.memory_card_types[i]) + const MemoryCardType type = settings.memory_card_types[i]; + switch (type) { case MemoryCardType::None: continue; diff --git a/src/duckstation-libretro/libretro_opengl_host_display.h b/src/duckstation-libretro/libretro_opengl_host_display.h index b6aa77440..173d4c522 100644 --- a/src/duckstation-libretro/libretro_opengl_host_display.h +++ b/src/duckstation-libretro/libretro_opengl_host_display.h @@ -18,7 +18,7 @@ public: RenderAPI GetRenderAPI() const override; bool CreateRenderDevice(const WindowInfo& wi, std::string_view adapter_name, bool debug_device) override; - void DestroyRenderDevice(); + void DestroyRenderDevice() override; void ResizeRenderWindow(s32 new_window_width, s32 new_window_height) override; diff --git a/src/duckstation-qt/qtprogresscallback.cpp b/src/duckstation-qt/qtprogresscallback.cpp index a184275eb..087ed4e7c 100644 --- a/src/duckstation-qt/qtprogresscallback.cpp +++ b/src/duckstation-qt/qtprogresscallback.cpp @@ -45,7 +45,7 @@ void QtProgressCallback::SetProgressValue(u32 value) { BaseProgressCallback::SetProgressValue(value); - if (m_dialog.value() == m_progress_range) + if (static_cast(m_dialog.value()) == m_progress_range) return; m_dialog.setValue(m_progress_value); diff --git a/src/frontend-common/common_host_interface.cpp b/src/frontend-common/common_host_interface.cpp index f20b5944c..07c74b7f3 100644 --- a/src/frontend-common/common_host_interface.cpp +++ b/src/frontend-common/common_host_interface.cpp @@ -491,7 +491,7 @@ bool CommonHostInterface::ResumeSystemFromState(const char* filename, bool boot_ return false; const bool global = m_system->GetRunningCode().empty(); - if (m_system->GetRunningCode().empty()) + if (global) { ReportFormattedError("Cannot resume system with undetectable game code from '%s'.", filename); if (!boot_on_failure) diff --git a/src/frontend-common/common_host_interface.h b/src/frontend-common/common_host_interface.h index 2c2e1ff58..f5f5a15d4 100644 --- a/src/frontend-common/common_host_interface.h +++ b/src/frontend-common/common_host_interface.h @@ -248,16 +248,16 @@ protected: void CheckSettings(SettingsInterface& si); /// Restores all settings to defaults. - virtual void SetDefaultSettings(SettingsInterface& si); + virtual void SetDefaultSettings(SettingsInterface& si) override; /// Loads settings to m_settings and any frontend-specific parameters. - virtual void LoadSettings(SettingsInterface& si); + virtual void LoadSettings(SettingsInterface& si) override; /// Saves current settings variables to ini. - virtual void SaveSettings(SettingsInterface& si); + virtual void SaveSettings(SettingsInterface& si) override; /// Checks for settings changes, std::move() the old settings away for comparing beforehand. - virtual void CheckForSettingsChanges(const Settings& old_settings); + virtual void CheckForSettingsChanges(const Settings& old_settings) override; /// Increases timer resolution when supported by the host OS. void SetTimerResolutionIncreased(bool enabled);