From c18cb1b192d60499af3d68b244e86c8dd8f55200 Mon Sep 17 00:00:00 2001 From: Jonathan Hao <johnathan79717@gmail.com> Date: Thu, 5 Jan 2017 00:48:29 +0800 Subject: [PATCH] Fix some warnings (#2399) --- src/citra_qt/bootmanager.cpp | 2 +- src/citra_qt/debugger/callstack.cpp | 1 - src/citra_qt/debugger/graphics/graphics_cmdlists.cpp | 5 ----- src/citra_qt/debugger/graphics/graphics_vertex_shader.cpp | 4 ---- src/citra_qt/util/spinbox.cpp | 7 ------- src/core/gdbstub/gdbstub.cpp | 5 ----- src/core/hle/service/boss/boss.cpp | 4 +++- src/core/hle/service/cfg/cfg.cpp | 1 - src/core/hle/service/mic_u.cpp | 5 +++-- src/core/hle/service/soc_u.cpp | 4 ---- src/core/loader/ncch.cpp | 2 +- src/core/loader/ncch.h | 2 +- src/video_core/shader/shader_interpreter.cpp | 2 -- 13 files changed, 9 insertions(+), 35 deletions(-) diff --git a/src/citra_qt/bootmanager.cpp b/src/citra_qt/bootmanager.cpp index 57fde6caa..59cb1b1bc 100644 --- a/src/citra_qt/bootmanager.cpp +++ b/src/citra_qt/bootmanager.cpp @@ -99,7 +99,7 @@ private: }; GRenderWindow::GRenderWindow(QWidget* parent, EmuThread* emu_thread) - : QWidget(parent), keyboard_id(0), emu_thread(emu_thread), child(nullptr) { + : QWidget(parent), child(nullptr), keyboard_id(0), emu_thread(emu_thread) { std::string window_title = Common::StringFromFormat("Citra | %s-%s", Common::g_scm_branch, Common::g_scm_desc); diff --git a/src/citra_qt/debugger/callstack.cpp b/src/citra_qt/debugger/callstack.cpp index c1db93583..08d2e7a22 100644 --- a/src/citra_qt/debugger/callstack.cpp +++ b/src/citra_qt/debugger/callstack.cpp @@ -45,7 +45,6 @@ void CallstackWidget::OnDebugModeEntered() { if (ARM_Disasm::Decode(insn) == OP_BL) { std::string name; // ripped from disasm - u8 cond = (insn >> 28) & 0xf; u32 i_offset = insn & 0xffffff; // Sign-extend the 24-bit offset if ((i_offset >> 23) & 1) diff --git a/src/citra_qt/debugger/graphics/graphics_cmdlists.cpp b/src/citra_qt/debugger/graphics/graphics_cmdlists.cpp index dab529e3a..f5a2ec761 100644 --- a/src/citra_qt/debugger/graphics/graphics_cmdlists.cpp +++ b/src/citra_qt/debugger/graphics/graphics_cmdlists.cpp @@ -135,11 +135,6 @@ void GPUCommandListWidget::OnCommandDoubleClicked(const QModelIndex& index) { UNREACHABLE_MSG("Unknown texture command"); } - const auto texture = Pica::g_state.regs.GetTextures()[texture_index]; - const auto config = texture.config; - const auto format = texture.format; - const auto info = Pica::DebugUtils::TextureInfo::FromPicaRegister(config, format); - // TODO: Open a surface debugger } } diff --git a/src/citra_qt/debugger/graphics/graphics_vertex_shader.cpp b/src/citra_qt/debugger/graphics/graphics_vertex_shader.cpp index b75b94ef8..ff2e7e363 100644 --- a/src/citra_qt/debugger/graphics/graphics_vertex_shader.cpp +++ b/src/citra_qt/debugger/graphics/graphics_vertex_shader.cpp @@ -276,9 +276,6 @@ QVariant GraphicsVertexShaderModel::data(const QModelIndex& index, int role) con output << 'b' << instr.flow_control.bool_uniform_id << ' '; } - u32 target_addr = instr.flow_control.dest_offset; - u32 target_addr_else = instr.flow_control.dest_offset; - if (opcode_info.subtype & OpCode::Info::HasAlternative) { output << "else jump to 0x" << std::setw(4) << std::right << std::setfill('0') << std::hex @@ -473,7 +470,6 @@ GraphicsVertexShaderWidget::GraphicsVertexShaderWidget( } void GraphicsVertexShaderWidget::OnBreakPointHit(Pica::DebugContext::Event event, void* data) { - auto input = static_cast<Pica::Shader::InputVertex*>(data); if (event == Pica::DebugContext::Event::VertexShaderInvocation) { Reload(true, data); } else { diff --git a/src/citra_qt/util/spinbox.cpp b/src/citra_qt/util/spinbox.cpp index feb0ea1b3..212709007 100644 --- a/src/citra_qt/util/spinbox.cpp +++ b/src/citra_qt/util/spinbox.cpp @@ -165,13 +165,6 @@ void CSpinBox::UpdateText() { // Uppercase digits greater than 9. mask += ">"; - // The greatest signed 64-bit number has 19 decimal digits. - // TODO: Could probably make this more generic with some logarithms. - // For reference, unsigned 64-bit can have up to 20 decimal digits. - int digits = (num_digits != 0) - ? num_digits - : (base == 16) ? 16 : (base == 10) ? 19 : 0xFF; // fallback case... - // Match num_digits digits // Digits irrelevant to the chosen number base are filtered in the validator mask += QString("H").repeated(std::max(num_digits, 1)); diff --git a/src/core/gdbstub/gdbstub.cpp b/src/core/gdbstub/gdbstub.cpp index d88e25073..5cf45ada5 100644 --- a/src/core/gdbstub/gdbstub.cpp +++ b/src/core/gdbstub/gdbstub.cpp @@ -57,7 +57,6 @@ const u32 SIGTERM = 15; const u32 MSG_WAITALL = 8; #endif -const u32 R0_REGISTER = 0; const u32 R15_REGISTER = 15; const u32 CPSR_REGISTER = 25; const u32 FPSCR_REGISTER = 58; @@ -816,10 +815,6 @@ static void RemoveBreakpoint() { auto addr_pos = std::find(start_offset, command_buffer + command_length, ','); PAddr addr = HexToInt(start_offset, static_cast<u32>(addr_pos - start_offset)); - start_offset = addr_pos + 1; - u32 len = - HexToInt(start_offset, static_cast<u32>((command_buffer + command_length) - start_offset)); - if (type == BreakpointType::Access) { // Access is made up of Read and Write types, so add both breakpoints type = BreakpointType::Read; diff --git a/src/core/hle/service/boss/boss.cpp b/src/core/hle/service/boss/boss.cpp index 6ab16ccd5..e0de037f8 100644 --- a/src/core/hle/service/boss/boss.cpp +++ b/src/core/hle/service/boss/boss.cpp @@ -2,6 +2,7 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include <cinttypes> #include "core/hle/service/boss/boss.h" #include "core/hle/service/boss/boss_p.h" #include "core/hle/service/boss/boss_u.h" @@ -33,7 +34,8 @@ void InitializeSession(Service::Interface* self) { cmd_buff[0] = IPC::MakeHeader(0x1, 0x1, 0); cmd_buff[1] = RESULT_SUCCESS.raw; - LOG_WARNING(Service_BOSS, "(STUBBED) unk_param=0x%016X, translation=0x%08X, unk_param4=0x%08X", + LOG_WARNING(Service_BOSS, + "(STUBBED) unk_param=0x%016" PRIX64 ", translation=0x%08X, unk_param4=0x%08X", unk_param, translation, unk_param4); } diff --git a/src/core/hle/service/cfg/cfg.cpp b/src/core/hle/service/cfg/cfg.cpp index 0bf59eb76..59dd6d1cd 100644 --- a/src/core/hle/service/cfg/cfg.cpp +++ b/src/core/hle/service/cfg/cfg.cpp @@ -84,7 +84,6 @@ struct ConsoleCountryInfo { static_assert(sizeof(ConsoleCountryInfo) == 4, "ConsoleCountryInfo must be exactly 4 bytes"); } -static const u64 CFG_SAVE_ID = 0x00010017; static const u64 CONSOLE_UNIQUE_ID = 0xDEADC0DE; static const ConsoleModelInfo CONSOLE_MODEL = {NINTENDO_3DS_XL, {0, 0, 0}}; static const u8 CONSOLE_LANGUAGE = LANGUAGE_EN; diff --git a/src/core/hle/service/mic_u.cpp b/src/core/hle/service/mic_u.cpp index 4f1dd2fce..c62f8afc6 100644 --- a/src/core/hle/service/mic_u.cpp +++ b/src/core/hle/service/mic_u.cpp @@ -99,7 +99,8 @@ static void StartSampling(Interface* self) { is_sampling = true; LOG_WARNING(Service_MIC, "(STUBBED) called, encoding=%u, sample_rate=%u, " "audio_buffer_offset=%d, audio_buffer_size=%u, audio_buffer_loop=%u", - encoding, sample_rate, audio_buffer_offset, audio_buffer_size, audio_buffer_loop); + static_cast<u32>(encoding), static_cast<u32>(sample_rate), audio_buffer_offset, + audio_buffer_size, audio_buffer_loop); } /** @@ -114,7 +115,7 @@ static void AdjustSampling(Interface* self) { u32* cmd_buff = Kernel::GetCommandBuffer(); sample_rate = static_cast<SampleRate>(cmd_buff[1] & 0xFF); cmd_buff[1] = RESULT_SUCCESS.raw; // No error - LOG_WARNING(Service_MIC, "(STUBBED) called, sample_rate=%u", sample_rate); + LOG_WARNING(Service_MIC, "(STUBBED) called, sample_rate=%u", static_cast<u32>(sample_rate)); } /** diff --git a/src/core/hle/service/soc_u.cpp b/src/core/hle/service/soc_u.cpp index c3918cdd0..dcc5c3c90 100644 --- a/src/core/hle/service/soc_u.cpp +++ b/src/core/hle/service/soc_u.cpp @@ -603,7 +603,6 @@ static void RecvFrom(Interface* self) { u32 socket_handle = cmd_buffer[1]; u32 len = cmd_buffer[2]; u32 flags = cmd_buffer[3]; - socklen_t addr_len = static_cast<socklen_t>(cmd_buffer[4]); struct { u32 output_buffer_descriptor; @@ -693,7 +692,6 @@ static void Poll(Interface* self) { static void GetSockName(Interface* self) { u32* cmd_buffer = Kernel::GetCommandBuffer(); u32 socket_handle = cmd_buffer[1]; - socklen_t ctr_len = cmd_buffer[2]; // Memory address of the ctr_dest_addr structure VAddr ctr_dest_addr_addr = cmd_buffer[0x104 >> 2]; @@ -734,7 +732,6 @@ static void Shutdown(Interface* self) { static void GetPeerName(Interface* self) { u32* cmd_buffer = Kernel::GetCommandBuffer(); u32 socket_handle = cmd_buffer[1]; - socklen_t len = cmd_buffer[2]; // Memory address of the ctr_dest_addr structure VAddr ctr_dest_addr_addr = cmd_buffer[0x104 >> 2]; @@ -765,7 +762,6 @@ static void Connect(Interface* self) { // performing nonblocking operations and spinlock until the data is available u32* cmd_buffer = Kernel::GetCommandBuffer(); u32 socket_handle = cmd_buffer[1]; - socklen_t len = cmd_buffer[2]; // Memory address of the ctr_input_addr structure VAddr ctr_input_addr_addr = cmd_buffer[6]; diff --git a/src/core/loader/ncch.cpp b/src/core/loader/ncch.cpp index a204dc336..5df33f6d2 100644 --- a/src/core/loader/ncch.cpp +++ b/src/core/loader/ncch.cpp @@ -288,7 +288,7 @@ ResultStatus AppLoader_NCCH::LoadExeFS() { LOG_DEBUG(Loader, "Thread priority: 0x%X", priority); LOG_DEBUG(Loader, "Resource limit category: %d", resource_limit_category); LOG_DEBUG(Loader, "System Mode: %d", - exheader_header.arm11_system_local_caps.system_mode); + static_cast<int>(exheader_header.arm11_system_local_caps.system_mode)); if (exheader_header.arm11_system_local_caps.program_id != ncch_header.program_id) { LOG_ERROR(Loader, "ExHeader Program ID mismatch: the ROM is probably encrypted."); diff --git a/src/core/loader/ncch.h b/src/core/loader/ncch.h index fe08f5b45..4ef95b5c6 100644 --- a/src/core/loader/ncch.h +++ b/src/core/loader/ncch.h @@ -181,7 +181,7 @@ public: * Loads the Exheader and returns the system mode for this application. * @return Optional with the kernel system mode */ - boost::optional<u32> LoadKernelSystemMode(); + boost::optional<u32> LoadKernelSystemMode() override; ResultStatus ReadCode(std::vector<u8>& buffer) override; diff --git a/src/video_core/shader/shader_interpreter.cpp b/src/video_core/shader/shader_interpreter.cpp index 70db4167e..20fb9754b 100644 --- a/src/video_core/shader/shader_interpreter.cpp +++ b/src/video_core/shader/shader_interpreter.cpp @@ -27,8 +27,6 @@ namespace Pica { namespace Shader { -constexpr u32 INVALID_ADDRESS = 0xFFFFFFFF; - struct CallStackElement { u32 final_address; // Address upon which we jump to return_address u32 return_address; // Where to jump when leaving scope