Fwd: Try to wrap Midnight Commander in Rust
David Haller
dnh at opensuse.org
Sun Aug 15 11:40:33 UTC 2021
Hello,
On Sun, 15 Aug 2021, Yury V. Zaytsev wrote:
>Begin forwarded message:
>> From: Vitold S <vit1251 at gmail.com>
[..]
>> warning: lib/event/manage.c: In function 'mc_event_group_destroy_value':
>> warning: lib/event/manage.c:52:37: warning: cast between incompatible function types from 'void (*)(void *)' to 'void (*)(void *, void *)' [-Wcast-function-type]
>> warning: 52 | g_ptr_array_foreach (callbacks, (GFunc) g_free, NULL);
>> warning: | ^
Just taking the first warning as an example: this has nothing to do
with mc, this is a glib-2 upstream issue. In e.g. glib-2.68.3 we have
these decls:
glib/garray.h: void g_ptr_array_foreach(GPtrArray *array,
GFunc func,
gpointer user_data);
The 'GFunc func' is the function pointer being cast. Also:
glib/gtypes.h: typedef void (*GFunc) (gpointer data,
gpointer user_data);
and
glib/gmem.h: void g_free (gpointer mem);
The only way around these conflicting types (that I see) is an (inlined)
wrapper function around g_free.
Actually, I'd just use '-Wno-cast-function-type' or omit the '-Wextra'.
HTH,
-dnh
--
Human beings, who are almost unique in having the ability to learn from the
experience of others, are also remarkable for their apparent disinclination
to do so. -- Douglas N. Adams, Last Chance To See
More information about the mc-devel
mailing list