4#include "../Foundation/Compiler.h"
5#include "../Foundation/LibC.h"
6#include "../Foundation/Platform.h"
7#include "../Foundation/Result.h"
22 __builtin_unreachable();
26 [[noreturn]]
static void exit(
int code);
30 const char* function,
int line);
31 static void printBacktrace(
const char* expression,
bool result,
const native_char_t* filename,
const char* function,
41#if SC_PLATFORM_WINDOWS
42#define WFILE WIDEN(__FILE__)
48#define SC_ASSERT_RELEASE(e) \
50 SC_LANGUAGE_UNLIKELY \
52 SC::Assert::printBacktrace(#e, e, WFILE, __func__, __LINE__); \
53 SC_COMPILER_DEBUG_BREAK; \
54 SC::Assert::exit(-1); \
60#if SC_CONFIGURATION_DEBUG
61#define SC_ASSERT_DEBUG(e) SC_ASSERT_RELEASE(e)
63#define SC_ASSERT_DEBUG(e) (void)0
67#define SC_TRUST_RESULT(expression) SC_ASSERT_RELEASE(expression)
#define SC_COMPILER_FORCE_INLINE
Macro for forcing inline functions.
Definition Compiler.h:46
char native_char_t
The native char for the platform (wchar_t (4 bytes) on Windows, char (1 byte) everywhere else )
Definition PrimitiveTypes.h:34
Functions and macros to assert, exit() or abort() and capture backtraces.
Definition Assert.h:16
static void exit(int code)
Exits current process with the given code.
static void printBacktrace(const char *expression, Result result, const native_char_t *filename, const char *function, int line)
Prints an assertion to standard output.
An ascii string used as boolean result. SC_TRY macro forwards errors to caller.
Definition Result.h:13