diff --git a/Utilities/Macro.h b/Utilities/Macro.h index 2aa9651140..6bbcc985e6 100644 --- a/Utilities/Macro.h +++ b/Utilities/Macro.h @@ -17,9 +17,6 @@ // Return 32 bit custom offsetof() #define OFFSET_32(type, x) static_cast(reinterpret_cast(&reinterpret_cast(reinterpret_cast(0ull)->x))) -// Sometimes to avoid writing std::remove_cv_t<>, example: std::is_same -#define CV const volatile - #define CONCATENATE_DETAIL(x, y) x ## y #define CONCATENATE(x, y) CONCATENATE_DETAIL(x, y) @@ -31,8 +28,6 @@ #define COPY_EXPR(expr, ...) [=](__VA_ARGS__) { return expr; } #define PURE_EXPR(expr, ...) [] (__VA_ARGS__) { return expr; } -#define return_ return - #define HERE "\n(in file " __FILE__ ":" STRINGIZE(__LINE__) ")" // Ensure that the expression is evaluated to true. Always evaluated and allowed to have side effects (unlike assert() macro). diff --git a/rpcs3/Emu/Cell/PPUCallback.h b/rpcs3/Emu/Cell/PPUCallback.h index a08e51ee56..5371666f9e 100644 --- a/rpcs3/Emu/Cell/PPUCallback.h +++ b/rpcs3/Emu/Cell/PPUCallback.h @@ -47,7 +47,7 @@ namespace ppu_cb_detail template struct _func_arg { - static_assert(std::is_same::value, "Invalid callback argument type for ARG_VECTOR"); + static_assert(std::is_same, v128>::value, "Invalid callback argument type for ARG_VECTOR"); static inline void set_value(ppu_thread& CPU, const T& arg) { @@ -71,7 +71,7 @@ namespace ppu_cb_detail template struct _func_arg { - static_assert(std::is_same::value, "Invalid callback argument type for ARG_CONTEXT"); + static_assert(std::is_same, ppu_thread>::value, "Invalid callback argument type for ARG_CONTEXT"); FORCE_INLINE static void set_value(ppu_thread& CPU, const T& arg) { @@ -89,8 +89,8 @@ namespace ppu_cb_detail FORCE_INLINE static bool _bind_func_args(ppu_thread& CPU, T1 arg1, T... args) { const bool is_float = std::is_floating_point::value; - const bool is_vector = std::is_same::value; - const bool is_context = std::is_same::value; + const bool is_vector = std::is_same, v128>::value; + const bool is_context = std::is_same, ppu_thread>::value; const bool is_general = !is_float && !is_vector && !is_context; const _func_arg_type t = @@ -136,7 +136,7 @@ namespace ppu_cb_detail template struct _func_res { - static_assert(std::is_same::value, "Invalid callback result type for ARG_VECTOR"); + static_assert(std::is_same, v128>::value, "Invalid callback result type for ARG_VECTOR"); FORCE_INLINE static T get_value(const ppu_thread& CPU) { @@ -154,7 +154,7 @@ namespace ppu_cb_detail static_assert(!std::is_pointer::value, "Invalid callback result type (pointer)"); static_assert(!std::is_reference::value, "Invalid callback result type (reference)"); const bool is_float = std::is_floating_point::value; - const bool is_vector = std::is_same, v128>::value; + const bool is_vector = std::is_same, v128>::value; const _func_arg_type t = is_float ? ARG_FLOAT : (is_vector ? ARG_VECTOR : ARG_GENERAL); return _func_res::get_value(CPU); diff --git a/rpcs3/Emu/Cell/PPUFunction.h b/rpcs3/Emu/Cell/PPUFunction.h index a2fbe81328..2c3018eddc 100644 --- a/rpcs3/Emu/Cell/PPUFunction.h +++ b/rpcs3/Emu/Cell/PPUFunction.h @@ -64,7 +64,7 @@ namespace ppu_func_detail template struct bind_arg { - static_assert(std::is_same::value, "Invalid function argument type for ARG_VECTOR"); + static_assert(std::is_same, v128>::value, "Invalid function argument type for ARG_VECTOR"); static FORCE_INLINE T get_arg(ppu_thread& ppu) { @@ -86,7 +86,7 @@ namespace ppu_func_detail template struct bind_arg { - static_assert(std::is_same::value, "Invalid function argument type for ARG_CONTEXT"); + static_assert(std::is_same, ppu_thread>::value, "Invalid function argument type for ARG_CONTEXT"); static FORCE_INLINE ppu_thread& get_arg(ppu_thread& ppu) { @@ -97,7 +97,7 @@ namespace ppu_func_detail template struct bind_arg { - static_assert(std::is_same::value, "Invalid function argument type for ARG_VARIADIC"); + static_assert(std::is_same, ppu_va_args_t>::value, "Invalid function argument type for ARG_VARIADIC"); static FORCE_INLINE ppu_va_args_t get_arg(ppu_thread& ppu) { @@ -131,7 +131,7 @@ namespace ppu_func_detail template struct bind_result { - static_assert(std::is_same::value, "Invalid function result type for ARG_VECTOR"); + static_assert(std::is_same, v128>::value, "Invalid function result type for ARG_VECTOR"); static FORCE_INLINE void put_result(ppu_thread& ppu, const T& result) { @@ -183,9 +183,9 @@ namespace ppu_func_detail // TODO: check calculations const bool is_float = std::is_floating_point::value; - const bool is_vector = std::is_same::value; - const bool is_context = std::is_same::value; - const bool is_variadic = std::is_same::value; + const bool is_vector = std::is_same, v128>::value; + const bool is_context = std::is_same, ppu_thread>::value; + const bool is_variadic = std::is_same, ppu_va_args_t>::value; const bool is_general = !is_float && !is_vector && !is_context && !is_variadic; const arg_class t = @@ -209,7 +209,7 @@ namespace ppu_func_detail static_assert(!std::is_pointer::value, "Invalid function result type (pointer)"); static_assert(!std::is_reference::value, "Invalid function result type (reference)"); static const bool is_float = std::is_floating_point::value; - static const bool is_vector = std::is_same::value; + static const bool is_vector = std::is_same, v128>::value; static const arg_class value = is_float ? ARG_FLOAT : (is_vector ? ARG_VECTOR : ARG_GENERAL); }; diff --git a/rpcs3/Emu/Cell/PPUModule.h b/rpcs3/Emu/Cell/PPUModule.h index 7e641dd207..90e6eab97a 100644 --- a/rpcs3/Emu/Cell/PPUModule.h +++ b/rpcs3/Emu/Cell/PPUModule.h @@ -90,7 +90,7 @@ public: template static void register_static_variable(const char* module, const char* name, u32 vnid, void(*init)()) { - static_assert(std::is_same::value, "Static variable registration: vm::gvar expected"); + static_assert(std::is_same>::value, "Static variable registration: vm::gvar expected"); auto& info = access_static_variable(module, vnid); diff --git a/rpcs3/Emu/Cell/PPUThread.h b/rpcs3/Emu/Cell/PPUThread.h index 2a681ab5cb..704b891a5f 100644 --- a/rpcs3/Emu/Cell/PPUThread.h +++ b/rpcs3/Emu/Cell/PPUThread.h @@ -166,7 +166,7 @@ template struct ppu_gpr_cast_impl::value || std::is_enum::value>> { static_assert(sizeof(T) <= 8, "Too big integral type for ppu_gpr_cast<>()"); - static_assert(std::is_same::value == false, "bool type is deprecated in ppu_gpr_cast<>(), use b8 instead"); + static_assert(std::is_same, bool>::value == false, "bool type is deprecated in ppu_gpr_cast<>(), use b8 instead"); static inline u64 to(const T& value) { diff --git a/rpcs3/Emu/Cell/lv2/sys_memory.cpp b/rpcs3/Emu/Cell/lv2/sys_memory.cpp index 3902823b2d..4074af62c4 100644 --- a/rpcs3/Emu/Cell/lv2/sys_memory.cpp +++ b/rpcs3/Emu/Cell/lv2/sys_memory.cpp @@ -94,10 +94,10 @@ ppu_error_code sys_memory_allocate_from_container(u32 size, u32 cid, u64 flags, if (!ct.take(size)) { result = CELL_ENOMEM; - return_ false; + return false; } - return_ true; + return true; }); if (!ct && !result) @@ -214,10 +214,10 @@ ppu_error_code sys_memory_container_destroy(u32 cid) if (!ct.used.compare_and_swap_test(0, ct.size)) { result = CELL_EBUSY; - return_ false; + return false; } - return_ true; + return true; }); if (!ct && !result) diff --git a/rpcs3/Emu/Cell/lv2/sys_mmapper.cpp b/rpcs3/Emu/Cell/lv2/sys_mmapper.cpp index b295c3e99d..ebd5130a77 100644 --- a/rpcs3/Emu/Cell/lv2/sys_mmapper.cpp +++ b/rpcs3/Emu/Cell/lv2/sys_mmapper.cpp @@ -149,10 +149,10 @@ ppu_error_code sys_mmapper_allocate_shared_memory_from_container(u64 unk, u32 si if (!ct.take(size)) { result = CELL_ENOMEM; - return_ false; + return false; } - return_ true; + return true; }); if (!ct && !result) @@ -210,10 +210,10 @@ ppu_error_code sys_mmapper_free_shared_memory(u32 mem_id) if (mem.addr.compare_and_swap_test(0, -1)) { result = CELL_EBUSY; - return_ false; + return false; } - return_ true; + return true; }); if (!mem && !result) diff --git a/rpcs3/Emu/IdManager.h b/rpcs3/Emu/IdManager.h index 2854b49dae..4b897377fe 100644 --- a/rpcs3/Emu/IdManager.h +++ b/rpcs3/Emu/IdManager.h @@ -100,7 +100,7 @@ namespace id_manager template static inline void update() { - access()[get_index()].on_stop = [](void* ptr) { return_ id_manager::on_stop::func(static_cast(ptr)); }; + access()[get_index()].on_stop = [](void* ptr) { return id_manager::on_stop::func(static_cast(ptr)); }; } // Read all registered types diff --git a/rpcs3/Emu/Memory/vm_ptr.h b/rpcs3/Emu/Memory/vm_ptr.h index cd0a079bdc..a6ca9da732 100644 --- a/rpcs3/Emu/Memory/vm_ptr.h +++ b/rpcs3/Emu/Memory/vm_ptr.h @@ -170,7 +170,7 @@ namespace vm // Pointer difference operator template - std::enable_if_t::value && std::is_same::value, s32> operator -(const _ptr_base& right) const + std::enable_if_t::value && std::is_same, std::decay_t>::value, s32> operator -(const _ptr_base& right) const { return static_cast(vm::cast(m_addr, HERE) - vm::cast(right.m_addr, HERE)) / SIZE_32(T); } diff --git a/rpcs3/Emu/PSP2/ARMv7Function.h b/rpcs3/Emu/PSP2/ARMv7Function.h index e5fad8dd54..ca7348f204 100644 --- a/rpcs3/Emu/PSP2/ARMv7Function.h +++ b/rpcs3/Emu/PSP2/ARMv7Function.h @@ -102,7 +102,7 @@ namespace arm_func_detail struct bind_arg { static_assert(v_count <= 0, "TODO: Unsupported argument type (vector)"); - static_assert(std::is_same::value, "Invalid function argument type for ARG_VECTOR"); + static_assert(std::is_same, v128>::value, "Invalid function argument type for ARG_VECTOR"); FORCE_INLINE static T get_arg(ARMv7Thread& cpu) { @@ -177,7 +177,7 @@ namespace arm_func_detail template struct bind_arg { - static_assert(std::is_same::value, "Invalid function argument type for ARG_CONTEXT"); + static_assert(std::is_same, ARMv7Thread>::value, "Invalid function argument type for ARG_CONTEXT"); FORCE_INLINE static ARMv7Thread& get_arg(ARMv7Thread& cpu) { @@ -192,7 +192,7 @@ namespace arm_func_detail template struct bind_arg { - static_assert(std::is_same::value, "Invalid function argument type for ARG_VARIADIC"); + static_assert(std::is_same, arm_va_args_t>::value, "Invalid function argument type for ARG_VARIADIC"); FORCE_INLINE static arm_va_args_t get_arg(ARMv7Thread& cpu) { @@ -273,7 +273,7 @@ namespace arm_func_detail static_assert(!std::is_pointer::value, "Invalid function result type (pointer)"); static_assert(!std::is_reference::value, "Invalid function result type (reference)"); static const bool is_float = std::is_floating_point::value; - static const bool is_vector = std::is_same::value; + static const bool is_vector = std::is_same, v128>::value; static const arg_class value = is_float ? ARG_FLOAT : (is_vector ? ARG_VECTOR : ARG_GENERAL); }; @@ -282,9 +282,9 @@ namespace arm_func_detail { // TODO: check calculations static const bool is_float = std::is_floating_point::value; - static const bool is_vector = std::is_same::value; - static const bool is_context = std::is_same::value; - static const bool is_variadic = std::is_same::value; + static const bool is_vector = std::is_same, v128>::value; + static const bool is_context = std::is_same, ARMv7Thread>::value; + static const bool is_variadic = std::is_same, arm_va_args_t>::value; static const bool is_general = !is_float && !is_vector && !is_context && !is_variadic; static const u32 g_align = ALIGN_32(T) > 4 ? ALIGN_32(T) >> 2 : 1; diff --git a/rpcs3/Emu/PSP2/ARMv7Thread.h b/rpcs3/Emu/PSP2/ARMv7Thread.h index d310281ba4..a288473f65 100644 --- a/rpcs3/Emu/PSP2/ARMv7Thread.h +++ b/rpcs3/Emu/PSP2/ARMv7Thread.h @@ -211,7 +211,7 @@ template struct arm_gpr_cast_impl::value || std::is_enum::value>> { static_assert(sizeof(T) <= 4, "Too big integral type for arm_gpr_cast<>()"); - static_assert(std::is_same::value == false, "bool type is deprecated in arm_gpr_cast<>(), use b8 instead"); + static_assert(std::is_same, bool>::value == false, "bool type is deprecated in arm_gpr_cast<>(), use b8 instead"); static inline u32 to(const T& value) { diff --git a/rpcs3/Gui/MainFrame.cpp b/rpcs3/Gui/MainFrame.cpp index 84b6fe6750..f039bed464 100644 --- a/rpcs3/Gui/MainFrame.cpp +++ b/rpcs3/Gui/MainFrame.cpp @@ -279,7 +279,7 @@ void MainFrame::InstallPkg(wxCommandEvent& WXUNUSED(event)) if (pkg_install(pkg_f, local_path + '/', progress)) { progress = 1.; - return_; + return; } // TODO: Ask user to delete files on cancellation/failure?