mirror of
https://github.com/bkaradzic/bx.git
synced 2026-02-17 12:42:34 +01:00
Added Linux/signal exception handling.
This commit is contained in:
@@ -115,12 +115,13 @@ namespace bx
|
||||
/// Assert handler function.
|
||||
///
|
||||
/// @param[in] _location Source code location where function is called.
|
||||
/// @param[in] _skip Skip top N stack frames.
|
||||
/// @param[in] _format Printf style format.
|
||||
/// @param[in] _argList Arguments for `_format` specification.
|
||||
///
|
||||
/// @returns True if assert should stop code execution, otherwise returns false.
|
||||
///
|
||||
typedef bool (*AssertHandlerFn)(const Location& _location, const char* _format, va_list _argList);
|
||||
typedef bool (*AssertHandlerFn)(const Location& _location, uint32_t _skip, const char* _format, va_list _argList);
|
||||
|
||||
/// Set assert handler function.
|
||||
///
|
||||
@@ -133,12 +134,13 @@ namespace bx
|
||||
/// Assert function calls AssertHandlerFn.
|
||||
///
|
||||
/// @param[in] _location Source code location where function is called.
|
||||
/// @param[in] _skip Skip top N stack frames.
|
||||
/// @param[in] _format Printf style format.
|
||||
/// @param[in] ... Arguments for `_format` specification.
|
||||
///
|
||||
/// @returns True if assert should stop code execution, otherwise returns false.
|
||||
///
|
||||
bool assertFunction(const Location& _location, const char* _format, ...);
|
||||
bool assertFunction(const Location& _location, uint32_t _skip, const char* _format, ...);
|
||||
|
||||
/// Arithmetic type `Ty` limits.
|
||||
template<typename Ty, bool SignT = isSigned<Ty>()>
|
||||
|
||||
@@ -260,22 +260,22 @@ extern "C" void* __cdecl _alloca(size_t _size);
|
||||
bx::debugPrintf("%s(%d): BX " _format "\n", _location.filePath, _location.line, ##__VA_ARGS__); \
|
||||
BX_MACRO_BLOCK_END
|
||||
|
||||
#define _BX_ASSERT(_condition, _format, ...) \
|
||||
BX_MACRO_BLOCK_BEGIN \
|
||||
if (!BX_IGNORE_C4127(_condition) \
|
||||
&& bx::assertFunction(bx::Location::current(), "ASSERT %s -> " _format, #_condition, ##__VA_ARGS__) ) \
|
||||
{ \
|
||||
bx::debugBreak(); \
|
||||
} \
|
||||
#define _BX_ASSERT(_condition, _format, ...) \
|
||||
BX_MACRO_BLOCK_BEGIN \
|
||||
if (!BX_IGNORE_C4127(_condition) \
|
||||
&& bx::assertFunction(bx::Location::current(), 0, "ASSERT %s -> " _format, #_condition, ##__VA_ARGS__) ) \
|
||||
{ \
|
||||
bx::debugBreak(); \
|
||||
} \
|
||||
BX_MACRO_BLOCK_END
|
||||
|
||||
#define _BX_ASSERT_LOC(_location, _condition, _format, ...) \
|
||||
BX_MACRO_BLOCK_BEGIN \
|
||||
if (!BX_IGNORE_C4127(_condition) \
|
||||
&& bx::assertFunction(_location, "ASSERT %s -> " _format, #_condition, ##__VA_ARGS__) ) \
|
||||
{ \
|
||||
bx::debugBreak(); \
|
||||
} \
|
||||
#define _BX_ASSERT_LOC(_location, _condition, _format, ...) \
|
||||
BX_MACRO_BLOCK_BEGIN \
|
||||
if (!BX_IGNORE_C4127(_condition) \
|
||||
&& bx::assertFunction(_location, 0, "ASSERT %s -> " _format, #_condition, ##__VA_ARGS__) ) \
|
||||
{ \
|
||||
bx::debugBreak(); \
|
||||
} \
|
||||
BX_MACRO_BLOCK_END
|
||||
|
||||
#define _BX_WARN(_condition, _format, ...) \
|
||||
|
||||
@@ -59,7 +59,7 @@ namespace bx
|
||||
void* exec(const char* const* _argv);
|
||||
|
||||
///
|
||||
[[noreturn]] void exit(int32_t _exitCode);
|
||||
[[noreturn]] void exit(int32_t _exitCode, bool _cleanup = true);
|
||||
|
||||
///
|
||||
void* memoryMap(void* _address, size_t _size, Error* _err);
|
||||
|
||||
Reference in New Issue
Block a user