mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-12 17:58:37 +12:00
d3d12: Add formatting abilities to unreachable macro
This commit is contained in:
parent
d7b4b2fd49
commit
456f83671a
2 changed files with 12 additions and 5 deletions
|
@ -262,9 +262,9 @@ void D3D12GSRender::initConvertShader()
|
||||||
p.second->Release();
|
p.second->Release();
|
||||||
}
|
}
|
||||||
|
|
||||||
void unreachable_internal(const char *msg, const char *file, unsigned line)
|
|
||||||
|
void unreachable_internal()
|
||||||
{
|
{
|
||||||
LOG_ERROR(RSX, "file %s line %d : %s", file, line, msg);
|
|
||||||
abort();
|
abort();
|
||||||
#ifdef LLVM_BUILTIN_UNREACHABLE
|
#ifdef LLVM_BUILTIN_UNREACHABLE
|
||||||
LLVM_BUILTIN_UNREACHABLE;
|
LLVM_BUILTIN_UNREACHABLE;
|
||||||
|
|
|
@ -45,7 +45,14 @@
|
||||||
# define LLVM_BUILTIN_UNREACHABLE __assume(false)
|
# define LLVM_BUILTIN_UNREACHABLE __assume(false)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
LLVM_ATTRIBUTE_NORETURN void unreachable_internal(const char *msg = nullptr, const char *file = nullptr, unsigned line = 0);
|
LLVM_ATTRIBUTE_NORETURN void unreachable_internal();
|
||||||
|
|
||||||
|
template<typename... Args>
|
||||||
|
void unreachable_internal_verbose(const char *file, unsigned line, const Args &...args)
|
||||||
|
{
|
||||||
|
LOG_ERROR(RSX, "file %s line %d : %s", file, line, fmt::format(args...));
|
||||||
|
unreachable_internal();
|
||||||
|
}
|
||||||
|
|
||||||
/// Marks that the current location is not supposed to be reachable.
|
/// Marks that the current location is not supposed to be reachable.
|
||||||
/// In !NDEBUG builds, prints the message and location info to stderr.
|
/// In !NDEBUG builds, prints the message and location info to stderr.
|
||||||
|
@ -56,8 +63,8 @@ LLVM_ATTRIBUTE_NORETURN void unreachable_internal(const char *msg = nullptr, con
|
||||||
/// Use this instead of assert(0). It conveys intent more clearly and
|
/// Use this instead of assert(0). It conveys intent more clearly and
|
||||||
/// allows compilers to omit some unnecessary code.
|
/// allows compilers to omit some unnecessary code.
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
#define unreachable(msg) \
|
#define unreachable(...) \
|
||||||
unreachable_internal(msg, __FILE__, __LINE__)
|
unreachable_internal_verbose(__FILE__, __LINE__, ##__VA_ARGS__)
|
||||||
//#elif defined(LLVM_BUILTIN_UNREACHABLE)
|
//#elif defined(LLVM_BUILTIN_UNREACHABLE)
|
||||||
//#define unreachable(msg) LLVM_BUILTIN_UNREACHABLE
|
//#define unreachable(msg) LLVM_BUILTIN_UNREACHABLE
|
||||||
#else
|
#else
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue