On Emscripten, function pointer casts can result in runtime failures due to strict function signature checks. This affects the use of g_list_sort and g_slist_sort, which internally perform function pointer casts that are not supported by Emscripten. To avoid these issues, g_list_sort_with_data and g_slist_sort_with_data should be used instead, as they do not rely on function pointer casting.
Signed-off-by: Kohei Tokunaga <ktokunaga.m...@gmail.com> Reviewed-by: Thomas Huth <th...@redhat.com> --- include/glib-compat.h | 7 +++++++ 1 file changed, 7 insertions(+) V3: - Fixed the multiline comment to ensure it starts with "/*" on a separate line. diff --git a/include/glib-compat.h b/include/glib-compat.h index 86be439ba0..2e32b90f05 100644 --- a/include/glib-compat.h +++ b/include/glib-compat.h @@ -36,6 +36,13 @@ #include <pwd.h> #endif +/* + * These functions perform function pointer casts which can cause function call + * failure on Emscripten. Use g_slist_sort_with_data and g_list_sort_with_data + * instead of these functions. + */ +#pragma GCC poison g_slist_sort g_list_sort + /* * Note that because of the GLIB_VERSION_MAX_ALLOWED constant above, allowing * use of functions from newer GLib via this compat header needs a little -- 2.43.0