75#ifdef SDL_WIKI_DOCUMENTATION_SECTION
94#define SDL_ASSERT_LEVEL SomeNumberBasedOnVariousFactors
96#elif !defined(SDL_ASSERT_LEVEL)
97#ifdef SDL_DEFAULT_ASSERT_LEVEL
98#define SDL_ASSERT_LEVEL SDL_DEFAULT_ASSERT_LEVEL
99#elif defined(_DEBUG) || defined(DEBUG) || \
100 (defined(__GNUC__) && !defined(__OPTIMIZE__))
101#define SDL_ASSERT_LEVEL 2
103#define SDL_ASSERT_LEVEL 1
107#ifdef SDL_WIKI_DOCUMENTATION_SECTION
127#define SDL_TriggerBreakpoint() TriggerABreakpointInAPlatformSpecificManner
129#elif defined(_MSC_VER) && _MSC_VER >= 1310
131 extern void __cdecl __debugbreak(
void);
132 #define SDL_TriggerBreakpoint() __debugbreak()
133#elif defined(_MSC_VER) && defined(_M_IX86)
134 #define SDL_TriggerBreakpoint() { _asm { int 0x03 } }
135#elif defined(ANDROID)
137 #define SDL_TriggerBreakpoint() assert(0)
138#elif SDL_HAS_BUILTIN(__builtin_debugtrap)
139 #define SDL_TriggerBreakpoint() __builtin_debugtrap()
140#elif SDL_HAS_BUILTIN(__builtin_trap)
141 #define SDL_TriggerBreakpoint() __builtin_trap()
142#elif (defined(__GNUC__) || defined(__clang__)) && (defined(__i386__) || defined(__x86_64__))
143 #define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "int $3\n\t" )
144#elif (defined(__GNUC__) || defined(__clang__)) && defined(__riscv)
145 #define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "ebreak\n\t" )
146#elif ( defined(SDL_PLATFORM_APPLE) && (defined(__arm64__) || defined(__aarch64__)) )
147 #define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "brk #22\n\t" )
148#elif defined(SDL_PLATFORM_APPLE) && defined(__arm__)
149 #define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "bkpt #22\n\t" )
150#elif defined(_WIN32) && ((defined(__GNUC__) || defined(__clang__)) && (defined(__arm64__) || defined(__aarch64__)) )
151 #define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "brk #0xF000\n\t" )
152#elif defined(__GNUC__) || defined(__clang__)
153 #define SDL_TriggerBreakpoint() __builtin_trap()
154#elif defined(__386__) && defined(__WATCOMC__)
155 #define SDL_TriggerBreakpoint() { _asm { int 0x03 } }
156#elif defined(HAVE_SIGNAL_H) && !defined(__WATCOMC__)
158 #define SDL_TriggerBreakpoint() raise(SIGTRAP)
163#ifdef SDL_WIKI_DOCUMENTATION_SECTION
172#define SDL_FUNCTION __FUNCTION__
174#elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
175# define SDL_FUNCTION __func__
176#elif ((defined(__GNUC__) && (__GNUC__ >= 2)) || defined(_MSC_VER) || defined (__WATCOMC__))
177# define SDL_FUNCTION __FUNCTION__
179# define SDL_FUNCTION "???"
187#define SDL_FILE __FILE__
194#define SDL_LINE __LINE__
211#ifdef SDL_WIKI_DOCUMENTATION_SECTION
231#define SDL_NULL_WHILE_LOOP_CONDITION (0)
233#elif defined(_MSC_VER)
236#define SDL_NULL_WHILE_LOOP_CONDITION (0,0)
238#define SDL_NULL_WHILE_LOOP_CONDITION (0)
255#define SDL_disabled_assert(condition) \
256 do { (void) sizeof ((condition)); } while (SDL_NULL_WHILE_LOOP_CONDITION)
320#ifdef SDL_WIKI_DOCUMENTATION_SECTION
330#define SDL_AssertBreakpoint() SDL_TriggerBreakpoint()
332#elif !defined(SDL_AssertBreakpoint)
333# if defined(ANDROID) && defined(assert)
335# define SDL_AssertBreakpoint()
337# define SDL_AssertBreakpoint() SDL_TriggerBreakpoint()
362#define SDL_enabled_assert(condition) \
364 while ( !(condition) ) { \
365 static struct SDL_AssertData sdl_assert_data = { 0, 0, #condition, 0, 0, 0, 0 }; \
366 const SDL_AssertState sdl_assert_state = SDL_ReportAssertion(&sdl_assert_data, SDL_FUNCTION, SDL_FILE, SDL_LINE); \
367 if (sdl_assert_state == SDL_ASSERTION_RETRY) { \
369 } else if (sdl_assert_state == SDL_ASSERTION_BREAK) { \
370 SDL_AssertBreakpoint(); \
374 } while (SDL_NULL_WHILE_LOOP_CONDITION)
376#ifdef SDL_WIKI_DOCUMENTATION_SECTION
408#define SDL_assert(condition) if (assertion_enabled && (condition)) { trigger_assertion; }
441#define SDL_assert_release(condition) SDL_disabled_assert(condition)
470#define SDL_assert_paranoid(condition) SDL_disabled_assert(condition)
473#elif SDL_ASSERT_LEVEL == 0
474# define SDL_assert(condition) SDL_disabled_assert(condition)
475# define SDL_assert_release(condition) SDL_disabled_assert(condition)
476# define SDL_assert_paranoid(condition) SDL_disabled_assert(condition)
477#elif SDL_ASSERT_LEVEL == 1
478# define SDL_assert(condition) SDL_disabled_assert(condition)
479# define SDL_assert_release(condition) SDL_enabled_assert(condition)
480# define SDL_assert_paranoid(condition) SDL_disabled_assert(condition)
481#elif SDL_ASSERT_LEVEL == 2
482# define SDL_assert(condition) SDL_enabled_assert(condition)
483# define SDL_assert_release(condition) SDL_enabled_assert(condition)
484# define SDL_assert_paranoid(condition) SDL_disabled_assert(condition)
485#elif SDL_ASSERT_LEVEL == 3
486# define SDL_assert(condition) SDL_enabled_assert(condition)
487# define SDL_assert_release(condition) SDL_enabled_assert(condition)
488# define SDL_assert_paranoid(condition) SDL_enabled_assert(condition)
490# error Unknown assertion level.
514#define SDL_assert_always(condition) SDL_enabled_assert(condition)
@ SDL_ASSERTION_ALWAYS_IGNORE
SDL_AssertState(* SDL_AssertionHandler)(const SDL_AssertData *data, void *userdata)
SDL_AssertState SDL_ReportAssertion(SDL_AssertData *data, const char *func, const char *file, int line) SDL_ANALYZER_NORETURN
const SDL_AssertData * SDL_GetAssertionReport(void)
void SDL_ResetAssertionReport(void)
void SDL_SetAssertionHandler(SDL_AssertionHandler handler, void *userdata)
SDL_AssertionHandler SDL_GetDefaultAssertionHandler(void)
SDL_AssertionHandler SDL_GetAssertionHandler(void **puserdata)
#define SDL_ANALYZER_NORETURN
const struct SDL_AssertData * next
unsigned int trigger_count