From a758f87f6f4aecc03366853ade5f7ed52f8cd31b Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Wed, 22 Feb 2023 15:32:49 -0800 Subject: [PATCH] Fixed compile error on Android when assert is defined as SDL_assert --- include/SDL3/SDL_assert.h | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/include/SDL3/SDL_assert.h b/include/SDL3/SDL_assert.h index 26b399b569..e26faed0f6 100644 --- a/include/SDL3/SDL_assert.h +++ b/include/SDL3/SDL_assert.h @@ -161,6 +161,16 @@ extern DECLSPEC SDL_AssertState SDLCALL SDL_ReportAssertion(SDL_AssertData *data SDL_assert test. */ +/* Define the trigger breakpoint call used in asserts */ +#ifndef SDL_AssertBreakpoint +#if defined(ANDROID) && defined(assert) +/* Define this as empty in case assert() is defined as SDL_assert */ +#define SDL_AssertBreakpoint() +#else +#define SDL_AssertBreakpoint() SDL_TriggerBreakpoint() +#endif +#endif /* !SDL_AssertBreakpoint */ + /* the do {} while(0) avoids dangling else problems: if (x) SDL_assert(y); else blah(); ... without the do/while, the "else" could attach to this macro's "if". @@ -178,7 +188,7 @@ extern DECLSPEC SDL_AssertState SDLCALL SDL_ReportAssertion(SDL_AssertData *data if (sdl_assert_state == SDL_ASSERTION_RETRY) { \ continue; /* go again. */ \ } else if (sdl_assert_state == SDL_ASSERTION_BREAK) { \ - SDL_TriggerBreakpoint(); \ + SDL_AssertBreakpoint(); \ } \ break; /* not retrying. */ \ } \