impr: Properly print asserts
This commit is contained in:
parent
ffdaf0d16e
commit
8b3cd2d76d
6
lib/external/imgui/include/imconfig.h
vendored
6
lib/external/imgui/include/imconfig.h
vendored
@ -14,10 +14,16 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
//---- Define assertion handler. Defaults to calling assert().
|
//---- Define assertion handler. Defaults to calling assert().
|
||||||
// If your macro uses multiple statements, make sure is enclosed in a 'do { .. } while (0)' block so it can be used as a single statement.
|
// If your macro uses multiple statements, make sure is enclosed in a 'do { .. } while (0)' block so it can be used as a single statement.
|
||||||
//#define IM_ASSERT(_EXPR) MyAssert(_EXPR)
|
//#define IM_ASSERT(_EXPR) MyAssert(_EXPR)
|
||||||
//#define IM_ASSERT(_EXPR) ((void)(_EXPR)) // Disable asserts
|
//#define IM_ASSERT(_EXPR) ((void)(_EXPR)) // Disable asserts
|
||||||
|
namespace hex::log::impl {
|
||||||
|
void assertionHandler(bool expr, const char* expr_str, const char* file, int line);
|
||||||
|
}
|
||||||
|
#define IM_ASSERT(_EXPR) hex::log::impl::assertionHandler(_EXPR, #_EXPR, __FILE__, __LINE__)
|
||||||
|
|
||||||
//---- Define attributes of all API symbols declarations, e.g. for DLL under Windows
|
//---- Define attributes of all API symbols declarations, e.g. for DLL under Windows
|
||||||
// Using Dear ImGui via a shared library is not recommended, because of function call overhead and because we don't guarantee backward nor forward ABI compatibility.
|
// Using Dear ImGui via a shared library is not recommended, because of function call overhead and because we don't guarantee backward nor forward ABI compatibility.
|
||||||
|
@ -42,4 +42,14 @@ namespace hex::log::impl {
|
|||||||
return logEntries;
|
return logEntries;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void assertionHandler(bool expr, const char* expr_str, const char* file, int line) {
|
||||||
|
if (!expr) {
|
||||||
|
log::error("Assertion failed: {} at {}:{}", expr_str, file, line);
|
||||||
|
|
||||||
|
#if defined (DEBUG)
|
||||||
|
std::abort();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user