SDL: dynapi: Remove DISABLE_JUMP_MAGIC.

From 39d0e62ef599146efd12709f1eeef8d68a52b586 Mon Sep 17 00:00:00 2001
From: "Ryan C. Gordon" <[EMAIL REDACTED]>
Date: Sun, 21 Apr 2024 22:16:48 -0400
Subject: [PATCH] dynapi: Remove DISABLE_JUMP_MAGIC.

The "jump magic" codepath was never written, and would have involved a lot
of low-level and platform/processor/compiler specific work.

A better solution is for compilers to treat the function call in the jump
table functions as a tail call, which would effectively produce the same
result in a portable way.

Clang already has a way to do this that we could add later. But this wouldn't
need a separate "jump magic" section.
---
 src/dynapi/SDL_dynapi.c | 15 ---------------
 1 file changed, 15 deletions(-)

diff --git a/src/dynapi/SDL_dynapi.c b/src/dynapi/SDL_dynapi.c
index 6288cd6a1c53c..a273692f8d152 100644
--- a/src/dynapi/SDL_dynapi.c
+++ b/src/dynapi/SDL_dynapi.c
@@ -64,10 +64,6 @@ static void SDL_InitDynamicAPI(void);
 
 /* behold, the macro salsa! */
 
-/* !!! FIXME: ...disabled...until we write it.  :) */
-#define DISABLE_JUMP_MAGIC 1
-
-#if DISABLE_JUMP_MAGIC
 /* Can't use the macro for varargs nonsense. This is atrocious. */
 #define SDL_DYNAPI_VARARGS_LOGFN(_static, name, initcall, logname, prio)                                     \
     _static void SDLCALL SDL_Log##logname##name(int category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) \
@@ -178,7 +174,6 @@ static void SDL_InitDynamicAPI(void);
     SDL_DYNAPI_VARARGS_LOGFN(_static, name, initcall, Warn, WARN)                                                                         \
     SDL_DYNAPI_VARARGS_LOGFN(_static, name, initcall, Error, ERROR)                                                                       \
     SDL_DYNAPI_VARARGS_LOGFN(_static, name, initcall, Critical, CRITICAL)
-#endif
 
 /* Typedefs for function pointers for jump table, and predeclare funcs */
 /* The DEFAULT funcs will init jump table and then call real function. */
@@ -211,7 +206,6 @@ static SDL_DYNAPI_jump_table jump_table = {
 };
 
 /* Default functions init the function table then call right thing. */
-#if DISABLE_JUMP_MAGIC
 #define SDL_DYNAPI_PROC(rc, fn, params, args, ret) \
     static rc SDLCALL fn##_DEFAULT params          \
     {                                              \
@@ -223,13 +217,8 @@ static SDL_DYNAPI_jump_table jump_table = {
 #undef SDL_DYNAPI_PROC
 #undef SDL_DYNAPI_PROC_NO_VARARGS
 SDL_DYNAPI_VARARGS(static, _DEFAULT, SDL_InitDynamicAPI())
-#else
-/* !!! FIXME: need the jump magic. */
-#error Write me.
-#endif
 
 /* Public API functions to jump into the jump table. */
-#if DISABLE_JUMP_MAGIC
 #define SDL_DYNAPI_PROC(rc, fn, params, args, ret) \
     rc SDLCALL fn params                           \
     {                                              \
@@ -240,10 +229,6 @@ SDL_DYNAPI_VARARGS(static, _DEFAULT, SDL_InitDynamicAPI())
 #undef SDL_DYNAPI_PROC
 #undef SDL_DYNAPI_PROC_NO_VARARGS
 SDL_DYNAPI_VARARGS(, , )
-#else
-/* !!! FIXME: need the jump magic. */
-#error Write me.
-#endif
 
 /* we make this a static function so we can call the correct one without the
    system's dynamic linker resolving to the wrong version of this. */