[Spice-devel,client,v2,3/3] build-sys: Enable deprecation warnings instead of ignoring them entirely

Submitted by Francois Gouget on Dec. 8, 2016, 6:29 a.m.

Details

Message ID alpine.DEB.2.20.1612080658380.7896@amboise
State New
Headers show
Series "Deprecation warning cleanup" ( rev: 11 ) in Spice

Not browsing as part of any series.

Commit Message

Francois Gouget Dec. 8, 2016, 6:29 a.m.
On Thu, 1 Dec 2016, Christophe Fergeau wrote:

> On Thu, Dec 01, 2016 at 04:27:36AM +0100, Francois Gouget wrote:
> > On Wed, 23 Nov 2016, Christophe Fergeau wrote:
> > 
> > > On Wed, Nov 23, 2016 at 07:09:28AM +0100, Francois Gouget wrote:
> > > > For Spice-gtk most deprecation issues come from changes outside Spice
> > > > (GLib) and thus should not be treated as errors to not break
> > > > compilation for users who have newer third-party libraries.
> > > > However they must be visible otherwise Spice developers will not be
> > > > aware of them and thus will not fix them before breakage happens.
> > > 
> > > Also iirc -DXXX_VERSION_MIN_REQUIRED=yyy need deprecation warnings to be
> > > functional
> > 
> > Hmmm, I applied the patch below and I'm getting errors with or without 
> > this patchset.
> > 
> > diff --git a/configure.ac b/configure.ac
> > index f3e7f8d..4661e9f 100644
> > --- a/configure.ac
> > +++ b/configure.ac
> > @@ -136,7 +136,7 @@ AS_IF([test "x$with_gtk" != "xno"],
> >        [AS_IF([test "x$os_win32" = "xyes"],
> >               [PKG_CHECK_MODULES(GTK, gtk+-3.0 >= $GTK_REQUIRED)],
> >               [PKG_CHECK_MODULES(GTK, gtk+-3.0 >= $GTK_REQUIRED epoxy)])]
> > -      [GTK_CFLAGS="$GTK_CFLAGS -DGDK_VERSION_MIN_REQUIRED=$GTK_ENCODED_VERSION \
> > +      [GTK_CFLAGS="$GTK_CFLAGS -DGDK_VERSION_MIN_REQUIRED=4 \
> >                                 -DGDK_VERSION_MAX_ALLOWED=$GTK_ENCODED_VERSION"])
> >  SPICE_GTK_REQUIRES="${SPICE_GTK_REQUIRES} gtk+-3.0 >= $GTK_REQUIRED"
> 
> Dunno, with your patch applied, I'm getting
> channel-webdav.c:317:5: attention : ‘g_output_stream_write_all_finish’
> is deprecated: Not available before 2.44 [-Wdeprecated-declarations]

I was not seeing those because I was missing the libphodav 
development files so that USE_PHODAV was not defined.

Now I get them too. One of the issues is that we compile with 
-DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_36 whereas we would need at 
least ..._2_44. However this would likely require also adding some 
checks in configure.ac to make sure these APIs are available.

I don't think I'm going to really fix those so here's a patch to ignore 
them for now.

Everyone, feel free to submit something better.


commit 1e24dc821e004160fd3793b4029f34f7b5f1379e
Author: Francois Gouget <fgouget@codeweavers.com>
Date:   Thu Dec 8 07:23:35 2016 +0100

    channel-webdav: Temporarily ignore GLib compatibility warnings
    
    A g_inet_socket_xxx() function requires GLib 2.40 while a couple of
    g_output_stream_xxx() functions require GLib 2.44 but we only request
    GLib 2.36.
    
    Signed-off-by: Francois Gouget <fgouget@codeweavers.com>

Patch hide | download patch | download mbox

diff --git a/src/channel-webdav.c b/src/channel-webdav.c
index 4ecc769..f45d70e 100644
--- a/src/channel-webdav.c
+++ b/src/channel-webdav.c
@@ -314,7 +314,10 @@  static void demux_to_client_cb(GObject *source, GAsyncResult *result, gpointer u
     gboolean fail;
     gsize size;
 
+    /* FIXME: g_output_stream_write_all_finish requires GLib 2.44 or greater */
+    G_GNUC_BEGIN_IGNORE_DEPRECATIONS
     g_output_stream_write_all_finish(G_OUTPUT_STREAM(source), result, &size, &error);
+    G_GNUC_END_IGNORE_DEPRECATIONS
 
     if (error) {
         CHANNEL_DEBUG(client->self, "write failed: %s", error->message);
@@ -336,9 +339,12 @@  static void demux_to_client(Client *client)
     CHANNEL_DEBUG(client->self, "pushing %"G_GSIZE_FORMAT" to client %p", size, client);
 
     if (size > 0) {
+        /* FIXME: g_output_stream_write_all_async requires GLib 2.44 or greater */
+        G_GNUC_BEGIN_IGNORE_DEPRECATIONS
         g_output_stream_write_all_async(g_io_stream_get_output_stream(client->pipe),
                                         c->demux.buf, size, G_PRIORITY_DEFAULT,
                                         c->cancellable, demux_to_client_cb, client);
+        G_GNUC_END_IGNORE_DEPRECATIONS
         return;
     } else {
         /* Nothing to write */
@@ -372,7 +378,10 @@  static void start_client(SpiceWebdavChannel *self)
     client->cancellable = g_cancellable_new();
     spice_make_pipe(&client->pipe, &peer);
 
+    /* FIXME: g_inet_socket_address_new_from_string requires GLib 2.40 or greater */
+    G_GNUC_BEGIN_IGNORE_DEPRECATIONS
     addr = g_inet_socket_address_new_from_string ("127.0.0.1", 0);
+    G_GNUC_END_IGNORE_DEPRECATIONS
     if (!soup_server_accept_iostream(server, peer, addr, addr, &error))
         goto fail;
 

Comments

On Thu, Dec 08, 2016 at 07:29:18AM +0100, Francois Gouget wrote:
> On Thu, 1 Dec 2016, Christophe Fergeau wrote:
> 
> > On Thu, Dec 01, 2016 at 04:27:36AM +0100, Francois Gouget wrote:
> > > On Wed, 23 Nov 2016, Christophe Fergeau wrote:
> > > 
> > > > On Wed, Nov 23, 2016 at 07:09:28AM +0100, Francois Gouget wrote:
> > > > > For Spice-gtk most deprecation issues come from changes outside Spice
> > > > > (GLib) and thus should not be treated as errors to not break
> > > > > compilation for users who have newer third-party libraries.
> > > > > However they must be visible otherwise Spice developers will not be
> > > > > aware of them and thus will not fix them before breakage happens.
> > > > 
> > > > Also iirc -DXXX_VERSION_MIN_REQUIRED=yyy need deprecation warnings to be
> > > > functional
> > > 
> > > Hmmm, I applied the patch below and I'm getting errors with or without 
> > > this patchset.
> > > 
> > > diff --git a/configure.ac b/configure.ac
> > > index f3e7f8d..4661e9f 100644
> > > --- a/configure.ac
> > > +++ b/configure.ac
> > > @@ -136,7 +136,7 @@ AS_IF([test "x$with_gtk" != "xno"],
> > >        [AS_IF([test "x$os_win32" = "xyes"],
> > >               [PKG_CHECK_MODULES(GTK, gtk+-3.0 >= $GTK_REQUIRED)],
> > >               [PKG_CHECK_MODULES(GTK, gtk+-3.0 >= $GTK_REQUIRED epoxy)])]
> > > -      [GTK_CFLAGS="$GTK_CFLAGS -DGDK_VERSION_MIN_REQUIRED=$GTK_ENCODED_VERSION \
> > > +      [GTK_CFLAGS="$GTK_CFLAGS -DGDK_VERSION_MIN_REQUIRED=4 \
> > >                                 -DGDK_VERSION_MAX_ALLOWED=$GTK_ENCODED_VERSION"])
> > >  SPICE_GTK_REQUIRES="${SPICE_GTK_REQUIRES} gtk+-3.0 >= $GTK_REQUIRED"
> > 
> > Dunno, with your patch applied, I'm getting
> > channel-webdav.c:317:5: attention : ‘g_output_stream_write_all_finish’
> > is deprecated: Not available before 2.44 [-Wdeprecated-declarations]
> 
> I was not seeing those because I was missing the libphodav 
> development files so that USE_PHODAV was not defined.
> 
> Now I get them too. One of the issues is that we compile with 
> -DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_36 whereas we would need at 
> least ..._2_44. However this would likely require also adding some 
> checks in configure.ac to make sure these APIs are available.
> 
> I don't think I'm going to really fix those so here's a patch to ignore 
> them for now.

Oh, I was not suggesting that you fix these now ;) I was just pointing
out that minimum version required and -Wdeprecated-declarations are
related. Iirc, the phodav support is disabled if glib is too old, so we
should be fine with just disabling.

Christophe

> 
> Everyone, feel free to submit something better.
> 
> 
> commit 1e24dc821e004160fd3793b4029f34f7b5f1379e
> Author: Francois Gouget <fgouget@codeweavers.com>
> Date:   Thu Dec 8 07:23:35 2016 +0100
> 
>     channel-webdav: Temporarily ignore GLib compatibility warnings
>     
>     A g_inet_socket_xxx() function requires GLib 2.40 while a couple of
>     g_output_stream_xxx() functions require GLib 2.44 but we only request
>     GLib 2.36.
>     
>     Signed-off-by: Francois Gouget <fgouget@codeweavers.com>
> 
> diff --git a/src/channel-webdav.c b/src/channel-webdav.c
> index 4ecc769..f45d70e 100644
> --- a/src/channel-webdav.c
> +++ b/src/channel-webdav.c
> @@ -314,7 +314,10 @@ static void demux_to_client_cb(GObject *source, GAsyncResult *result, gpointer u
>      gboolean fail;
>      gsize size;
>  
> +    /* FIXME: g_output_stream_write_all_finish requires GLib 2.44 or greater */
> +    G_GNUC_BEGIN_IGNORE_DEPRECATIONS
>      g_output_stream_write_all_finish(G_OUTPUT_STREAM(source), result, &size, &error);
> +    G_GNUC_END_IGNORE_DEPRECATIONS
>  
>      if (error) {
>          CHANNEL_DEBUG(client->self, "write failed: %s", error->message);
> @@ -336,9 +339,12 @@ static void demux_to_client(Client *client)
>      CHANNEL_DEBUG(client->self, "pushing %"G_GSIZE_FORMAT" to client %p", size, client);
>  
>      if (size > 0) {
> +        /* FIXME: g_output_stream_write_all_async requires GLib 2.44 or greater */
> +        G_GNUC_BEGIN_IGNORE_DEPRECATIONS
>          g_output_stream_write_all_async(g_io_stream_get_output_stream(client->pipe),
>                                          c->demux.buf, size, G_PRIORITY_DEFAULT,
>                                          c->cancellable, demux_to_client_cb, client);
> +        G_GNUC_END_IGNORE_DEPRECATIONS
>          return;
>      } else {
>          /* Nothing to write */
> @@ -372,7 +378,10 @@ static void start_client(SpiceWebdavChannel *self)
>      client->cancellable = g_cancellable_new();
>      spice_make_pipe(&client->pipe, &peer);
>  
> +    /* FIXME: g_inet_socket_address_new_from_string requires GLib 2.40 or greater */
> +    G_GNUC_BEGIN_IGNORE_DEPRECATIONS
>      addr = g_inet_socket_address_new_from_string ("127.0.0.1", 0);
> +    G_GNUC_END_IGNORE_DEPRECATIONS
>      if (!soup_server_accept_iostream(server, peer, addr, addr, &error))
>          goto fail;
>  
> 
> -- 
> Francois Gouget <fgouget@codeweavers.com>