> On Thursday, 25 January 2018, 11:19:44 GMT, Abderrahim Kitouni 
> <a.kito...@gmail.com> wrote: 
> You can try to use the latest development version of Vala. Most of those
> warnings should go away.

Unfortunately that isn't fixed in this case.
The g_variant_new_strv has a C type signature for the array of strings as:const 
gchar * const *strv
See 
https://developer.gnome.org/glib/stable/glib-GVariant.html#g-variant-new-strv
and Vala is generating the type as gchar**. Still two levels of indirection, 
but not similarenough for the compiler. I'm not aware of a way of explicitly 
setting the C type of an array in a Vala binding. The "Legacy Bindings" 
document references array lengthsa lot, but not the type of array:
https://wiki.gnome.org/Projects/Vala/LegacyBindings


On Thu, 25 Jan 2018, 11:32 Yasushi SHOJI, <yasushi.sh...@gmail.com> wrote:

> Is there anyway to fix this except "-Wno-incompatible-pointer-types"?
>
>
> $ cat a.vala
> using Gee;
>
> void main () {
>        Variant ary = new Variant.strv({"foo", "bar", "baz"});
> }
>
>
> $ valac --pkg gee-0.8 a.vala --no-color
> a.vala:4.11-4.55: warning: local variable `ary' declared but never used
>        Variant ary = new Variant.strv({"foo", "bar", "baz"});
>                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> /tmp/a.vala.c: In function ‘_vala_main’:
> /tmp/a.vala.c:38:31: warning: passing argument 1 of
> ‘g_variant_new_strv’ from incompatible pointer type
> [-Wincompatible-pointer-types]
>  _tmp5_ = g_variant_new_strv (_tmp4_, 3);
>                                ^~~~~~
> In file included from /usr/include/glib-2.0/glib/gmessages.h:35:0,
>                  from /usr/include/glib-2.0/glib.h:62,
>                  from /tmp/a.vala.c:5:
> /usr/include/glib-2.0/glib/gvariant.h:118:33: note: expected ‘const
> gchar * const* {aka const char * const*}’ but argument is of type
> ‘gchar ** {aka char **}’
>  GVariant *                      g_variant_new_strv
>  (const gchar * const  *strv,
>                                  ^~~~~~~~~~~~~~~~~~
> Compilation succeeded - 1 warning(s)
> --

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

Reply via email to