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
128#define SDL_TriggerBreakpoint() TriggerABreakpointInAPlatformSpecificManner
130#elif defined(_MSC_VER)
132 extern void __cdecl __debugbreak(
void);
133 #define SDL_TriggerBreakpoint() __debugbreak()
134#elif defined(ANDROID)
136 #define SDL_TriggerBreakpoint() assert(0)
137#elif SDL_HAS_BUILTIN(__builtin_debugtrap)
138 #define SDL_TriggerBreakpoint() __builtin_debugtrap()
139#elif (defined(__GNUC__) || defined(__clang__)) && (defined(__i386__) || defined(__x86_64__))
140 #define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "int $3\n\t" )
141#elif (defined(__GNUC__) || defined(__clang__)) && defined(__riscv)
142 #define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "ebreak\n\t" )
143#elif ( defined(SDL_PLATFORM_APPLE) && (defined(__arm64__) || defined(__aarch64__)) )
144 #define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "brk #22\n\t" )
145#elif defined(SDL_PLATFORM_APPLE) && defined(__arm__)
146 #define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "bkpt #22\n\t" )
147#elif defined(_WIN32) && ((defined(__GNUC__) || defined(__clang__)) && (defined(__arm64__) || defined(__aarch64__)) )
148 #define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "brk #0xF000\n\t" )
149#elif defined(__386__) && defined(__WATCOMC__)
150 #define SDL_TriggerBreakpoint() { _asm { int 0x03 } }
151#elif defined(HAVE_SIGNAL_H) && !defined(__WATCOMC__)
153 #define SDL_TriggerBreakpoint() raise(SIGTRAP)
156 #define SDL_TriggerBreakpoint()
159#ifdef SDL_WIKI_DOCUMENTATION_SECTION
168#define SDL_FUNCTION __FUNCTION__
170#elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
171# define SDL_FUNCTION __func__
172#elif ((defined(__GNUC__) && (__GNUC__ >= 2)) || defined(_MSC_VER) || defined (__WATCOMC__))
173# define SDL_FUNCTION __FUNCTION__
175# define SDL_FUNCTION "???"
183#define SDL_FILE __FILE__
190#define SDL_LINE __LINE__
207#ifdef SDL_WIKI_DOCUMENTATION_SECTION
227#define SDL_NULL_WHILE_LOOP_CONDITION (0)
229#elif defined(_MSC_VER)
232#define SDL_NULL_WHILE_LOOP_CONDITION (0,0)
234#define SDL_NULL_WHILE_LOOP_CONDITION (0)
251#define SDL_disabled_assert(condition) \
252 do { (void) sizeof ((condition)); } while (SDL_NULL_WHILE_LOOP_CONDITION)
316#ifdef SDL_WIKI_DOCUMENTATION_SECTION
326#define SDL_AssertBreakpoint() SDL_TriggerBreakpoint()
328#elif !defined(SDL_AssertBreakpoint)
329# if defined(ANDROID) && defined(assert)
331# define SDL_AssertBreakpoint()
333# define SDL_AssertBreakpoint() SDL_TriggerBreakpoint()
358#define SDL_enabled_assert(condition) \
360 while ( !(condition) ) { \
361 static struct SDL_AssertData sdl_assert_data = { 0, 0, #condition, 0, 0, 0, 0 }; \
362 const SDL_AssertState sdl_assert_state = SDL_ReportAssertion(&sdl_assert_data, SDL_FUNCTION, SDL_FILE, SDL_LINE); \
363 if (sdl_assert_state == SDL_ASSERTION_RETRY) { \
365 } else if (sdl_assert_state == SDL_ASSERTION_BREAK) { \
366 SDL_AssertBreakpoint(); \
370 } while (SDL_NULL_WHILE_LOOP_CONDITION)
372#ifdef SDL_WIKI_DOCUMENTATION_SECTION
404#define SDL_assert(condition) if (assertion_enabled && (condition)) { trigger_assertion; }
437#define SDL_assert_release(condition) SDL_disabled_assert(condition)
466#define SDL_assert_paranoid(condition) SDL_disabled_assert(condition)
469#elif SDL_ASSERT_LEVEL == 0
470# define SDL_assert(condition) SDL_disabled_assert(condition)
471# define SDL_assert_release(condition) SDL_disabled_assert(condition)
472# define SDL_assert_paranoid(condition) SDL_disabled_assert(condition)
473#elif SDL_ASSERT_LEVEL == 1
474# define SDL_assert(condition) SDL_disabled_assert(condition)
475# define SDL_assert_release(condition) SDL_enabled_assert(condition)
476# define SDL_assert_paranoid(condition) SDL_disabled_assert(condition)
477#elif SDL_ASSERT_LEVEL == 2
478# define SDL_assert(condition) SDL_enabled_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 == 3
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_enabled_assert(condition)
486# error Unknown assertion level.
510#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