Fixing Vala application build error with GCC 14

A Vala application I maintain began to cause errors when I started compiling it with GCC 14:

lcdgrilo.c:315:33: warning: assignment to ‘gchar **’ {aka ‘char **’} from incompatible pointer type ‘const char **’ [-Wincompatible-pointer-types]
  315 |                 _tmp3_ = _tmp2_ = grl_source_get_tags (source);
      |                                 ^
In file included from /usr/include/glib-2.0/glib/gthread.h:34,
                 from /usr/include/glib-2.0/glib/gasyncqueue.h:34,
                 from /usr/include/glib-2.0/glib.h:34,
                 from lcdgrilo.c:26:

While I could mark this as a warning instead using a GCC flag, I would like to continue using the default GCC flags of my build system (OpenWrt).

I am using Vala 0.56.17 as provided by Fedora 41.

This appears to be the offending Vala code:

var registry = Grl.Registry.get_default ();

                registry.source_added.connect((source) => {
                        if ((source.get_supported_operations() & Grl.SupportedOps.BROWSE) == 0)
                                return;

                        if (tag != null) {
                                if (! (tag in source.get_tags()))
                                        return;
                        }
                        // ...

The corresponding C that triggers the warning is:

_tmp0_ = tag;
        if (_tmp0_ != NULL) {
                const gchar* _tmp1_;
                gchar** _tmp2_;
                gchar** _tmp3_;
                _tmp1_ = tag;
                _tmp3_ = _tmp2_ = grl_source_get_tags (source);
                if (!_vala_string_array_contains (_tmp3_, _vala_array_length (_tmp2_), _tmp1_)) {
                        return;
                }
        }

Is there something I can do to resolve this? Is there a problem in Grilo’s .vapi file? Or, are these warnings expected with the current version of Vala?

See also lcdgrilo does not compile with GCC14 · Issue #25327 · openwrt/packages · GitHub.

The API appears to be correct as per the docs.

const char ** grl_source_get_tags (GrlSource *source);

So, this is probably an issue with vala code generator, possibly https://gitlab.gnome.org/GNOME/vala/-/issues/1546.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.