[Spice-devel] [PATCH spice-common] Protect G_LOG_DOMAIN definition with #ifndef guards

Frediano Ziglio fziglio at redhat.com
Thu Apr 19 20:50:19 UTC 2018


> 
> Different from autotools, with meson, the subproject is not a separate
> build, so the definition of G_LOG_DOMAIN from the superproject will be
> the same for spice-common.
> 
> This will happen only with spice-gtk, because the value is different
> than defined, while with spice-server the definition of G_LOG_DOMAIN
> is the same.
> 
> Signed-off-by: Eduardo Lima (Etrunko) <etrunko at redhat.com>
> ---
>  common/log.c         | 2 ++
>  tests/test-logging.c | 2 ++
>  2 files changed, 4 insertions(+)
> 
> diff --git a/common/log.c b/common/log.c
> index 9b4757b..ddd5655 100644
> --- a/common/log.c
> +++ b/common/log.c
> @@ -41,7 +41,9 @@ static int abort_mask = 0;
>  #endif
>  #endif
>  
> +#ifndef G_LOG_DOMAIN
>  #define G_LOG_DOMAIN "Spice"
> +#endif
>  
>  typedef enum {
>      SPICE_LOG_LEVEL_ERROR,
> diff --git a/tests/test-logging.c b/tests/test-logging.c
> index 9852b13..6ef2d55 100644
> --- a/tests/test-logging.c
> +++ b/tests/test-logging.c
> @@ -18,7 +18,9 @@
>  #include <config.h>
>  #endif
>  
> +#ifndef G_LOG_DOMAIN
>  #define G_LOG_DOMAIN "Spice"
> +#endif
>  
>  #include <glib.h>
>  #include <stdlib.h>

This looks like a broken build to me.
Currently spice-common files will have G_LOG_DOMAIN defined as "Spice" while
spice-gtk code as "GSpice". Looks like the Meson build is breaking this.
Surely there's a different way to do this and fix the Meson build instead.

Frediano


More information about the Spice-devel mailing list