From 2a69525c4e55efa9f489edace2f44842f4c48781 Mon Sep 17 00:00:00 2001
From: Anonymous Maarten <[EMAIL REDACTED]>
Date: Sun, 23 Nov 2025 22:54:28 +0100
Subject: [PATCH] Build with -Wno-unused-parameter
---
cmake/PrivateSdlFunctions.cmake | 2 +-
src/SDL_gpu_textengine.c | 5 +----
src/SDL_hashtable_ttf.c | 6 ++----
src/SDL_renderer_textengine.c | 5 +----
src/SDL_surface_textengine.c | 5 +----
src/SDL_ttf.c | 16 ----------------
6 files changed, 6 insertions(+), 33 deletions(-)
diff --git a/cmake/PrivateSdlFunctions.cmake b/cmake/PrivateSdlFunctions.cmake
index 0312faa1..8d71ede0 100644
--- a/cmake/PrivateSdlFunctions.cmake
+++ b/cmake/PrivateSdlFunctions.cmake
@@ -310,7 +310,7 @@ function(sdl_add_warning_options TARGET)
if(MSVC)
target_compile_options(${TARGET} PRIVATE /W2)
else()
- target_compile_options(${TARGET} PRIVATE -Wall -Wextra)
+ target_compile_options(${TARGET} PRIVATE -Wall -Wextra -Wno-unused-parameter)
endif()
if(ARGS_WARNING_AS_ERROR)
if(MSVC)
diff --git a/src/SDL_gpu_textengine.c b/src/SDL_gpu_textengine.c
index 5dad956e..76b58442 100644
--- a/src/SDL_gpu_textengine.c
+++ b/src/SDL_gpu_textengine.c
@@ -872,11 +872,9 @@ static void DestroyEngineData(TTF_GPUTextEngineData *data)
SDL_free(data);
}
-static void SDLCALL NukeFontData(void *unused, const void *key, const void *value)
+static void SDLCALL NukeFontData(void *userdata, const void *key, const void *value)
{
TTF_GPUTextEngineFontData *data = (TTF_GPUTextEngineFontData *)value;
- (void)key;
- (void)unused;
DestroyFontData(data);
}
@@ -938,7 +936,6 @@ static void SDLCALL DestroyText(void *userdata, TTF_Text *text)
{
TTF_GPUTextEngineTextData *data = (TTF_GPUTextEngineTextData *)text->internal->engine_text;
- (void)userdata;
DestroyTextData(data);
}
diff --git a/src/SDL_hashtable_ttf.c b/src/SDL_hashtable_ttf.c
index d5b2ac7e..b714ad13 100644
--- a/src/SDL_hashtable_ttf.c
+++ b/src/SDL_hashtable_ttf.c
@@ -28,15 +28,13 @@ typedef struct GlyphHashtableKey {
Uint32 glyph_index;
} GlyphHashtableKey;
-static Uint32 SDLCALL SDL_HashGlyphHashtableKey(void *unused, const void *key)
+static Uint32 SDLCALL SDL_HashGlyphHashtableKey(void *userdata, const void *key)
{
- (void)unused;
return SDL_murmur3_32(key, sizeof(GlyphHashtableKey), 0);
}
-static bool SDLCALL SDL_KeyMatchGlyphHashtableKey(void *unused, const void *a, const void *b)
+static bool SDLCALL SDL_KeyMatchGlyphHashtableKey(void *userdata, const void *a, const void *b)
{
- (void)unused;
GlyphHashtableKey *A = (GlyphHashtableKey *)a;
GlyphHashtableKey *B = (GlyphHashtableKey *)b;
return (A->font == B->font && A->glyph_index == B->glyph_index);
diff --git a/src/SDL_renderer_textengine.c b/src/SDL_renderer_textengine.c
index 165486e3..b150e4a4 100644
--- a/src/SDL_renderer_textengine.c
+++ b/src/SDL_renderer_textengine.c
@@ -786,11 +786,9 @@ static void DestroyEngineData(TTF_RendererTextEngineData *data)
SDL_free(data);
}
-static void SDLCALL NukeFontData(void *unused, const void *key, const void *value)
+static void SDLCALL NukeFontData(void *userdata, const void *key, const void *value)
{
TTF_RendererTextEngineFontData *data = (TTF_RendererTextEngineFontData *)value;
- (void)key;
- (void)unused;
DestroyFontData(data);
}
@@ -851,7 +849,6 @@ static void SDLCALL DestroyText(void *userdata, TTF_Text *text)
{
TTF_RendererTextEngineTextData *data = (TTF_RendererTextEngineTextData *)text->internal->engine_text;
- (void)userdata;
DestroyTextData(data);
}
diff --git a/src/SDL_surface_textengine.c b/src/SDL_surface_textengine.c
index 41c01a9c..b788db62 100644
--- a/src/SDL_surface_textengine.c
+++ b/src/SDL_surface_textengine.c
@@ -209,11 +209,9 @@ static void DestroyEngineData(TTF_SurfaceTextEngineData *data)
SDL_free(data);
}
-static void SDLCALL NukeFontData(void *unused, const void *key, const void *value)
+static void SDLCALL NukeFontData(void *userdata, const void *key, const void *value)
{
TTF_SurfaceTextEngineFontData *data = (TTF_SurfaceTextEngineFontData *)value;
- (void)key;
- (void)unused;
DestroyFontData(data);
}
@@ -264,7 +262,6 @@ static void SDLCALL DestroyText(void *userdata, TTF_Text *text)
{
TTF_SurfaceTextEngineTextData *data = (TTF_SurfaceTextEngineTextData *)text->internal->engine_text;
- (void)userdata;
DestroyTextData(data);
}
diff --git a/src/SDL_ttf.c b/src/SDL_ttf.c
index ce4fe6bb..54ce8ccb 100644
--- a/src/SDL_ttf.c
+++ b/src/SDL_ttf.c
@@ -2254,9 +2254,6 @@ static bool RemoveFontTextReference(TTF_Font *font, TTF_Text *text)
static bool SDLCALL UpdateFontTextCallback(void *userdata, const SDL_HashTable *table, const void *key, const void *value)
{
TTF_Text *text = (TTF_Text *)key;
- (void)userdata;
- (void)table;
- (void)value;
text->internal->needs_layout_update = true;
return true;
}
@@ -2470,9 +2467,6 @@ static void Flush_Glyph(c_glyph *glyph)
static bool SDLCALL FlushCacheCallback(void *userdata, const SDL_HashTable *table, const void *key, const void *value)
{
c_glyph *glyph = (c_glyph *)value;
- (void)userdata;
- (void)table;
- (void)key;
if (glyph->stored) {
Flush_Glyph(glyph);
}
@@ -3386,8 +3380,6 @@ static bool CollectGlyphsFromFont(TTF_Font *font, const char *text, size_t lengt
hb_buffer_destroy(hb_buffer);
#else
- (void)direction;
- (void)script;
bool skip_first = true;
FT_UInt prev_index = 0;
FT_Pos prev_delta = 0;
@@ -4774,7 +4766,6 @@ bool TTF_SetTextScript(TTF_Text *text, Uint32 script)
text->internal->needs_layout_update = true;
return true;
#else
- (void) script;
return SDL_Unsupported();
#endif
}
@@ -5804,7 +5795,6 @@ bool TTF_SetFontSDF(TTF_Font *font, bool enabled)
}
return true;
#else
- (void)enabled;
return SDL_SetError("SDL_ttf compiled without SDF support");
#endif
}
@@ -6042,7 +6032,6 @@ bool TTF_SetFontScript(TTF_Font *font, Uint32 script)
UpdateFontText(font, NULL);
return true;
#else
- (void) script;
return SDL_Unsupported();
#endif
}
@@ -6080,8 +6069,6 @@ Uint32 TTF_GetGlyphScript(Uint32 ch)
script = hb_script_to_iso15924_tag(hb_unicode_script(hb_unicode_functions, ch));
hb_buffer_destroy(hb_buffer);
-#else
- (void)ch;
#endif
if (script == 0) {
@@ -6110,7 +6097,6 @@ bool TTF_SetFontLanguage(TTF_Font *font, const char *language_bcp47)
UpdateFontText(font, NULL);
return true;
#else
- (void) language_bcp47;
return SDL_Unsupported();
#endif
}
@@ -6119,8 +6105,6 @@ static bool RemoveOneTextCallback(void *userdata, const SDL_HashTable *table, co
{
TTF_Font *font = (TTF_Font *)userdata;
TTF_Text *text = (TTF_Text *)key;
- (void)table;
- (void)value;
if (text->internal->font == font) {
TTF_SetTextFont(text, NULL);
} else {