[Spice-devel] [spice-common] log: Define G_LOG_DOMAIN as early as possible

Christophe Fergeau cfergeau at redhat.com
Fri Jul 7 10:14:51 UTC 2017


On Fri, Jul 07, 2017 at 06:07:33AM -0400, Frediano Ziglio wrote:
> 
> > 
> > "log: Forbid the usage of obsolete SPICE_LOG_DOMAIN" introduced a small
> > regression, if G_LOG_DOMAIN is not set when glib.h is included, the
> > header will set it to a default value. Redefining it later in log.c is
> > going to cause a compile-time warning.
> > This commit adds the definition to SPICE_COMMON_CFLAGS so that it's
> > defined before any inclusion of glib.h is possible. This is similar to
> > what is done in spice/configure.ac.
> > 
> > This avoids this warning:
> > CC       log.lo
> > log.c:44:0: warning: "G_LOG_DOMAIN" redefined
> >  #define G_LOG_DOMAIN "Spice"
> > 
> > In file included from /usr/include/glib-2.0/glib.h:62:0,
> >                  from log.c:22:
> > /usr/include/glib-2.0/glib/gmessages.h:280:0: note: this is the location of
> > the previous definition
> >  #define G_LOG_DOMAIN    ((gchar*) 0)
> > 
> > Signed-off-by: Christophe Fergeau <cfergeau at redhat.com>
> > ---
> >  common/log.c | 2 --
> >  configure.ac | 1 +
> >  2 files changed, 1 insertion(+), 2 deletions(-)
> > 
> > diff --git a/common/log.c b/common/log.c
> > index 9b4757b..69ac63e 100644
> > --- a/common/log.c
> > +++ b/common/log.c
> > @@ -41,8 +41,6 @@ static int abort_mask = 0;
> >  #endif
> >  #endif
> >  
> > -#define G_LOG_DOMAIN "Spice"
> > -
> >  typedef enum {
> >      SPICE_LOG_LEVEL_ERROR,
> >      SPICE_LOG_LEVEL_CRITICAL,
> > diff --git a/configure.ac b/configure.ac
> > index efd7317..f9b3f96 100644
> > --- a/configure.ac
> > +++ b/configure.ac
> > @@ -50,6 +50,7 @@ SPICE_CHECK_OPENSSL
> >  
> >  SPICE_COMMON_CFLAGS='$(PIXMAN_CFLAGS) $(SMARTCARD_CFLAGS) $(CELT051_CFLAGS)
> >  $(GLIB2_CFLAGS) $(OPUS_CFLAGS) $(OPENSSL_CFLAGS)'
> >  SPICE_COMMON_LIBS='$(PIXMAN_LIBS) $(CELT051_LIBS) $(GLIB2_LIBS) $(OPUS_LIBS)
> >  $(OPENSSL_LIBS)'
> > +SPICE_COMMON_CFLAGS+=' -DG_LOG_DOMAIN=\"Spice\"'
> 
> This is not standard shell compatible. The configure uses /bin/sh which
> in some Linux systems is not even bash.
> 
> Is a weird mix of shell/Makefile which may be hard to quote correctly.
> 
> Something that simulate bash is
> 
> SPICE_COMMON_CFLAGS="$SPICE_COMMON_CFLAGS -DG_LOG_DOMAIN=\\\"Spice\\\""

I just reused what is done in spice/configure.ac, I can change it to
what you suggest, test and push if that's fine with you.

Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20170707/e72ae8d3/attachment.sig>


More information about the Spice-devel mailing list