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



Daniel, tried with --target-glib=2.44 and the warning stills.

The valac line that generate the error is this:
/usr/bin/valac -C -b /home/fanl/workspace-beyond/software/vatom -d
/home/fanl/workspace-beyond/software/vatom/build --pkg=gio-2.0
--pkg=gee-0.8 --pkg=posix --target-glib=2.44 --thread --debug
/home/fanl/workspace-beyond/software/vatom/src/main.vala
/home/fanl/workspace-beyond/software/vatom/build/atom.vapi

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

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, instead I found this
symbol in the glib headers:
/usr/include/glib-2.0$ ag -i 2_26
glib/gversionmacros.h
39: * GLIB_VERSION_2_26:
46:#define GLIB_VERSION_2_26 (G_ENCODE_VERSION (2, 26))


On Wed, Feb 3, 2016 at 9:57 PM Daniel Espinosa <esodan gmail com> wrote:

If fall in this case, as in GLib.Thread, first check if GLib C
documentation state the API is deprecated. If so, you need to use

*--**target-glib**=**MAJOR*.*MINOR*

to be sure you'll generate code for the GLib version you use or target,
this ensure too, using latest API an avoid valac to generate code
compatible with old glib versions.
El feb. 3, 2016 5:25 PM, "Felipe Lavratti" <felipelav gmail com> escribió:

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));

It means, the `g_test_create_case` arguments of type TestFixtureFunc
which has been depecrated in the glib-2.0.vapi, note the following
lines of the /usr/share/vala-0.30/glib-2.0.vapi file:

#if GLIB_2_26
    [CCode (has_target = false)]
    public delegate void TestFunc ();
    public delegate void TestDataFunc ();
    public delegate void TestFixtureFunc (void* fixture);
#else
    public delegate void TestFunc (void* fixture);
    public delegate void TestDataFunc ();
#endif

The keyword `TestFixtureFunc` has been removed since version 2_26, but
it is still used in the glib-2.0 header
/usr/include/glib-2.0/glib/gtestutils.h:

/* semi-internal API */
GLIB_AVAILABLE_IN_ALL
GTestCase*    g_test_create_case        (const char       *test_name,
                                         gsize             data_size,
                                         gconstpointer     test_data,
                                         GTestFixtureFunc  data_setup,
                                         GTestFixtureFunc  data_test,
                                         GTestFixtureFunc  data_teardown);


--
Skype: felipeanl

_______________________________________________
vala-list mailing list
vala-list gnome org
https://mail.gnome.org/mailman/listinfo/vala-list




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