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

Eduardo Lima (Etrunko) etrunko at redhat.com
Fri Apr 20 13:30:10 UTC 2018


On 20/04/18 06:02, Frediano Ziglio wrote:
>>
>> On 19/04/18 17:50, Frediano Ziglio wrote:
>>>>
>>>> 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.
>>>
>>
>> As I explained in the commit message, spice-common build is not
>> separated from the parent project, so whenever we use the flag
>> '-DG_LOG_DOMAIN="GSpice"' in spice-gtk, that same flag will be used in
>> spice-common as well. With spice-server it is not a problem, since the
>> value for G_LOG_DOMAIN is the same.
>>
>> IMO, we could also use G_LOG_DOMAIN='Spice' instead of 'GSpice' for
>> spice-gtk.
>>
> 
> Doing so the 2 build system will produce 2 build that are different
> with the same setting which IMO is a bug.

Okay, I am convinced that the two builds should produce same results,
I'm dropping this patch.

> I surely think there is a way in Meson to specify different flags
> for different compile unit, if not Meson is missing a really
> important feature.
> 
> Frediano
> 


-- 
Eduardo de Barros Lima (Etrunko)
Software Engineer - RedHat
etrunko at redhat.com


More information about the Spice-devel mailing list