Re: [Vala] compiler warning for Variant.strv()



Hello,

You can try to use the latest development version of Vala. Most of those
warnings should go away.

https://blogs.gnome.org/despinosa/2018/01/09/vala-warnings-output-improvements/

HTH,

Abderrahim

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

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
_______________________________________________
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]