4#include "../Foundation/Compiler.h"
5#include "../Foundation/LibC.h"
6#include "../Foundation/Platform.h"
23 __builtin_unreachable();
28 [[noreturn]]
static void exit(
int code);
35 static void print(
const char* expression,
const char* filename,
const char* functionName,
int lineNumber);
48 [[nodiscard]]
static bool printBacktrace(
void** backtraceBuffer,
size_t backtraceBufferSizeInBytes);
56 [[nodiscard]]
static size_t captureBacktrace(
size_t framesToSkip,
void** backtraceBuffer,
57 size_t backtraceBufferSizeInBytes,
uint32_t* hash);
66#define SC_ASSERT_RELEASE(e) \
68 SC_LANGUAGE_UNLIKELY \
70 SC::Assert::print(#e, __FILE__, __func__, __LINE__); \
71 (void)SC::Assert::printBacktrace(); \
72 SC_COMPILER_DEBUG_BREAK; \
73 SC::Assert::exit(-1); \
79#if SC_CONFIGURATION_DEBUG
80#define SC_ASSERT_DEBUG(e) SC_ASSERT_RELEASE(e)
82#define SC_ASSERT_DEBUG(e) (void)0
#define SC_COMPILER_EXPORT
Macro for symbol visibility in non-MSVC compilers.
Definition: Compiler.h:78
#define SC_COMPILER_FORCE_INLINE
Macro for forcing inline functions.
Definition: Compiler.h:46
unsigned int uint32_t
Platform independent (4) bytes unsigned int.
Definition: PrimitiveTypes.h:38
Functions and macros to assert, exit() or abort() and capture backtraces.
Definition: Assert.h:17
static void exit(int code)
Exits current process.
static bool printBacktrace()
Prints backtrace (call stack) of the caller to standard output.
static size_t captureBacktrace(size_t framesToSkip, void **backtraceBuffer, size_t backtraceBufferSizeInBytes, uint32_t *hash)
Captures backtrace of calling stack.
static bool printBacktrace(void **backtraceBuffer, size_t backtraceBufferSizeInBytes)
Prints backtrace (call stack) previously captured with captureBacktrace() of the caller to standard o...
static void printAscii(const char *str)
Prints an ASCII string to standard output.
static void print(const char *expression, const char *filename, const char *functionName, int lineNumber)
Prints an assertion to standard output.