Re: [Vala] glib-2.0 - glib-2.0.vapi mismatch bug: TestFixtureFunc vs TestFunc



 ----- Original Message -----

 From: Felipe Lavratti <felipelav gmail com>
 Sent: Thursday, 4 February 2016, 0:21
 Subject: Re: [Vala] glib-2.0 - glib-2.0.vapi mismatch bug: TestFixtureFunc vs TestFunc

 The thing is, glib 2.44 _does uses_ the GTestFixtureFunc type, but the
 vala.api does not, have a look here:
 http://ftp.gnome.org/pub/gnome/sources/glib/2.44/glib-2.44.0.tar.xz 
 /glib-2.44.0/glib/gtestsutil.h
 
 
Yes, GTestFixtureFunc was introduced in GLib 2.25.12:
https://git.gnome.org/browse/glib/commit/?h=2.25.12&id=7791fce38a1a7d292e94d3bb5a0ffb8d6da9333dSo 
you need stable version 2.26+
 
 I think that in the glib-2.0.vapi file the test macro `#if GLIB_2_26` is
 failing because the symbol `GLIB_2_26` is not defined
 
 
Yes, valac currently targets 2.24 as the default:
https://git.gnome.org/browse/vala/tree/compiler/valacompiler.vala#n274
It is down to the developer to target the version they need
so you need to give --target-glib=MAJOR.MINOR
 
 
 
 

  Hello, using the glib-2.0 `GLib.TestCase` constructor triggers the
 following warning:>>> 
  warning: passing argument 4 of ‘g_test_create_case’ from incompatible
  pointer type
               ts.add(new TestCase("context", (TestFunc)setup,
  (TestFunc)test_context, (TestFunc)teardown));

 
 
After this I also get:
/usr/include/glib-2.0/glib/gtestutils.h:268:15: note: expected ‘GTestFixtureFunc 
{aka void (*)(void *, const void *)}’ but argument is of type ‘void (*)(void *, void *)’
By default delegates in Vala expect a target (user data). GTestFixtureFunc expects this
to be a gconstpointer. I'm not sure there is a way to easily change this in the binding. 
So you may just have to live with the warning.
 
Al


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]