From 256ae3304425c205e82986ba22d2cc8284e855af Mon Sep 17 00:00:00 2001
From: Ozkan Sezer <[EMAIL REDACTED]>
Date: Sat, 1 Apr 2023 20:40:10 +0300
Subject: [PATCH] fix SDL_assert() after previous commit.
---
src/SDL12_compat.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/src/SDL12_compat.c b/src/SDL12_compat.c
index b7f9e9429..42e9aec73 100644
--- a/src/SDL12_compat.c
+++ b/src/SDL12_compat.c
@@ -126,6 +126,21 @@ extern "C" {
#define SDL20_zeroa(x) SDL20_memset((x), 0, sizeof((x)))
#define SDL_ReportAssertion SDL20_ReportAssertion
+/* for SDL_assert() : */
+#define SDL_enabled_assert(condition) \
+do { \
+ while ( !(condition) ) { \
+ static struct SDL_AssertData sdl_assert_data = { 0, 0, #condition, 0, 0, 0, 0 }; \
+ const SDL_AssertState sdl_assert_state = SDL20_ReportAssertion(&sdl_assert_data, SDL_FUNCTION, SDL_FILE, SDL_LINE); \
+ if (sdl_assert_state == SDL_ASSERTION_RETRY) { \
+ continue; /* go again. */ \
+ } else if (sdl_assert_state == SDL_ASSERTION_BREAK) { \
+ SDL_TriggerBreakpoint(); \
+ } \
+ break; /* not retrying. */ \
+ } \
+} while (SDL_NULL_WHILE_LOOP_CONDITION)
+
/* From SDL2.0's SDL_bits.h: a force-inlined function. */
#if defined(__WATCOMC__) && defined(__386__)
extern __inline int _SDL20_bsr_watcom(Uint32);