diff --git a/Utilities/Thread.h b/Utilities/Thread.h index caf9ec1c56..e881d6081c 100644 --- a/Utilities/Thread.h +++ b/Utilities/Thread.h @@ -480,8 +480,7 @@ class named_thread final : public Context, result_storage, thread_base public: // Default constructor - template && thread_thread_name(), typename = std::enable_if_t> - named_thread() + named_thread() requires (std::is_default_constructible_v) && (thread_thread_name::value) : Context() , thread(trampoline, Context::thread_name) { diff --git a/rpcs3/Emu/Cell/PPUAnalyser.h b/rpcs3/Emu/Cell/PPUAnalyser.h index 2f2710c69a..58b70c2863 100644 --- a/rpcs3/Emu/Cell/PPUAnalyser.h +++ b/rpcs3/Emu/Cell/PPUAnalyser.h @@ -80,13 +80,13 @@ struct ppu_module ppu_module& operator=(ppu_module&&) = default; uchar sha1[20]{}; - std::string name; - std::string path; - std::string cache; - std::vector relocs; - std::vector segs; - std::vector secs; - std::vector funcs; + std::string name{}; + std::string path{}; + std::string cache{}; + std::vector relocs{}; + std::vector segs{}; + std::vector secs{}; + std::vector funcs{}; // Copy info without functions void copy_part(const ppu_module& info) diff --git a/rpcs3/Emu/Cell/PPUModule.cpp b/rpcs3/Emu/Cell/PPUModule.cpp index 377b6f1ff3..bfaf69c8de 100644 --- a/rpcs3/Emu/Cell/PPUModule.cpp +++ b/rpcs3/Emu/Cell/PPUModule.cpp @@ -114,20 +114,20 @@ struct ppu_linkage_info ppu_static_function* static_func = nullptr; ppu_static_variable* static_var = nullptr; u32 export_addr = 0; - std::set imports; - std::set frefss; + std::set imports{}; + std::set frefss{}; }; // FNID -> (export; [imports...]) - std::unordered_map> functions; - std::unordered_map> variables; + std::unordered_map> functions{}; + std::unordered_map> variables{}; // Obsolete bool imported = false; }; // Module map - std::unordered_map modules; + std::unordered_map modules{}; }; // Initialize static modules. diff --git a/rpcs3/Emu/Cell/PPUModule.h b/rpcs3/Emu/Cell/PPUModule.h index acdb58743b..7b09ffca63 100644 --- a/rpcs3/Emu/Cell/PPUModule.h +++ b/rpcs3/Emu/Cell/PPUModule.h @@ -75,8 +75,8 @@ class ppu_static_module final public: const std::string name; - std::unordered_map> functions; - std::unordered_map> variables; + std::unordered_map> functions{}; + std::unordered_map> variables{}; public: ppu_static_module(const char* name); diff --git a/rpcs3/Emu/RSX/Capture/rsx_replay.h b/rpcs3/Emu/RSX/Capture/rsx_replay.h index 388b241d19..6e0a9d14aa 100644 --- a/rpcs3/Emu/RSX/Capture/rsx_replay.h +++ b/rpcs3/Emu/RSX/Capture/rsx_replay.h @@ -41,9 +41,9 @@ namespace rsx struct replay_command { - std::pair rsx_command; // fifo command - std::unordered_set memory_state; // index into memory_map for the various memory blocks that need applying before this command can run - u64 tile_state{0}; // tile state for this command + std::pair rsx_command{}; // fifo command + std::unordered_set memory_state{}; // index into memory_map for the various memory blocks that need applying before this command can run + u64 tile_state{0}; // tile state for this command u64 display_buffer_state{0}; template diff --git a/rpcs3/Emu/RSX/RSXThread.h b/rpcs3/Emu/RSX/RSXThread.h index d42ce67c35..d4923e6503 100644 --- a/rpcs3/Emu/RSX/RSXThread.h +++ b/rpcs3/Emu/RSX/RSXThread.h @@ -256,16 +256,13 @@ namespace rsx struct vertex_input_layout { - std::vector interleaved_blocks; // Interleaved blocks to be uploaded as-is - std::vector> volatile_blocks; // Volatile data blocks (immediate draw vertex data for example) - rsx::simple_array referenced_registers; // Volatile register data + std::vector interleaved_blocks{}; // Interleaved blocks to be uploaded as-is + std::vector> volatile_blocks{}; // Volatile data blocks (immediate draw vertex data for example) + rsx::simple_array referenced_registers{}; // Volatile register data - std::array attribute_placement; + std::array attribute_placement = fill_array(attribute_buffer_placement::none); - vertex_input_layout() - { - attribute_placement.fill(attribute_buffer_placement::none); - } + vertex_input_layout() = default; void clear() { @@ -408,7 +405,7 @@ namespace rsx bool host_queries_active = false; // The backend/host is gathering Z data for the ZCULL unit std::array m_occlusion_query_data = {}; - std::stack m_free_occlusion_pool; + std::stack m_free_occlusion_pool{}; occlusion_query_info* m_current_task = nullptr; u32 m_statistics_tag_id = 0; @@ -421,8 +418,8 @@ namespace rsx u64 m_sync_tag = 0; u64 m_timer = 0; - std::vector m_pending_writes; - std::unordered_map m_statistics_map; + std::vector m_pending_writes{}; + std::unordered_map m_statistics_map{}; // Enables/disables the ZCULL unit void set_active(class ::rsx::thread* ptimer, bool state, bool flush_queue); @@ -446,7 +443,10 @@ namespace rsx public: ZCULL_control(); - ~ZCULL_control(); + virtual ~ZCULL_control(); + + ZCULL_control(const ZCULL_control&) = delete; + ZCULL_control& operator=(const ZCULL_control&) = delete; void set_enabled(class ::rsx::thread* ptimer, bool state, bool flush_queue = false); void set_status(class ::rsx::thread* ptimer, bool surface_active, bool zpass_active, bool zcull_stats_active, bool flush_queue = false); @@ -804,6 +804,9 @@ namespace rsx void run_FIFO(); public: + thread(const thread&) = delete; + thread& operator=(const thread&) = delete; + virtual void clear_surface(u32 /*arg*/) {} virtual void begin(); virtual void end(); diff --git a/rpcs3/Loader/ELF.h b/rpcs3/Loader/ELF.h index daf67f3ddf..19dcc7c3d8 100644 --- a/rpcs3/Loader/ELF.h +++ b/rpcs3/Loader/ELF.h @@ -99,7 +99,7 @@ struct elf_phdr template class en_t, typename sz_t> struct elf_prog final : elf_phdr { - std::vector bin; + std::vector bin{}; using base = elf_phdr; @@ -180,8 +180,8 @@ public: ehdr_t header{}; - std::vector progs; - std::vector shdrs; + std::vector progs{}; + std::vector shdrs{}; public: elf_object() = default; diff --git a/rpcs3/Loader/TAR.h b/rpcs3/Loader/TAR.h index ec9a8dcd5f..e5bfec4174 100644 --- a/rpcs3/Loader/TAR.h +++ b/rpcs3/Loader/TAR.h @@ -22,7 +22,7 @@ class tar_object const fs::file& m_file; usz largest_offset = 0; // We store the largest offset so we can continue to scan from there. - std::map> m_map; // Maps path to offset of file data and its header + std::map> m_map{}; // Maps path to offset of file data and its header TARHeader read_header(u64 offset) const; diff --git a/rpcs3/Loader/TROPUSR.h b/rpcs3/Loader/TROPUSR.h index 9c9b7e3e07..950ee5fa1f 100644 --- a/rpcs3/Loader/TROPUSR.h +++ b/rpcs3/Loader/TROPUSR.h @@ -78,6 +78,8 @@ class TROPUSRLoader virtual bool LoadTables(); public: + virtual ~TROPUSRLoader() = default; + virtual bool Load(const std::string& filepath, const std::string& configpath); virtual bool Save(const std::string& filepath); diff --git a/rpcs3/util/shared_ptr.hpp b/rpcs3/util/shared_ptr.hpp index 8d2c368cef..91c0a44b11 100644 --- a/rpcs3/util/shared_ptr.hpp +++ b/rpcs3/util/shared_ptr.hpp @@ -97,13 +97,13 @@ namespace stx atomic_t refs{1}; }; - template + template struct align_filler { }; - template - struct align_filler Size)>> + template requires (Align > Size) + struct align_filler { char dummy[Align - Size]; }; @@ -236,16 +236,9 @@ namespace stx return m_ptr; } - decltype(auto) operator*() const noexcept + decltype(auto) operator*() const noexcept requires (!std::is_void_v) { - if constexpr (std::is_void_v) - { - return; - } - else - { - return *m_ptr; - } + return *m_ptr; } element_type* operator->() const noexcept @@ -253,13 +246,9 @@ namespace stx return m_ptr; } - decltype(auto) operator[](std::ptrdiff_t idx) const noexcept + decltype(auto) operator[](std::ptrdiff_t idx) const noexcept requires (!std::is_void_v) { - if constexpr (std::is_void_v) - { - return; - } - else if constexpr (std::is_array_v) + if constexpr (std::is_array_v) { return m_ptr[idx]; } @@ -572,16 +561,9 @@ namespace stx return m_ptr; } - decltype(auto) operator*() const noexcept + decltype(auto) operator*() const noexcept requires (!std::is_void_v) { - if constexpr (std::is_void_v) - { - return; - } - else - { - return *m_ptr; - } + return *m_ptr; } element_type* operator->() const noexcept @@ -589,13 +571,9 @@ namespace stx return m_ptr; } - decltype(auto) operator[](std::ptrdiff_t idx) const noexcept + decltype(auto) operator[](std::ptrdiff_t idx) const noexcept requires (!std::is_void_v) { - if constexpr (std::is_void_v) - { - return; - } - else if constexpr (std::is_array_v) + if constexpr (std::is_array_v) { return m_ptr[idx]; }