dynapi: Remove unused ENABLE_SDL_CALL_LOGGING code.

This was hardcoded to disabled, since building it in bloated the binary
massively for little gain (one could probably accomplish this same thing
with ltrace or something).

If we need it, we'll pull it out of revision control.
This commit is contained in:
Ryan C. Gordon 2024-04-21 22:13:43 -04:00
parent 7a36504952
commit 9128f92f38
No known key found for this signature in database
GPG key ID: FA148B892AB48044

View file

@ -245,111 +245,6 @@ SDL_DYNAPI_VARARGS(, , )
#error Write me.
#endif
#define ENABLE_SDL_CALL_LOGGING 0
#if ENABLE_SDL_CALL_LOGGING
static int SDLCALL SDL_SetError_LOGSDLCALLS(SDL_PRINTF_FORMAT_STRING const char *fmt, ...)
{
char buf[512]; /* !!! FIXME: dynamic allocation */
va_list ap;
SDL_Log_REAL("SDL3CALL SDL_SetError");
va_start(ap, fmt);
SDL_vsnprintf_REAL(buf, sizeof(buf), fmt, ap);
va_end(ap);
return SDL_SetError_REAL("%s", buf);
}
static int SDLCALL SDL_sscanf_LOGSDLCALLS(const char *buf, SDL_SCANF_FORMAT_STRING const char *fmt, ...)
{
int retval;
va_list ap;
SDL_Log_REAL("SDL3CALL SDL_sscanf");
va_start(ap, fmt);
retval = SDL_vsscanf_REAL(buf, fmt, ap);
va_end(ap);
return retval;
}
static int SDLCALL SDL_snprintf_LOGSDLCALLS(SDL_OUT_Z_CAP(maxlen) char *buf, size_t maxlen, SDL_PRINTF_FORMAT_STRING const char *fmt, ...)
{
int retval;
va_list ap;
SDL_Log_REAL("SDL3CALL SDL_snprintf");
va_start(ap, fmt);
retval = SDL_vsnprintf_REAL(buf, maxlen, fmt, ap);
va_end(ap);
return retval;
}
static int SDLCALL SDL_asprintf_LOGSDLCALLS(char **strp, SDL_PRINTF_FORMAT_STRING const char *fmt, ...)
{
int retval;
va_list ap;
SDL_Log_REAL("SDL3CALL SDL_asprintf");
va_start(ap, fmt);
retval = SDL_vasprintf_REAL(strp, fmt, ap);
va_end(ap);
return retval;
}
static int SDLCALL SDL_swprintf_LOGSDLCALLS(SDL_OUT_Z_CAP(maxlen) wchar_t *buf, size_t maxlen, SDL_PRINTF_FORMAT_STRING const wchar_t *fmt, ...)
{
int retval;
va_list ap;
SDL_Log_REAL("SDL3CALL SDL_swprintf");
va_start(ap, fmt);
retval = SDL_vswprintf_REAL(buf, maxlen, fmt, ap);
va_end(ap);
return retval;
}
_static size_t SDLCALL SDL_IOprintf_LOGSDLCALLS(SDL_IOStream *context, SDL_PRINTF_FORMAT_STRING const char *fmt, ...)
{
size_t retval;
va_list ap;
SDL_Log_REAL("SDL3CALL SDL_IOprintf");
va_start(ap, fmt);
retval = SDL_IOvprintf_REAL(context, fmt, ap);
va_end(ap);
return retval;
}
static void SDLCALL SDL_Log_LOGSDLCALLS(SDL_PRINTF_FORMAT_STRING const char *fmt, ...)
{
va_list ap;
SDL_Log_REAL("SDL3CALL SDL_Log");
va_start(ap, fmt);
SDL_LogMessageV_REAL(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO, fmt, ap);
va_end(ap);
}
static void SDLCALL SDL_LogMessage_LOGSDLCALLS(int category, SDL_LogPriority priority, SDL_PRINTF_FORMAT_STRING const char *fmt, ...)
{
va_list ap;
SDL_Log_REAL("SDL3CALL SDL_LogMessage");
va_start(ap, fmt);
SDL_LogMessageV_REAL(category, priority, fmt, ap);
va_end(ap);
}
#define SDL_DYNAPI_VARARGS_LOGFN_LOGSDLCALLS(logname, prio) \
static void SDLCALL SDL_Log##logname##_LOGSDLCALLS(int category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) \
{ \
va_list ap; \
va_start(ap, fmt); \
SDL_Log_REAL("SDL3CALL SDL_Log%s", #logname); \
SDL_LogMessageV_REAL(category, SDL_LOG_PRIORITY_##prio, fmt, ap); \
va_end(ap); \
}
SDL_DYNAPI_VARARGS_LOGFN_LOGSDLCALLS(Verbose, VERBOSE)
SDL_DYNAPI_VARARGS_LOGFN_LOGSDLCALLS(Debug, DEBUG)
SDL_DYNAPI_VARARGS_LOGFN_LOGSDLCALLS(Info, INFO)
SDL_DYNAPI_VARARGS_LOGFN_LOGSDLCALLS(Warn, WARN)
SDL_DYNAPI_VARARGS_LOGFN_LOGSDLCALLS(Error, ERROR)
SDL_DYNAPI_VARARGS_LOGFN_LOGSDLCALLS(Critical, CRITICAL)
#define SDL_DYNAPI_PROC(rc, fn, params, args, ret) \
rc SDLCALL fn##_LOGSDLCALLS params \
{ \
SDL_Log_REAL("SDL3CALL %s", #fn); \
ret fn##_REAL args; \
}
#define SDL_DYNAPI_PROC_NO_VARARGS 1
#include "SDL_dynapi_procs.h"
#undef SDL_DYNAPI_PROC
#undef SDL_DYNAPI_PROC_NO_VARARGS
#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. */
static Sint32 initialize_jumptable(Uint32 apiver, void *table, Uint32 tablesize)
@ -364,25 +259,9 @@ static Sint32 initialize_jumptable(Uint32 apiver, void *table, Uint32 tablesize)
}
/* Init our jump table first. */
#if ENABLE_SDL_CALL_LOGGING
{
const char *env = SDL_getenv_REAL("SDL_DYNAPI_LOG_CALLS");
const SDL_bool log_calls = (env && SDL_atoi_REAL(env));
if (log_calls) {
#define SDL_DYNAPI_PROC(rc, fn, params, args, ret) jump_table.fn = fn##_LOGSDLCALLS;
#include "SDL_dynapi_procs.h"
#undef SDL_DYNAPI_PROC
} else {
#define SDL_DYNAPI_PROC(rc, fn, params, args, ret) jump_table.fn = fn##_REAL;
#include "SDL_dynapi_procs.h"
#undef SDL_DYNAPI_PROC
}
}
#else
#define SDL_DYNAPI_PROC(rc, fn, params, args, ret) jump_table.fn = fn##_REAL;
#include "SDL_dynapi_procs.h"
#undef SDL_DYNAPI_PROC
#endif
/* Then the external table... */
if (output_jump_table != &jump_table) {