when building with clang,find `incompatible function pointer types passing`errors in test-vala-unstable.vala and test-vala-lang.vala
The error information is as follows:
[ 103s] libsecret/test-vala-unstable.p/test-vala-unstable.c:129:59: error: incompatible function pointer types passing 'void (gpointer)' (aka 'void (void *)') to parameter of type 'GTestDataFunc' (aka 'void (*)(const void *)') [-Wincompatible-function-pointer-types]
[ 103s] libsecret/test-vala-lang.p/test-vala-lang.c:1166:51: error: incompatible function pointer types passing 'void (gpointer)' (aka 'void (void *)') to parameter of type 'GTestDataFunc' (aka 'void (*)(const void *)') [-Wincompatible-function-pointer-types]
[ 103s] libsecret/test-vala-lang.p/test-vala-lang.c:1167:52: error: incompatible function pointer types passing 'void (gpointer)' (aka 'void (void *)') to parameter of type 'GTestDataFunc' (aka 'void (*)(const void *)') [-Wincompatible-function-pointer-types]
[ 103s] libsecret/test-vala-lang.p/test-vala-lang.c:1168:54: error: incompatible function pointer types passing 'void (gpointer)' (aka 'void (void *)') to parameter of type 'GTestDataFunc' (aka 'void (*)(const void *)') [-Wincompatible-function-pointer-types]
[ 103s] libsecret/test-vala-lang.p/test-vala-lang.c:1169:50: error: incompatible function pointer types passing 'void (gpointer)' (aka 'void (void *)') to parameter of type 'GTestDataFunc' (aka 'void (*)(const void *)') [-Wincompatible-function-pointer-types]
[ 103s] libsecret/test-vala-lang.p/test-vala-lang.c:1170:51: error: incompatible function pointer types passing 'void (gpointer)' (aka 'void (void *)') to parameter of type 'GTestDataFunc' (aka 'void (*)(const void *)') [-Wincompatible-function-pointer-types]
[ 103s] libsecret/test-vala-lang.p/test-vala-lang.c:1171:50: error: incompatible function pointer types passing 'void (gpointer)' (aka 'void (void *)') to parameter of type 'GTestDataFunc' (aka 'void (*)(const void *)') [-Wincompatible-function-pointer-types]
[ 103s] libsecret/test-vala-lang.p/test-vala-lang.c:1172:51: error: incompatible function pointer types passing 'void (gpointer)' (aka 'void (void *)') to parameter of type 'GTestDataFunc' (aka 'void (*)(const void *)') [-Wincompatible-function-pointer-types]
I finally find the reason of the problems is:
GLib.Test.add_data_func
call to
void g_test_add_data_func (const char *testpath,gconstpointer test_data,GTestDataFunc test_func);
,
but we use it like this in test-vala-unstable.vala,for example:
GLib.Test.add_data_func ("/vala/unstable/read-alias", test_read_alias)
;
so we should change to use GLib.Test.add_func
,it will call to
void g_test_add_func (const char *testpath,GTestFunc test_func);
,
void g_test_add_data_func
and void g_test_add_func
:
See the difference between https://davidingplus.github.io/code-browser/qtbase-6.5.0/include/glib-2.0/glib/gtestutils.h.html
The same change should be applied to test-vala-lang.vala
Best wishes!Hoping for the bug to be fixed!