diff --git a/Utilities/File.h b/Utilities/File.h index 54b98f1db1..bdfbf500f8 100644 --- a/Utilities/File.h +++ b/Utilities/File.h @@ -96,6 +96,11 @@ namespace fs struct dir_entry : stat_t { std::string name; + + dir_entry() + : stat_t{} + { + } }; // Directory handle base diff --git a/Utilities/Thread.cpp b/Utilities/Thread.cpp index e2b87843e4..12ab58c18d 100644 --- a/Utilities/Thread.cpp +++ b/Utilities/Thread.cpp @@ -1198,7 +1198,7 @@ usz get_x64_access_size(x64_context* context, x64_op_t op, x64_reg_t reg, usz d_ if (reg != X64_NOT_SET) // get "full" access size from RCX register { - u64 counter; + u64 counter = 1; if (!get_x64_reg_value(context, reg, 8, i_size, counter)) { return -1; @@ -1445,7 +1445,7 @@ bool handle_access_violation(u32 addr, bool is_writing, x64_context* context) no // We notify the game that a page fault occurred so it can rectify it. // Note, for data3, were the memory readable AND we got a page fault, it must be due to a write violation since reads are allowed. u64 data1 = addr; - u64 data2; + u64 data2 = 0; if (cpu->id_type() == 1) { diff --git a/rpcs3/Emu/Cell/Modules/cellAudio.cpp b/rpcs3/Emu/Cell/Modules/cellAudio.cpp index 5f45ac10ad..444b16aac6 100644 --- a/rpcs3/Emu/Cell/Modules/cellAudio.cpp +++ b/rpcs3/Emu/Cell/Modules/cellAudio.cpp @@ -971,6 +971,7 @@ void cell_audio_thread::mix(float *out_buffer, s32 offset) const float left = buf[in + 0] * m; const float right = buf[in + 1] * m; const float center = buf[in + 2] * m; + [[maybe_unused]] const float low_freq = buf[in + 3] * m; const float rear_left = buf[in + 4] * m; const float rear_right = buf[in + 5] * m; diff --git a/rpcs3/Emu/Cell/Modules/cellSpursSpu.cpp b/rpcs3/Emu/Cell/Modules/cellSpursSpu.cpp index c836f33129..b1df02dd8c 100644 --- a/rpcs3/Emu/Cell/Modules/cellSpursSpu.cpp +++ b/rpcs3/Emu/Cell/Modules/cellSpursSpu.cpp @@ -1133,13 +1133,13 @@ void spursSysServiceUpdateShutdownCompletionEvents(spu_thread& spu, SpursKernelC // Mark the workloads in wklShutdownBitSet as completed and also generate a bit set of the completed // workloads that have a shutdown completion hook registered u32 wklNotifyBitSet; - u8 spuPort; + [[maybe_unused]] u8 spuPort; //vm::reservation_op(ctxt->spurs.ptr(&CellSpurs::wklState1).addr(), 128, [&]() { auto spurs = ctxt->spurs.get_ptr(); wklNotifyBitSet = 0; - spuPort = spurs->spuPort;; + spuPort = spurs->spuPort; for (u32 i = 0; i < CELL_SPURS_MAX_WORKLOAD; i++) { if (wklShutdownBitSet & (0x80000000u >> i)) diff --git a/rpcs3/Emu/Cell/Modules/cellVdec.cpp b/rpcs3/Emu/Cell/Modules/cellVdec.cpp index 190f8613eb..e10bf11c55 100644 --- a/rpcs3/Emu/Cell/Modules/cellVdec.cpp +++ b/rpcs3/Emu/Cell/Modules/cellVdec.cpp @@ -955,7 +955,7 @@ error_code cellVdecGetPicItem(u32 handle, vm::pptr picItem) u64 pts; u64 dts; u64 usrd; - u32 frc; + u32 frc = 0; vm::ptr info; { std::lock_guard lock(vdec->mutex); diff --git a/rpcs3/Emu/Cell/lv2/sys_lwcond.cpp b/rpcs3/Emu/Cell/lv2/sys_lwcond.cpp index 7014831ffa..162e690448 100644 --- a/rpcs3/Emu/Cell/lv2/sys_lwcond.cpp +++ b/rpcs3/Emu/Cell/lv2/sys_lwcond.cpp @@ -200,7 +200,7 @@ error_code _sys_lwcond_signal_all(ppu_thread& ppu, u32 lwcond_id, u32 lwmutex_id const auto cond = idm::check(lwcond_id, [&](lv2_lwcond& cond) -> s32 { - lv2_lwmutex* mutex; + lv2_lwmutex* mutex{}; if (mode != 2) { diff --git a/rpcs3/Emu/NP/rpcn_client.cpp b/rpcs3/Emu/NP/rpcn_client.cpp index c88f6feffe..879dee7662 100644 --- a/rpcs3/Emu/NP/rpcn_client.cpp +++ b/rpcs3/Emu/NP/rpcn_client.cpp @@ -419,7 +419,7 @@ bool rpcn_client::manage_connection() addr_sig = reinterpret_cast&>(msg[0]); port_sig = reinterpret_cast&>(msg[4]); - in_addr orig{}; + [[maybe_unused]] in_addr orig{}; orig.s_addr = addr_sig; last_pong_time = now; diff --git a/rpcs3/Emu/RSX/Common/texture_cache.h b/rpcs3/Emu/RSX/Common/texture_cache.h index 0facf92ca0..6d108a8694 100644 --- a/rpcs3/Emu/RSX/Common/texture_cache.h +++ b/rpcs3/Emu/RSX/Common/texture_cache.h @@ -1883,8 +1883,8 @@ namespace rsx options.is_compressed_format = helpers::is_compressed_gcm_format(attributes.gcm_format); - u32 tex_size = 0, required_surface_height; - u8 subsurface_count; + u32 tex_size = 0, required_surface_height = 1; + u8 subsurface_count = 1; size2f scale{ 1.f, 1.f }; if (is_unnormalized) @@ -2530,20 +2530,6 @@ namespace rsx if (cached_dest && cached_dest->get_context() != texture_upload_context::dma) { // NOTE: DMA sections are plain memory blocks with no format! - if (src_is_render_target || is_format_convert) - { - bool src_is_depth; - if (is_format_convert) - { - src_is_depth = false; - } - else - { - ensure(src_is_render_target); - src_is_depth = (typeless_info.src_is_typeless) ? false : src_subres.is_depth; - } - } - if (cached_dest) [[likely]] { typeless_info.dst_gcm_format = cached_dest->get_gcm_format(); diff --git a/rpcs3/Emu/RSX/GL/GLHelpers.h b/rpcs3/Emu/RSX/GL/GLHelpers.h index e84667d9da..85bb799862 100644 --- a/rpcs3/Emu/RSX/GL/GLHelpers.h +++ b/rpcs3/Emu/RSX/GL/GLHelpers.h @@ -542,7 +542,7 @@ namespace gl save_binding_state(target target_) { - GLenum pname; + GLenum pname{}; switch (target_) { case target::pixel_pack: pname = GL_PIXEL_PACK_BUFFER_BINDING; break; @@ -552,6 +552,7 @@ namespace gl case target::uniform: pname = GL_UNIFORM_BUFFER_BINDING; break; case target::texture: pname = GL_TEXTURE_BUFFER_BINDING; break; case target::ssbo: pname = GL_SHADER_STORAGE_BUFFER_BINDING; break; + default: fmt::throw_exception("Invalid binding state target (0x%x)", static_cast(target_)); } glGetIntegerv(pname, &m_last_binding); @@ -2288,7 +2289,7 @@ public: type = type_; source = src; - GLenum shader_type; + GLenum shader_type{}; switch (type) { case ::glsl::program_domain::glsl_vertex_program: @@ -2301,7 +2302,8 @@ public: shader_type = GL_COMPUTE_SHADER; break; default: - rsx_log.fatal("gl::glsl::shader::compile(): Unhandled shader type"); + rsx_log.fatal("gl::glsl::shader::compile(): Unhandled shader type (%d)", +type_); + return; } m_id = glCreateShader(shader_type); diff --git a/rpcs3/Emu/RSX/GL/GLShaderInterpreter.cpp b/rpcs3/Emu/RSX/GL/GLShaderInterpreter.cpp index 689824cc49..5ab2ce588b 100644 --- a/rpcs3/Emu/RSX/GL/GLShaderInterpreter.cpp +++ b/rpcs3/Emu/RSX/GL/GLShaderInterpreter.cpp @@ -194,7 +194,7 @@ namespace gl } } - ::glsl::shader_properties properties{}; + [[maybe_unused]] ::glsl::shader_properties properties{}; properties.domain = ::glsl::program_domain::glsl_fragment_program; properties.require_depth_conversion = true; properties.require_wpos = true; diff --git a/rpcs3/Emu/RSX/VK/VKShaderInterpreter.cpp b/rpcs3/Emu/RSX/VK/VKShaderInterpreter.cpp index a5f0beaca8..cf782a99c5 100644 --- a/rpcs3/Emu/RSX/VK/VKShaderInterpreter.cpp +++ b/rpcs3/Emu/RSX/VK/VKShaderInterpreter.cpp @@ -84,7 +84,7 @@ namespace vk glsl::shader* shader_interpreter::build_fs(u64 compiler_options) { - ::glsl::shader_properties properties{}; + [[maybe_unused]] ::glsl::shader_properties properties{}; properties.domain = ::glsl::program_domain::glsl_fragment_program; properties.require_depth_conversion = true; properties.require_wpos = true; diff --git a/rpcs3/Emu/RSX/VK/VKTextureCache.h b/rpcs3/Emu/RSX/VK/VKTextureCache.h index 985fffdb81..f2d0143fbe 100644 --- a/rpcs3/Emu/RSX/VK/VKTextureCache.h +++ b/rpcs3/Emu/RSX/VK/VKTextureCache.h @@ -771,7 +771,7 @@ namespace vk // Define desirable attributes based on type VkImageType image_type; - VkImageViewType image_view_type; + [[maybe_unused]] VkImageViewType image_view_type; VkImageUsageFlags usage_flags = VK_IMAGE_USAGE_TRANSFER_DST_BIT | VK_IMAGE_USAGE_TRANSFER_SRC_BIT | VK_IMAGE_USAGE_SAMPLED_BIT; u8 layer = 0; diff --git a/rpcs3/Emu/RSX/rsx_methods.cpp b/rpcs3/Emu/RSX/rsx_methods.cpp index 2830e30430..01e0f6c8c4 100644 --- a/rpcs3/Emu/RSX/rsx_methods.cpp +++ b/rpcs3/Emu/RSX/rsx_methods.cpp @@ -1069,7 +1069,7 @@ namespace rsx u32 dst_dma = 0; rsx::blit_engine::transfer_destination_format dst_color_format; u32 out_pitch = 0; - u32 out_alignment = 64; + [[maybe_unused]] u32 out_alignment = 64; bool is_block_transfer = false; switch (method_registers.blit_engine_context_surface()) diff --git a/rpcs3/Emu/RSX/rsx_utils.h b/rpcs3/Emu/RSX/rsx_utils.h index b42d6ecf05..b2da648fef 100644 --- a/rpcs3/Emu/RSX/rsx_utils.h +++ b/rpcs3/Emu/RSX/rsx_utils.h @@ -695,7 +695,7 @@ namespace rsx { // Converts a stream e.g [1, 2, 3, -1, 4, 5, 6] to a stream with degenerate splits // Output is e.g [1, 2, 3, 3, 3, 4, 4, 5, 6] (5 bogus triangles) - T last_index, index; + T last_index{}, index; u32 dst_index = 0; for (int n = 0; n < count;) { diff --git a/rpcs3/cmake_modules/ConfigureCompiler.cmake b/rpcs3/cmake_modules/ConfigureCompiler.cmake index d77f9bf073..d8ca2524da 100644 --- a/rpcs3/cmake_modules/ConfigureCompiler.cmake +++ b/rpcs3/cmake_modules/ConfigureCompiler.cmake @@ -35,7 +35,7 @@ else() if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") add_compile_options(-Werror=inconsistent-missing-override) - else() + elseif(CMAKE_COMPILER_IS_GNUCXX) add_compile_options(-Werror=suggest-override) endif() @@ -52,9 +52,7 @@ else() add_compile_options(-Wno-delete-non-virtual-dtor) add_compile_options(-Wno-unused-command-line-argument) elseif(CMAKE_COMPILER_IS_GNUCXX) - add_compile_options(-Wno-maybe-uninitialized) add_compile_options(-Wno-strict-aliasing) - add_compile_options(-Wno-unused-but-set-variable) add_compile_options(-Wno-class-memaccess) endif() diff --git a/rpcs3/rpcs3qt/msg_dialog_frame.cpp b/rpcs3/rpcs3qt/msg_dialog_frame.cpp index 365e542861..ae3e773175 100644 --- a/rpcs3/rpcs3qt/msg_dialog_frame.cpp +++ b/rpcs3/rpcs3qt/msg_dialog_frame.cpp @@ -319,7 +319,7 @@ void msg_dialog_frame::ProgressBarSetLimit(u32 index, u32 limit) m_gauge2->setMaximum(limit); } - bool set_taskbar_limit = false; + [[maybe_unused]] bool set_taskbar_limit = false; if (index == taskbar_index + 0u) { diff --git a/rpcs3/util/logs.cpp b/rpcs3/util/logs.cpp index 08e5318367..9ada74dac3 100644 --- a/rpcs3/util/logs.cpp +++ b/rpcs3/util/logs.cpp @@ -550,7 +550,7 @@ void logs::file_writer::log(const char* text, usz size) // TODO: write bigger fragment directly in blocking manner while (size && size <= 0xffffff) { - u64 bufv; + u64 bufv = 0; const auto pos = m_buf.atomic_op([&](u64& v) -> uchar* { diff --git a/rpcs3/util/shared_ptr.hpp b/rpcs3/util/shared_ptr.hpp index 00aafc81e9..fab08fc9aa 100644 --- a/rpcs3/util/shared_ptr.hpp +++ b/rpcs3/util/shared_ptr.hpp @@ -779,7 +779,7 @@ namespace stx } // Result temp storage - std::conditional_t, int, RT> result; + [[maybe_unused]] std::conditional_t, int, RT> result; // Invoke if constexpr (std::is_void_v) diff --git a/rpcs3/util/sysinfo.cpp b/rpcs3/util/sysinfo.cpp index 2aefa4124f..a828d20e3b 100755 --- a/rpcs3/util/sysinfo.cpp +++ b/rpcs3/util/sysinfo.cpp @@ -347,7 +347,7 @@ ullong utils::get_tsc_freq() constexpr int samples = 40; ullong rdtsc_data[samples]; ullong timer_data[samples]; - ullong error_data[samples]; + [[maybe_unused]] ullong error_data[samples]; // Narrow thread affinity to a single core const u64 old_aff = thread_ctrl::get_thread_affinity_mask();