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#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
160# define SDL_FUNCTION __func__
161#elif ((defined(__GNUC__) && (__GNUC__ >= 2)) || defined(_MSC_VER) || defined (__WATCOMC__))
162# define SDL_FUNCTION __FUNCTION__
164# define SDL_FUNCTION "???"
166#define SDL_FILE __FILE__
167#define SDL_LINE __LINE__
187#define SDL_NULL_WHILE_LOOP_CONDITION (0,0)
189#define SDL_NULL_WHILE_LOOP_CONDITION (0)
192#define SDL_disabled_assert(condition) \
193 do { (void) sizeof ((condition)); } while (SDL_NULL_WHILE_LOOP_CONDITION)
257#ifndef SDL_AssertBreakpoint
258#if defined(ANDROID) && defined(assert)
260#define SDL_AssertBreakpoint()
262#define SDL_AssertBreakpoint() SDL_TriggerBreakpoint()
273#define SDL_enabled_assert(condition) \
275 while ( !(condition) ) { \
276 static struct SDL_AssertData sdl_assert_data = { 0, 0, #condition, 0, 0, 0, 0 }; \
277 const SDL_AssertState sdl_assert_state = SDL_ReportAssertion(&sdl_assert_data, SDL_FUNCTION, SDL_FILE, SDL_LINE); \
278 if (sdl_assert_state == SDL_ASSERTION_RETRY) { \
280 } else if (sdl_assert_state == SDL_ASSERTION_BREAK) { \
281 SDL_AssertBreakpoint(); \
285 } while (SDL_NULL_WHILE_LOOP_CONDITION)
287#ifdef SDL_WIKI_DOCUMENTATION_SECTION
319#define SDL_assert(condition) if (assertion_enabled && (condition)) { trigger_assertion; }
352#define SDL_assert_release(condition) SDL_disabled_assert(condition)
381#define SDL_assert_paranoid(condition) SDL_disabled_assert(condition)
384#elif SDL_ASSERT_LEVEL == 0
385# define SDL_assert(condition) SDL_disabled_assert(condition)
386# define SDL_assert_release(condition) SDL_disabled_assert(condition)
387# define SDL_assert_paranoid(condition) SDL_disabled_assert(condition)
388#elif SDL_ASSERT_LEVEL == 1
389# define SDL_assert(condition) SDL_disabled_assert(condition)
390# define SDL_assert_release(condition) SDL_enabled_assert(condition)
391# define SDL_assert_paranoid(condition) SDL_disabled_assert(condition)
392#elif SDL_ASSERT_LEVEL == 2
393# define SDL_assert(condition) SDL_enabled_assert(condition)
394# define SDL_assert_release(condition) SDL_enabled_assert(condition)
395# define SDL_assert_paranoid(condition) SDL_disabled_assert(condition)
396#elif SDL_ASSERT_LEVEL == 3
397# define SDL_assert(condition) SDL_enabled_assert(condition)
398# define SDL_assert_release(condition) SDL_enabled_assert(condition)
399# define SDL_assert_paranoid(condition) SDL_enabled_assert(condition)
401# error Unknown assertion level.
425#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