[Spice-devel] [spice-server] Remove use of spice_debug(NULL)

Frediano Ziglio fziglio at redhat.com
Wed Jun 14 08:06:30 UTC 2017


> 
> On Tue, 2017-06-13 at 19:08 +0200, Christophe Fergeau wrote:
> > This is causing issues with potential improvements to the logging
> > system, and I've always found this usage a bit odd anyway.
> > This means we also need to remove -Wformat-zero-length from our
> > CFLAGS
> > to avoid warnings from the compiler.
> 
> Alternately just change all of these to a particular string to avoid
> worrying about warnings at all. Something as simple as "x"? or "trace"?
> "reached"? "Christophe was here"? ;)
> 
> I agree with the general idea though.
> 

Usually I use "trace" for these stuff.
But "" is better than NULL.

<OT>
Maybe adding a "" in from of macro like

#define spice_debug(...) \
   whatever("" __VA_ARGS__)

would help avoiding this is the future
</OT>

> 
> > 
> > Signed-off-by: Christophe Fergeau <cfergeau at redhat.com>
> > ---
> >  m4/manywarnings.m4          |  1 -
> >  server/char-device.c        |  2 +-
> >  server/dcc.c                |  4 ++--
> >  server/display-channel.c    |  6 +++---
> >  server/main-channel.c       |  2 +-
> >  server/mjpeg-encoder.c      |  2 +-
> >  server/red-channel-client.c |  4 ++--
> >  server/red-worker.c         |  4 ++--
> >  server/reds.c               | 28 ++++++++++++++--------------
> >  server/stream.c             |  2 +-
> >  10 files changed, 27 insertions(+), 28 deletions(-)
> > 
> > diff --git a/m4/manywarnings.m4 b/m4/manywarnings.m4
> > index 4f701f4ea..dfe5a5542 100644
> > --- a/m4/manywarnings.m4
> > +++ b/m4/manywarnings.m4
> > @@ -142,7 +142,6 @@ AC_DEFUN([gl_MANYWARN_ALL_GCC],
> >      -Wformat-security \
> >      -Wformat-signedness \
> >      -Wformat-y2k \
> > -    -Wformat-zero-length \
> >      -Wframe-address \
> >      -Wfree-nonheap-object \
> >      -Whsa \
> > diff --git a/server/char-device.c b/server/char-device.c
> > index ab0707fb1..6de471ff4 100644
> > --- a/server/char-device.c
> > +++ b/server/char-device.c
> > @@ -862,7 +862,7 @@ void
> > red_char_device_migrate_data_marshall_empty(SpiceMarshaller *m)
> >  {
> >      SpiceMigrateDataCharDevice *mig_data;
> >  
> > -    spice_debug(NULL);
> > +    spice_debug("");
> >      mig_data = (SpiceMigrateDataCharDevice
> > *)spice_marshaller_reserve_space(m,
> >                                                                      
> >         sizeof(*mig_data));
> >      memset(mig_data, 0, sizeof(*mig_data));
> > diff --git a/server/dcc.c b/server/dcc.c
> > index dbc496c2f..8118d6424 100644
> > --- a/server/dcc.c
> > +++ b/server/dcc.c
> > @@ -1278,7 +1278,7 @@ static bool
> > restore_surfaces_lossless(DisplayChannelClient *dcc,
> >  {
> >      uint32_t i;
> >  
> > -    spice_debug(NULL);
> > +    spice_debug("");
> >      for (i = 0; i < mig_surfaces->num_surfaces; i++) {
> >          uint32_t surface_id = mig_surfaces->surfaces[i].id;
> >  
...

Frediano


More information about the Spice-devel mailing list