Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 2 additions & 11 deletions src/SDL_assert.c
Original file line number Diff line number Diff line change
Expand Up @@ -120,23 +120,14 @@ static void SDL_GenerateAssertionReport(void)
}
}

/* This is not declared in any header, although it is shared between some
parts of SDL, because we don't want anything calling it without an
extremely good reason. */
#ifdef __WATCOMC__
extern void SDL_ExitProcess(int exitcode);
#pragma aux SDL_ExitProcess aborts;
#endif
extern SDL_NORETURN void SDL_ExitProcess(int exitcode);

#ifdef __WATCOMC__
static void SDL_AbortAssertion(void);
#pragma aux SDL_AbortAssertion aborts;
#endif
static SDL_NORETURN void SDL_AbortAssertion(void)
{
SDL_Quit();
SDL_ExitProcess(42);
SDL_abort();
}

static SDL_AssertState SDLCALL SDL_PromptAssertion(const SDL_AssertData *data, void *userdata)
Expand Down Expand Up @@ -361,7 +352,7 @@ SDL_AssertState SDL_ReportAssertion(SDL_AssertData *data, const char *func, cons
if (assertion_running == 2) {
SDL_AbortAssertion();
} else if (assertion_running == 3) { // Abort asserted!
SDL_ExitProcess(42);
SDL_abort();
} else {
while (1) { // do nothing but spin; what else can you do?!
}
Expand Down
18 changes: 18 additions & 0 deletions src/SDL_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,24 @@ extern "C" {
#include "SDL_utils_c.h"
#include "SDL_hashtable.h"

/* SDL_ExitProcess is not declared in any public header, although
it is shared between some parts of SDL, because we don't want
anything calling it without an extremely good reason. */
#ifdef __WATCOMC__
extern void SDL_ExitProcess(int exitcode);
#pragma aux SDL_ExitProcess aborts;
#endif
extern SDL_NORETURN void SDL_ExitProcess(int exitcode);

#ifdef HAVE_LIBC
#define SDL_abort() abort()
#else
#define SDL_abort() do { \
SDL_TriggerBreakpoint(); \
SDL_ExitProcess(42); \
} while (0)
#endif

#define PUSH_SDL_ERROR() \
{ char *_error = SDL_strdup(SDL_GetError());

Expand Down
Loading