diff --git a/Utilities/BitField.h b/Utilities/BitField.h index 2130289e27..df97d72f85 100644 --- a/Utilities/BitField.h +++ b/Utilities/BitField.h @@ -1,6 +1,7 @@ #pragma once #include "util/types.hpp" +#include "Utilities/StrFmt.h" template struct bf_base diff --git a/Utilities/StrFmt.cpp b/Utilities/StrFmt.cpp index 8ca763f53e..488508a862 100644 --- a/Utilities/StrFmt.cpp +++ b/Utilities/StrFmt.cpp @@ -294,29 +294,21 @@ void fmt_class_string::format(std::string& out, u64 arg) namespace fmt { - void raw_verify_error(const src_loc& loc) + [[noreturn]] void raw_verify_error(const src_loc& loc) { std::string out{"Verification failed"}; fmt::append(out, "%s", loc); thread_ctrl::emergency_exit(out); } - void raw_narrow_error(const src_loc& loc, const fmt_type_info* sup, u64 arg) + [[noreturn]] void raw_narrow_error(const src_loc& loc) { std::string out{"Narrowing error"}; - - if (sup) - { - out += " ("; - sup->fmt_string(out, arg); // Print value - out += ")"; - } - fmt::append(out, "%s", loc); thread_ctrl::emergency_exit(out); } - void raw_throw_exception(const src_loc& loc, const char* fmt, const fmt_type_info* sup, const u64* args) + [[noreturn]] void raw_throw_exception(const src_loc& loc, const char* fmt, const fmt_type_info* sup, const u64* args) { std::string out; raw_append(out, fmt, sup, args); diff --git a/Utilities/StrFmt.h b/Utilities/StrFmt.h index 5726d54dfc..599b0f86df 100644 --- a/Utilities/StrFmt.h +++ b/Utilities/StrFmt.h @@ -10,7 +10,7 @@ namespace fmt static std::string format(const CharT(&)[N], const Args&...); } -template +template struct fmt_unveil { static_assert(sizeof(T) > 0, "fmt_unveil<> error: incomplete type"); @@ -245,6 +245,9 @@ struct fmt_type_info template using fmt_args_t = const u64(&&)[sizeof...(Args) + 1]; +template +using fmt_unveil_t = typename fmt_unveil::type; + namespace fmt { // Base-57 format helper diff --git a/Utilities/bit_set.h b/Utilities/bit_set.h index 36133b3165..1dc53f4bdb 100644 --- a/Utilities/bit_set.h +++ b/Utilities/bit_set.h @@ -23,6 +23,7 @@ Intersection (&) and symmetric difference (^) is also available. #include "util/types.hpp" #include "util/atomic.hpp" +#include "Utilities/StrFmt.h" template class atomic_bs_t; diff --git a/rpcs3/Emu/Cell/ErrorCodes.h b/rpcs3/Emu/Cell/ErrorCodes.h index 651e9007b5..022ece2657 100644 --- a/rpcs3/Emu/Cell/ErrorCodes.h +++ b/rpcs3/Emu/Cell/ErrorCodes.h @@ -1,6 +1,7 @@ #pragma once #include "util/types.hpp" +#include "Utilities/StrFmt.h" // Error code type (return type), implements error reporting. class error_code diff --git a/rpcs3/Emu/Memory/vm_ptr.h b/rpcs3/Emu/Memory/vm_ptr.h index 6d0c08c68b..40b55e6c19 100644 --- a/rpcs3/Emu/Memory/vm_ptr.h +++ b/rpcs3/Emu/Memory/vm_ptr.h @@ -2,6 +2,7 @@ #include "util/types.hpp" #include "util/to_endian.hpp" +#include "Utilities/StrFmt.h" #include "vm.h" class ppu_thread; diff --git a/rpcs3/Input/mm_joystick_handler.h b/rpcs3/Input/mm_joystick_handler.h index 54132d44e4..52080ea916 100644 --- a/rpcs3/Input/mm_joystick_handler.h +++ b/rpcs3/Input/mm_joystick_handler.h @@ -1,5 +1,6 @@ #pragma once +#ifdef _WIN32 #include "util/types.hpp" #include "Emu/Io/PadHandler.h" #ifndef NOMINMAX @@ -137,3 +138,4 @@ private: PadHandlerBase::connection update_connection(const std::shared_ptr& device) override; std::unordered_map get_button_values(const std::shared_ptr& device) override; }; +#endif diff --git a/rpcs3/util/types.hpp b/rpcs3/util/types.hpp index e07d58123f..e4bd3bf7fa 100644 --- a/rpcs3/util/types.hpp +++ b/rpcs3/util/types.hpp @@ -188,21 +188,6 @@ std::remove_cvref_t as_rvalue(T&& obj) return std::forward(obj); } -// Formatting helper, type-specific preprocessing for improving safety and functionality -template -struct fmt_unveil; - -template -using fmt_unveil_t = typename fmt_unveil::type; - -struct fmt_type_info; - -namespace fmt -{ - template - const fmt_type_info* get_type_info(); -} - template class atomic_t; @@ -744,7 +729,7 @@ struct src_loc namespace fmt { [[noreturn]] void raw_verify_error(const src_loc& loc); - [[noreturn]] void raw_narrow_error(const src_loc& loc, const fmt_type_info* sup, u64 arg); + [[noreturn]] void raw_narrow_error(const src_loc& loc); } template @@ -845,7 +830,7 @@ template if (narrow_impl::test(value)) [[unlikely]] { // Pack value as formatting argument - fmt::raw_narrow_error({line, col, file, func}, fmt::get_type_info>(), fmt_unveil::get(value)); + fmt::raw_narrow_error({line, col, file, func}); } return static_cast(value);