Skip to content

Conversation

madebr
Copy link
Contributor

@madebr madebr commented Sep 17, 2025

Using the non-libc SDL_abort instead of abort on Linux gives the same developer experience:
The debugger immediately jump to the SDL_abort location.
This is why SDL_abort is a macro instead of an inline/extern function.

The only observable difference is the signal triggering the debugger, and what's printed on the terminal on abort.

abort from libc:

Aborted (core dumped)

abort using SDL_TriggerBreakpoint + SDL_ExitProcess:

Illegal instruction (core dumped)

Description

Existing Issue(s)

Fixes #13968

#ifdef HAVE_LIBC
#define SDL_abort() abort()
#else
#define SDL_abort() do { \
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We probably want to declare SDL_ExitProcess outside the block scope. If I remember right, some compilers don't like that. Do we need the __WATCOMC__ stuff here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was hesitant about doing that because of this comment. Or perhaps this comment is talking about the public headers.

/* 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. */

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can Watcom compile SDL3 for Windows/Linux? @sezero

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But if I can declare SDL_ExitProcess in SDL_internal.h, then I can just keep the watcom code.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Sorry for late reply - noticed this one late.)

Can Watcom compile SDL3 for Windows/Linux? @sezero

Never tested building sdl3 itself using watcom, and never will: unsupported. So, watcom stuff can be removed from private sdl3 sources.

P.S.: Headers are still compatible, though: sdl2-compat can still build for windows using watcom.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, watcom stuff can be removed from private sdl3 sources.

... and just did that with 9cefbab

@madebr madebr force-pushed the add-SDL_abort-macro branch 2 times, most recently from a874534 to 0851fe0 Compare September 17, 2025 19:21
@madebr madebr force-pushed the add-SDL_abort-macro branch from 0851fe0 to c014e49 Compare September 17, 2025 19:43
@madebr madebr merged commit 5dfa2cb into libsdl-org:main Sep 17, 2025
39 of 41 checks passed
@madebr madebr deleted the add-SDL_abort-macro branch September 17, 2025 20:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use abort() in SDL_AbortAssertion()
3 participants