[Vala] compiler warning for Variant.strv()



Hi,

I have a code snippet which gets incompatible pointer type warning
from gcc.

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


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