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(__386__) && defined(__WATCOMC__)
153 #define SDL_TriggerBreakpoint() { _asm { int 0x03 } }
154#elif defined(HAVE_SIGNAL_H) && !defined(__WATCOMC__)
156 #define SDL_TriggerBreakpoint() raise(SIGTRAP)
161#ifdef SDL_WIKI_DOCUMENTATION_SECTION
170#define SDL_FUNCTION __FUNCTION__
172#elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
173# define SDL_FUNCTION __func__
174#elif ((defined(__GNUC__) && (__GNUC__ >= 2)) || defined(_MSC_VER) || defined (__WATCOMC__))
175# define SDL_FUNCTION __FUNCTION__
177# define SDL_FUNCTION "???"
185#define SDL_FILE __FILE__
192#define SDL_LINE __LINE__
209#ifdef SDL_WIKI_DOCUMENTATION_SECTION
229#define SDL_NULL_WHILE_LOOP_CONDITION (0)
231#elif defined(_MSC_VER)
234#define SDL_NULL_WHILE_LOOP_CONDITION (0,0)
236#define SDL_NULL_WHILE_LOOP_CONDITION (0)
253#define SDL_disabled_assert(condition) \
254 do { (void) sizeof ((condition)); } while (SDL_NULL_WHILE_LOOP_CONDITION)
318#ifdef SDL_WIKI_DOCUMENTATION_SECTION
328#define SDL_AssertBreakpoint() SDL_TriggerBreakpoint()
330#elif !defined(SDL_AssertBreakpoint)
331# if defined(ANDROID) && defined(assert)
333# define SDL_AssertBreakpoint()
335# define SDL_AssertBreakpoint() SDL_TriggerBreakpoint()
360#define SDL_enabled_assert(condition) \
362 while ( !(condition) ) { \
363 static struct SDL_AssertData sdl_assert_data = { 0, 0, #condition, 0, 0, 0, 0 }; \
364 const SDL_AssertState sdl_assert_state = SDL_ReportAssertion(&sdl_assert_data, SDL_FUNCTION, SDL_FILE, SDL_LINE); \
365 if (sdl_assert_state == SDL_ASSERTION_RETRY) { \
367 } else if (sdl_assert_state == SDL_ASSERTION_BREAK) { \
368 SDL_AssertBreakpoint(); \
372 } while (SDL_NULL_WHILE_LOOP_CONDITION)
374#ifdef SDL_WIKI_DOCUMENTATION_SECTION
406#define SDL_assert(condition) if (assertion_enabled && (condition)) { trigger_assertion; }
439#define SDL_assert_release(condition) SDL_disabled_assert(condition)
468#define SDL_assert_paranoid(condition) SDL_disabled_assert(condition)
471#elif SDL_ASSERT_LEVEL == 0
472# define SDL_assert(condition) SDL_disabled_assert(condition)
473# define SDL_assert_release(condition) SDL_disabled_assert(condition)
474# define SDL_assert_paranoid(condition) SDL_disabled_assert(condition)
475#elif SDL_ASSERT_LEVEL == 1
476# define SDL_assert(condition) SDL_disabled_assert(condition)
477# define SDL_assert_release(condition) SDL_enabled_assert(condition)
478# define SDL_assert_paranoid(condition) SDL_disabled_assert(condition)
479#elif SDL_ASSERT_LEVEL == 2
480# define SDL_assert(condition) SDL_enabled_assert(condition)
481# define SDL_assert_release(condition) SDL_enabled_assert(condition)
482# define SDL_assert_paranoid(condition) SDL_disabled_assert(condition)
483#elif SDL_ASSERT_LEVEL == 3
484# define SDL_assert(condition) SDL_enabled_assert(condition)
485# define SDL_assert_release(condition) SDL_enabled_assert(condition)
486# define SDL_assert_paranoid(condition) SDL_enabled_assert(condition)
488# error Unknown assertion level.
512#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