From d39c9f5d1cec7169edcc1febab0126b9ff9879c8 Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Sun, 11 Oct 2020 12:14:29 +1000 Subject: [PATCH] Clean up some compiler warnings --- android/app/src/cpp/android_host_interface.cpp | 6 +++--- src/common/cd_image_chd.cpp | 2 +- src/common/gl/texture.cpp | 1 - src/common/vulkan/util.cpp | 1 - src/core/cpu_recompiler_code_generator.cpp | 2 -- src/core/gpu_hw_shadergen.cpp | 2 -- src/core/host_interface.h | 3 +++ src/core/mdec.cpp | 4 ---- src/core/memory_card.cpp | 2 ++ src/core/pgxp.cpp | 1 - src/duckstation-libretro/libretro_host_interface.h | 2 +- src/frontend-common/common_host_interface.h | 4 +--- src/frontend-common/vulkan_host_display.cpp | 8 +++----- 13 files changed, 14 insertions(+), 24 deletions(-) diff --git a/android/app/src/cpp/android_host_interface.cpp b/android/app/src/cpp/android_host_interface.cpp index 106cc9cb6..a3ef5f223 100644 --- a/android/app/src/cpp/android_host_interface.cpp +++ b/android/app/src/cpp/android_host_interface.cpp @@ -470,7 +470,7 @@ void AndroidHostInterface::SetControllerType(u32 index, std::string_view type_na } RunOnEmulationThread( - [this, index, type]() { + [index, type]() { Log_InfoPrintf("Changing controller slot %d to %s", index, Settings::GetControllerTypeName(type)); g_settings.controller_types[index] = type; System::UpdateControllers(); @@ -484,7 +484,7 @@ void AndroidHostInterface::SetControllerButtonState(u32 index, s32 button_code, return; RunOnEmulationThread( - [this, index, button_code, pressed]() { + [index, button_code, pressed]() { Controller* controller = System::GetController(index); if (!controller) return; @@ -500,7 +500,7 @@ void AndroidHostInterface::SetControllerAxisState(u32 index, s32 button_code, fl return; RunOnEmulationThread( - [this, index, button_code, value]() { + [index, button_code, value]() { Controller* controller = System::GetController(index); if (!controller) return; diff --git a/src/common/cd_image_chd.cpp b/src/common/cd_image_chd.cpp index 704bd6c16..d7711f33e 100644 --- a/src/common/cd_image_chd.cpp +++ b/src/common/cd_image_chd.cpp @@ -126,7 +126,7 @@ bool CDImageCHD::Open(const char* filename) char pgsub_str[256]; u32 metadata_length; - int track_num = 0, frames = 0, pad = 0, pregap_frames = 0, postgap_frames = 0; + int track_num = 0, frames = 0, pregap_frames = 0, postgap_frames = 0; err = chd_get_metadata(m_chd, CDROM_TRACK_METADATA2_TAG, num_tracks, metadata_str, sizeof(metadata_str), &metadata_length, nullptr, nullptr); if (err == CHDERR_NONE) diff --git a/src/common/gl/texture.cpp b/src/common/gl/texture.cpp index 1f9aa4da5..819223c0a 100644 --- a/src/common/gl/texture.cpp +++ b/src/common/gl/texture.cpp @@ -158,7 +158,6 @@ void Texture::GetTextureSubImage(GLuint texture, GLint level, GLint xoffset, GLi else glFramebufferTexture2D(GL_READ_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture, level); - GLuint status = glCheckFramebufferStatus(GL_READ_FRAMEBUFFER); DebugAssert(glCheckFramebufferStatus(GL_READ_FRAMEBUFFER) == GL_FRAMEBUFFER_COMPLETE); glReadPixels(xoffset, yoffset, width, height, format, type, pixels); diff --git a/src/common/vulkan/util.cpp b/src/common/vulkan/util.cpp index b27af1d59..222e9ef4f 100644 --- a/src/common/vulkan/util.cpp +++ b/src/common/vulkan/util.cpp @@ -9,7 +9,6 @@ #include "../string_util.h" #include "context.h" #include "shader_compiler.h" -Log_SetChannel(Vulkan::Util); namespace Vulkan { namespace Util { diff --git a/src/core/cpu_recompiler_code_generator.cpp b/src/core/cpu_recompiler_code_generator.cpp index 778f638a2..7f7a81bba 100644 --- a/src/core/cpu_recompiler_code_generator.cpp +++ b/src/core/cpu_recompiler_code_generator.cpp @@ -1429,8 +1429,6 @@ bool CodeGenerator::Compile_Divide(const CodeBlockInstruction& cbi) { InstructionPrologue(cbi, 1); - const bool signed_divide = (cbi.instruction.r.funct == InstructionFunct::div); - Value num = m_register_cache.ReadGuestRegister(cbi.instruction.r.rs); Value denom = m_register_cache.ReadGuestRegister(cbi.instruction.r.rt); if (num.IsConstant() && denom.IsConstant()) diff --git a/src/core/gpu_hw_shadergen.cpp b/src/core/gpu_hw_shadergen.cpp index 20d50cb4f..b7b2041fb 100644 --- a/src/core/gpu_hw_shadergen.cpp +++ b/src/core/gpu_hw_shadergen.cpp @@ -1,9 +1,7 @@ #include "gpu_hw_shadergen.h" #include "common/assert.h" -#include "common/log.h" #include #include -Log_SetChannel(GPU_HW_ShaderGen); GPU_HW_ShaderGen::GPU_HW_ShaderGen(HostDisplay::RenderAPI render_api, u32 resolution_scale, bool true_color, bool scaled_dithering, GPUTextureFilter texture_filtering, bool uv_limits, bool supports_dual_source_blend) : ShaderGen(render_api, supports_dual_source_blend), diff --git a/src/core/host_interface.h b/src/core/host_interface.h index 9844cf532..9f2d39f01 100644 --- a/src/core/host_interface.h +++ b/src/core/host_interface.h @@ -149,6 +149,9 @@ protected: /// Restores all settings to defaults. virtual void SetDefaultSettings(SettingsInterface& si); + /// Performs the initial load of settings. Should call CheckSettings() and LoadSettings(SettingsInterface&). + virtual void LoadSettings() = 0; + /// Loads settings to m_settings and any frontend-specific parameters. virtual void LoadSettings(SettingsInterface& si); diff --git a/src/core/mdec.cpp b/src/core/mdec.cpp index cb1d752eb..8d06db332 100644 --- a/src/core/mdec.cpp +++ b/src/core/mdec.cpp @@ -524,10 +524,6 @@ void MDEC::CopyOutBlock() Execute(); } -static constexpr std::array zigzag = {{0, 1, 5, 6, 14, 15, 27, 28, 2, 4, 7, 13, 16, 26, 29, 42, - 3, 8, 12, 17, 25, 30, 41, 43, 9, 11, 18, 24, 31, 40, 44, 53, - 10, 19, 23, 32, 39, 45, 52, 54, 20, 22, 33, 38, 46, 51, 55, 60, - 21, 34, 37, 47, 50, 56, 59, 61, 35, 36, 48, 49, 57, 58, 62, 63}}; static constexpr std::array zagzig = {{0, 1, 8, 16, 9, 2, 3, 10, 17, 24, 32, 25, 18, 11, 4, 5, 12, 19, 26, 33, 40, 48, 41, 34, 27, 20, 13, 6, 7, 14, 21, 28, 35, 42, 49, 56, 57, 50, 43, 36, 29, 22, 15, 23, 30, 37, 44, 51, diff --git a/src/core/memory_card.cpp b/src/core/memory_card.cpp index 3a506ca38..961c13c70 100644 --- a/src/core/memory_card.cpp +++ b/src/core/memory_card.cpp @@ -63,7 +63,9 @@ void MemoryCard::ResetTransferState() bool MemoryCard::Transfer(const u8 data_in, u8* data_out) { bool ack = false; +#ifdef _DEBUG const State old_state = m_state; +#endif switch (m_state) { diff --git a/src/core/pgxp.cpp b/src/core/pgxp.cpp index e332bb428..096ddcc98 100644 --- a/src/core/pgxp.cpp +++ b/src/core/pgxp.cpp @@ -104,7 +104,6 @@ static void MaskValidate(PGXP_value* pV, u32 psxV, u32 mask, u32 validMask); static double f16Sign(double in); static double f16Unsign(double in); -static double fu16Trunc(double in); static double f16Overflow(double in); typedef union diff --git a/src/duckstation-libretro/libretro_host_interface.h b/src/duckstation-libretro/libretro_host_interface.h index 133598e3a..18bf0a612 100644 --- a/src/duckstation-libretro/libretro_host_interface.h +++ b/src/duckstation-libretro/libretro_host_interface.h @@ -57,7 +57,7 @@ private: void InitDiskControlInterface(); void InitRumbleInterface(); - void LoadSettings(); + void LoadSettings() override; void UpdateSettings(); void UpdateControllers(); void UpdateControllersDigitalController(u32 index); diff --git a/src/frontend-common/common_host_interface.h b/src/frontend-common/common_host_interface.h index 5fb7c61f7..9d638466d 100644 --- a/src/frontend-common/common_host_interface.h +++ b/src/frontend-common/common_host_interface.h @@ -261,9 +261,6 @@ protected: /// Sets the base path for the user directory. Can be overridden by platform/frontend/command line. virtual void SetUserDirectory(); - /// Performs the initial load of settings. Should call CheckSettings() and LoadSettings(SettingsInterface&). - virtual void LoadSettings() = 0; - /// Updates logging settings. virtual void UpdateLogSettings(LOGLEVEL level, const char* filter, bool log_to_console, bool log_to_debug, bool log_to_window, bool log_to_file); @@ -284,6 +281,7 @@ protected: virtual void SetDefaultSettings(SettingsInterface& si) override; /// Loads settings to m_settings and any frontend-specific parameters. + using HostInterface::LoadSettings; virtual void LoadSettings(SettingsInterface& si) override; /// Saves current settings variables to ini. diff --git a/src/frontend-common/vulkan_host_display.cpp b/src/frontend-common/vulkan_host_display.cpp index bbf82a376..23f402b11 100644 --- a/src/frontend-common/vulkan_host_display.cpp +++ b/src/frontend-common/vulkan_host_display.cpp @@ -576,7 +576,7 @@ bool VulkanHostDisplay::Render() void VulkanHostDisplay::BeginSwapChainRenderPass(VkFramebuffer framebuffer) { - const VkClearValue clear_value = {}; + const VkClearValue clear_value = {{{0.0f, 0.0f, 0.0f, 1.0f}}}; const VkRenderPassBeginInfo rp = {VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO, nullptr, m_swap_chain->GetClearRenderPass(), @@ -714,8 +714,8 @@ std::vector VulkanHostDisplay::EnumerateAdapterNames() #ifndef LIBRETRO VulkanHostDisplay::PostProcessingStage::PostProcessingStage(PostProcessingStage&& move) - : output_texture(std::move(move.output_texture)), output_framebuffer(move.output_framebuffer), - pipeline(move.pipeline), uniforms_size(move.uniforms_size) + : pipeline(move.pipeline), output_framebuffer(move.output_framebuffer), + output_texture(std::move(move.output_texture)), uniforms_size(move.uniforms_size) { move.output_framebuffer = VK_NULL_HANDLE; move.pipeline = VK_NULL_HANDLE; @@ -870,8 +870,6 @@ void VulkanHostDisplay::ApplyPostProcessingChain(s32 final_left, s32 final_top, s32 texture_view_x, s32 texture_view_y, s32 texture_view_width, s32 texture_view_height) { - static constexpr std::array clear_color = {0.0f, 0.0f, 0.0f, 1.0f}; - if (!CheckPostProcessingRenderTargets(m_swap_chain->GetWidth(), m_swap_chain->GetHeight())) { BeginSwapChainRenderPass(m_swap_chain->GetCurrentFramebuffer());