[Spice-devel] server: Disable deprecation warnings only where needed

Submitted by Francois Gouget on Nov. 23, 2016, 5:48 a.m.

Details

Message ID E1c9QPu-0002DE-5x@amboise
State New
Headers show
Series "server: Disable deprecation warnings only where needed" ( rev: 1 ) in Spice

Not browsing as part of any series.

Commit Message

Francois Gouget Nov. 23, 2016, 5:48 a.m.
Signed-off-by: Francois Gouget <fgouget@codeweavers.com>
---
 server/red-qxl.c        |  2 ++
 server/red-replay-qxl.c | 10 ++++++++++
 server/reds-stream.c    |  2 ++
 server/spice-core.h     |  4 ----
 4 files changed, 14 insertions(+), 4 deletions(-)

Patch hide | download patch | download mbox

diff --git a/server/red-qxl.c b/server/red-qxl.c
index 19cff95..2ca2537 100644
--- a/server/red-qxl.c
+++ b/server/red-qxl.c
@@ -977,6 +977,7 @@  void red_qxl_init(RedsState *reds, QXLInstance *qxl)
     qxl_state->dispatcher = dispatcher_new(RED_WORKER_MESSAGE_COUNT, NULL);
     qxl_state->qxl_worker.major_version = SPICE_INTERFACE_QXL_MAJOR;
     qxl_state->qxl_worker.minor_version = SPICE_INTERFACE_QXL_MINOR;
+    G_GNUC_BEGIN_IGNORE_DEPRECATIONS
     qxl_state->qxl_worker.wakeup = qxl_worker_wakeup;
     qxl_state->qxl_worker.oom = qxl_worker_oom;
     qxl_state->qxl_worker.start = qxl_worker_start;
@@ -993,6 +994,7 @@  void red_qxl_init(RedsState *reds, QXLInstance *qxl)
     qxl_state->qxl_worker.reset_cursor = qxl_worker_reset_cursor;
     qxl_state->qxl_worker.destroy_surface_wait = qxl_worker_destroy_surface_wait;
     qxl_state->qxl_worker.loadvm_commands = qxl_worker_loadvm_commands;
+    G_GNUC_END_IGNORE_DEPRECATIONS
 
     qxl_state->max_monitors = UINT_MAX;
     qxl->st = qxl_state;
diff --git a/server/red-replay-qxl.c b/server/red-replay-qxl.c
index 2176068..360e8f5 100644
--- a/server/red-replay-qxl.c
+++ b/server/red-replay-qxl.c
@@ -1241,7 +1241,9 @@  static void replay_handle_create_primary(QXLWorker *worker, SpiceReplay *replay)
         spice_printerr(
             "WARNING: %d: original recording event not preceded by a destroy primary",
             replay->counter);
+        G_GNUC_BEGIN_IGNORE_DEPRECATIONS
         worker->destroy_primary_surface(worker, 0);
+        G_GNUC_END_IGNORE_DEPRECATIONS
     }
     replay->created_primary = TRUE;
 
@@ -1255,7 +1257,9 @@  static void replay_handle_create_primary(QXLWorker *worker, SpiceReplay *replay)
     read_binary(replay, "data", &size, &mem, 0);
     surface.group_id = 0;
     surface.mem = QXLPHYSICAL_FROM_PTR(mem);
+    G_GNUC_BEGIN_IGNORE_DEPRECATIONS
     worker->create_primary_surface(worker, 0, &surface);
+    G_GNUC_END_IGNORE_DEPRECATIONS
 }
 
 static void replay_handle_dev_input(QXLWorker *worker, SpiceReplay *replay,
@@ -1264,15 +1268,21 @@  static void replay_handle_dev_input(QXLWorker *worker, SpiceReplay *replay,
     switch (message) {
     case RED_WORKER_MESSAGE_CREATE_PRIMARY_SURFACE:
     case RED_WORKER_MESSAGE_CREATE_PRIMARY_SURFACE_ASYNC:
+        G_GNUC_BEGIN_IGNORE_DEPRECATIONS
         replay_handle_create_primary(worker, replay);
+        G_GNUC_END_IGNORE_DEPRECATIONS
         break;
     case RED_WORKER_MESSAGE_DESTROY_PRIMARY_SURFACE:
         replay->created_primary = FALSE;
+        G_GNUC_BEGIN_IGNORE_DEPRECATIONS
         worker->destroy_primary_surface(worker, 0);
+        G_GNUC_END_IGNORE_DEPRECATIONS
         break;
     case RED_WORKER_MESSAGE_DESTROY_SURFACES:
         replay->created_primary = FALSE;
+        G_GNUC_BEGIN_IGNORE_DEPRECATIONS
         worker->destroy_surfaces(worker);
+        G_GNUC_END_IGNORE_DEPRECATIONS
         break;
     case RED_WORKER_MESSAGE_UPDATE:
         // XXX do anything? we record the correct bitmaps already.
diff --git a/server/reds-stream.c b/server/reds-stream.c
index 9896eab..1f95b13 100644
--- a/server/reds-stream.c
+++ b/server/reds-stream.c
@@ -358,10 +358,12 @@  static void reds_stream_set_socket(RedsStream *stream, int socket)
 {
     stream->socket = socket;
     /* deprecated fields. Filling them for backward compatibility */
+    G_GNUC_BEGIN_IGNORE_DEPRECATIONS
     stream->priv->info->llen = sizeof(stream->priv->info->laddr);
     stream->priv->info->plen = sizeof(stream->priv->info->paddr);
     getsockname(stream->socket, (struct sockaddr*)(&stream->priv->info->laddr), &stream->priv->info->llen);
     getpeername(stream->socket, (struct sockaddr*)(&stream->priv->info->paddr), &stream->priv->info->plen);
+    G_GNUC_END_IGNORE_DEPRECATIONS
 
     stream->priv->info->flags |= SPICE_CHANNEL_EVENT_FLAG_ADDR_EXT;
     stream->priv->info->llen_ext = sizeof(stream->priv->info->laddr_ext);
diff --git a/server/spice-core.h b/server/spice-core.h
index 4d8f2ed..dfd24ab 100644
--- a/server/spice-core.h
+++ b/server/spice-core.h
@@ -28,10 +28,6 @@ 
 #include <spice/vd_agent.h>
 #include <spice/macros.h>
 
-#ifdef SPICE_SERVER_INTERNAL
-#undef SPICE_GNUC_DEPRECATED
-#define SPICE_GNUC_DEPRECATED
-#endif
 
 /* interface base type */
 

Comments

On Wed, Nov 23, 2016 at 06:48:22AM +0100, Francois Gouget wrote:
> Signed-off-by: Francois Gouget <fgouget@codeweavers.com>
> ---
>  server/red-qxl.c        |  2 ++
>  server/red-replay-qxl.c | 10 ++++++++++
>  server/reds-stream.c    |  2 ++
>  server/spice-core.h     |  4 ----
>  4 files changed, 14 insertions(+), 4 deletions(-)
> 
> diff --git a/server/spice-core.h b/server/spice-core.h
> index 4d8f2ed..dfd24ab 100644
> --- a/server/spice-core.h
> +++ b/server/spice-core.h
> @@ -28,10 +28,6 @@
>  #include <spice/vd_agent.h>
>  #include <spice/macros.h>
>  
> -#ifdef SPICE_SERVER_INTERNAL
> -#undef SPICE_GNUC_DEPRECATED
> -#define SPICE_GNUC_DEPRECATED
> -#endif
>  
>  /* interface base type */
>  

This hunk you remove is there so that we ignore internal deprecations,
imo it's ok to have, I'll assume we are not going to add usage of
deprecated functions ourselves. As usual, a slightly longer rationale in
the commit log would be better than just a shortlog.

Christophe

> diff --git a/server/red-qxl.c b/server/red-qxl.c
> index 19cff95..2ca2537 100644
> --- a/server/red-qxl.c
> +++ b/server/red-qxl.c
> @@ -977,6 +977,7 @@ void red_qxl_init(RedsState *reds, QXLInstance *qxl)
>      qxl_state->dispatcher = dispatcher_new(RED_WORKER_MESSAGE_COUNT, NULL);
>      qxl_state->qxl_worker.major_version = SPICE_INTERFACE_QXL_MAJOR;
>      qxl_state->qxl_worker.minor_version = SPICE_INTERFACE_QXL_MINOR;
> +    G_GNUC_BEGIN_IGNORE_DEPRECATIONS
>      qxl_state->qxl_worker.wakeup = qxl_worker_wakeup;
>      qxl_state->qxl_worker.oom = qxl_worker_oom;
>      qxl_state->qxl_worker.start = qxl_worker_start;
> @@ -993,6 +994,7 @@ void red_qxl_init(RedsState *reds, QXLInstance *qxl)
>      qxl_state->qxl_worker.reset_cursor = qxl_worker_reset_cursor;
>      qxl_state->qxl_worker.destroy_surface_wait = qxl_worker_destroy_surface_wait;
>      qxl_state->qxl_worker.loadvm_commands = qxl_worker_loadvm_commands;
> +    G_GNUC_END_IGNORE_DEPRECATIONS
>  
>      qxl_state->max_monitors = UINT_MAX;
>      qxl->st = qxl_state;
> diff --git a/server/red-replay-qxl.c b/server/red-replay-qxl.c
> index 2176068..360e8f5 100644
> --- a/server/red-replay-qxl.c
> +++ b/server/red-replay-qxl.c
> @@ -1241,7 +1241,9 @@ static void replay_handle_create_primary(QXLWorker *worker, SpiceReplay *replay)
>          spice_printerr(
>              "WARNING: %d: original recording event not preceded by a destroy primary",
>              replay->counter);
> +        G_GNUC_BEGIN_IGNORE_DEPRECATIONS
>          worker->destroy_primary_surface(worker, 0);
> +        G_GNUC_END_IGNORE_DEPRECATIONS
>      }
>      replay->created_primary = TRUE;
>  
> @@ -1255,7 +1257,9 @@ static void replay_handle_create_primary(QXLWorker *worker, SpiceReplay *replay)
>      read_binary(replay, "data", &size, &mem, 0);
>      surface.group_id = 0;
>      surface.mem = QXLPHYSICAL_FROM_PTR(mem);
> +    G_GNUC_BEGIN_IGNORE_DEPRECATIONS
>      worker->create_primary_surface(worker, 0, &surface);
> +    G_GNUC_END_IGNORE_DEPRECATIONS
>  }
>  
>  static void replay_handle_dev_input(QXLWorker *worker, SpiceReplay *replay,
> @@ -1264,15 +1268,21 @@ static void replay_handle_dev_input(QXLWorker *worker, SpiceReplay *replay,
>      switch (message) {
>      case RED_WORKER_MESSAGE_CREATE_PRIMARY_SURFACE:
>      case RED_WORKER_MESSAGE_CREATE_PRIMARY_SURFACE_ASYNC:
> +        G_GNUC_BEGIN_IGNORE_DEPRECATIONS
>          replay_handle_create_primary(worker, replay);
> +        G_GNUC_END_IGNORE_DEPRECATIONS
>          break;
>      case RED_WORKER_MESSAGE_DESTROY_PRIMARY_SURFACE:
>          replay->created_primary = FALSE;
> +        G_GNUC_BEGIN_IGNORE_DEPRECATIONS
>          worker->destroy_primary_surface(worker, 0);
> +        G_GNUC_END_IGNORE_DEPRECATIONS
>          break;
>      case RED_WORKER_MESSAGE_DESTROY_SURFACES:
>          replay->created_primary = FALSE;
> +        G_GNUC_BEGIN_IGNORE_DEPRECATIONS
>          worker->destroy_surfaces(worker);
> +        G_GNUC_END_IGNORE_DEPRECATIONS
>          break;
>      case RED_WORKER_MESSAGE_UPDATE:
>          // XXX do anything? we record the correct bitmaps already.
> diff --git a/server/reds-stream.c b/server/reds-stream.c
> index 9896eab..1f95b13 100644
> --- a/server/reds-stream.c
> +++ b/server/reds-stream.c
> @@ -358,10 +358,12 @@ static void reds_stream_set_socket(RedsStream *stream, int socket)
>  {
>      stream->socket = socket;
>      /* deprecated fields. Filling them for backward compatibility */
> +    G_GNUC_BEGIN_IGNORE_DEPRECATIONS
>      stream->priv->info->llen = sizeof(stream->priv->info->laddr);
>      stream->priv->info->plen = sizeof(stream->priv->info->paddr);
>      getsockname(stream->socket, (struct sockaddr*)(&stream->priv->info->laddr), &stream->priv->info->llen);
>      getpeername(stream->socket, (struct sockaddr*)(&stream->priv->info->paddr), &stream->priv->info->plen);
> +    G_GNUC_END_IGNORE_DEPRECATIONS
>  
>      stream->priv->info->flags |= SPICE_CHANNEL_EVENT_FLAG_ADDR_EXT;
>      stream->priv->info->llen_ext = sizeof(stream->priv->info->laddr_ext);
> -- 
> 2.10.1
> _______________________________________________
> Spice-devel mailing list
> Spice-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/spice-devel
> 
> On Wed, Nov 23, 2016 at 06:48:22AM +0100, Francois Gouget wrote:
> > Signed-off-by: Francois Gouget <fgouget@codeweavers.com>
> > ---
> >  server/red-qxl.c        |  2 ++
> >  server/red-replay-qxl.c | 10 ++++++++++
> >  server/reds-stream.c    |  2 ++
> >  server/spice-core.h     |  4 ----
> >  4 files changed, 14 insertions(+), 4 deletions(-)
> > 
> > diff --git a/server/spice-core.h b/server/spice-core.h
> > index 4d8f2ed..dfd24ab 100644
> > --- a/server/spice-core.h
> > +++ b/server/spice-core.h
> > @@ -28,10 +28,6 @@
> >  #include <spice/vd_agent.h>
> >  #include <spice/macros.h>
> >  
> > -#ifdef SPICE_SERVER_INTERNAL
> > -#undef SPICE_GNUC_DEPRECATED
> > -#define SPICE_GNUC_DEPRECATED
> > -#endif
> >  
> >  /* interface base type */
> >  
> 
> This hunk you remove is there so that we ignore internal deprecations,
> imo it's ok to have, I'll assume we are not going to add usage of
> deprecated functions ourselves. As usual, a slightly longer rationale in
> the commit log would be better than just a shortlog.
> 
> Christophe

I thinks this is the key of the patch. Instead of disabling all deprecation
disable the warning for specified piece of code.

> 
> > diff --git a/server/red-qxl.c b/server/red-qxl.c
> > index 19cff95..2ca2537 100644
> > --- a/server/red-qxl.c
> > +++ b/server/red-qxl.c
> > @@ -977,6 +977,7 @@ void red_qxl_init(RedsState *reds, QXLInstance *qxl)
> >      qxl_state->dispatcher = dispatcher_new(RED_WORKER_MESSAGE_COUNT,
> >      NULL);
> >      qxl_state->qxl_worker.major_version = SPICE_INTERFACE_QXL_MAJOR;
> >      qxl_state->qxl_worker.minor_version = SPICE_INTERFACE_QXL_MINOR;
> > +    G_GNUC_BEGIN_IGNORE_DEPRECATIONS
> >      qxl_state->qxl_worker.wakeup = qxl_worker_wakeup;
> >      qxl_state->qxl_worker.oom = qxl_worker_oom;
> >      qxl_state->qxl_worker.start = qxl_worker_start;
> > @@ -993,6 +994,7 @@ void red_qxl_init(RedsState *reds, QXLInstance *qxl)
> >      qxl_state->qxl_worker.reset_cursor = qxl_worker_reset_cursor;
> >      qxl_state->qxl_worker.destroy_surface_wait =
> >      qxl_worker_destroy_surface_wait;
> >      qxl_state->qxl_worker.loadvm_commands = qxl_worker_loadvm_commands;
> > +    G_GNUC_END_IGNORE_DEPRECATIONS
> >  
> >      qxl_state->max_monitors = UINT_MAX;
> >      qxl->st = qxl_state;
> > diff --git a/server/red-replay-qxl.c b/server/red-replay-qxl.c
> > index 2176068..360e8f5 100644
> > --- a/server/red-replay-qxl.c
> > +++ b/server/red-replay-qxl.c
> > @@ -1241,7 +1241,9 @@ static void replay_handle_create_primary(QXLWorker
> > *worker, SpiceReplay *replay)
> >          spice_printerr(
> >              "WARNING: %d: original recording event not preceded by a
> >              destroy primary",
> >              replay->counter);
> > +        G_GNUC_BEGIN_IGNORE_DEPRECATIONS
> >          worker->destroy_primary_surface(worker, 0);
> > +        G_GNUC_END_IGNORE_DEPRECATIONS
> >      }
> >      replay->created_primary = TRUE;
> >  
> > @@ -1255,7 +1257,9 @@ static void replay_handle_create_primary(QXLWorker
> > *worker, SpiceReplay *replay)
> >      read_binary(replay, "data", &size, &mem, 0);
> >      surface.group_id = 0;
> >      surface.mem = QXLPHYSICAL_FROM_PTR(mem);
> > +    G_GNUC_BEGIN_IGNORE_DEPRECATIONS
> >      worker->create_primary_surface(worker, 0, &surface);
> > +    G_GNUC_END_IGNORE_DEPRECATIONS
> >  }
> >  
> >  static void replay_handle_dev_input(QXLWorker *worker, SpiceReplay
> >  *replay,
> > @@ -1264,15 +1268,21 @@ static void replay_handle_dev_input(QXLWorker
> > *worker, SpiceReplay *replay,
> >      switch (message) {
> >      case RED_WORKER_MESSAGE_CREATE_PRIMARY_SURFACE:
> >      case RED_WORKER_MESSAGE_CREATE_PRIMARY_SURFACE_ASYNC:
> > +        G_GNUC_BEGIN_IGNORE_DEPRECATIONS
> >          replay_handle_create_primary(worker, replay);
> > +        G_GNUC_END_IGNORE_DEPRECATIONS
> >          break;
> >      case RED_WORKER_MESSAGE_DESTROY_PRIMARY_SURFACE:
> >          replay->created_primary = FALSE;
> > +        G_GNUC_BEGIN_IGNORE_DEPRECATIONS
> >          worker->destroy_primary_surface(worker, 0);
> > +        G_GNUC_END_IGNORE_DEPRECATIONS
> >          break;
> >      case RED_WORKER_MESSAGE_DESTROY_SURFACES:
> >          replay->created_primary = FALSE;
> > +        G_GNUC_BEGIN_IGNORE_DEPRECATIONS
> >          worker->destroy_surfaces(worker);
> > +        G_GNUC_END_IGNORE_DEPRECATIONS
> >          break;
> >      case RED_WORKER_MESSAGE_UPDATE:
> >          // XXX do anything? we record the correct bitmaps already.

Yes, looks like the replay interface still uses the old interface.

> > diff --git a/server/reds-stream.c b/server/reds-stream.c
> > index 9896eab..1f95b13 100644
> > --- a/server/reds-stream.c
> > +++ b/server/reds-stream.c
> > @@ -358,10 +358,12 @@ static void reds_stream_set_socket(RedsStream
> > *stream, int socket)
> >  {
> >      stream->socket = socket;
> >      /* deprecated fields. Filling them for backward compatibility */
> > +    G_GNUC_BEGIN_IGNORE_DEPRECATIONS
> >      stream->priv->info->llen = sizeof(stream->priv->info->laddr);
> >      stream->priv->info->plen = sizeof(stream->priv->info->paddr);
> >      getsockname(stream->socket, (struct
> >      sockaddr*)(&stream->priv->info->laddr), &stream->priv->info->llen);
> >      getpeername(stream->socket, (struct
> >      sockaddr*)(&stream->priv->info->paddr), &stream->priv->info->plen);
> > +    G_GNUC_END_IGNORE_DEPRECATIONS
> >  
> >      stream->priv->info->flags |= SPICE_CHANNEL_EVENT_FLAG_ADDR_EXT;
> >      stream->priv->info->llen_ext = sizeof(stream->priv->info->laddr_ext);

Does this work on RHEL6 ?

Frediano
On Wed, Nov 23, 2016 at 05:09:05AM -0500, Frediano Ziglio wrote:
> > 
> > On Wed, Nov 23, 2016 at 06:48:22AM +0100, Francois Gouget wrote:
> > > Signed-off-by: Francois Gouget <fgouget@codeweavers.com>
> > > ---
> > >  server/red-qxl.c        |  2 ++
> > >  server/red-replay-qxl.c | 10 ++++++++++
> > >  server/reds-stream.c    |  2 ++
> > >  server/spice-core.h     |  4 ----
> > >  4 files changed, 14 insertions(+), 4 deletions(-)
> > > 
> > > diff --git a/server/spice-core.h b/server/spice-core.h
> > > index 4d8f2ed..dfd24ab 100644
> > > --- a/server/spice-core.h
> > > +++ b/server/spice-core.h
> > > @@ -28,10 +28,6 @@
> > >  #include <spice/vd_agent.h>
> > >  #include <spice/macros.h>
> > >  
> > > -#ifdef SPICE_SERVER_INTERNAL
> > > -#undef SPICE_GNUC_DEPRECATED
> > > -#define SPICE_GNUC_DEPRECATED
> > > -#endif
> > >  
> > >  /* interface base type */
> > >  
> > 
> > This hunk you remove is there so that we ignore internal deprecations,
> > imo it's ok to have, I'll assume we are not going to add usage of
> > deprecated functions ourselves. As usual, a slightly longer rationale in
> > the commit log would be better than just a shortlog.
> > 
> > Christophe
> 
> I thinks this is the key of the patch. Instead of disabling all deprecation
> disable the warning for specified piece of code.

In this case, the situation is very different from the spice-gtk
patches. Here we are selectively silencing use of spice-server
deprecated functions within spice-server, for spice-gtk we are doing it
for our use of deprecated glib functions.
Dunno if we want to do that in spice-server.

Christophe
On Wed, 23 Nov 2016, Christophe Fergeau wrote:

> On Wed, Nov 23, 2016 at 06:48:22AM +0100, Francois Gouget wrote:
> > Signed-off-by: Francois Gouget <fgouget@codeweavers.com>
> > ---
> >  server/red-qxl.c        |  2 ++
> >  server/red-replay-qxl.c | 10 ++++++++++
> >  server/reds-stream.c    |  2 ++
> >  server/spice-core.h     |  4 ----
> >  4 files changed, 14 insertions(+), 4 deletions(-)
> > 
> > diff --git a/server/spice-core.h b/server/spice-core.h
> > index 4d8f2ed..dfd24ab 100644
> > --- a/server/spice-core.h
> > +++ b/server/spice-core.h
> > @@ -28,10 +28,6 @@
> >  #include <spice/vd_agent.h>
> >  #include <spice/macros.h>
> >  
> > -#ifdef SPICE_SERVER_INTERNAL
> > -#undef SPICE_GNUC_DEPRECATED
> > -#define SPICE_GNUC_DEPRECATED
> > -#endif
> >  
> >  /* interface base type */
> >  
> 
> This hunk you remove is there so that we ignore internal deprecations,
> imo it's ok to have, I'll assume we are not going to add usage of
> deprecated functions ourselves. As usual, a slightly longer rationale in
> the commit log would be better than just a shortlog.

Right. I think I used that argument to not really submit this patch 
before but somehow I forgot about it. Also your other concern about RHEL 
6.8 is right, it does not support G_GNUC_BEGIN_IGNORE_DEPRECATIONS 
leading to a compilation error.

So this patch should be ignored.