[Spice-devel] [PATCH spice-server 1/2] Change ENABLE_EXTRA_CHECKS statements to #ifdef

Uri Lublin uril at redhat.com
Thu Mar 15 11:25:46 UTC 2018


On 03/15/2018 01:19 PM, Uri Lublin wrote:
> On 03/13/2018 03:37 PM, Eduardo Lima (Etrunko) wrote:
>> On 13/03/18 04:21, Frediano Ziglio wrote:
>>>>
>>>> This patch makes it clear that this is a configure switch and not a
>>>> variable defined somewhere else in the code.
>>>>
>>>
>>> The code is intended that way to make the compiler always parse
>>> these parts. Note that that define is always defined so your code
>>> is not doing what you are intending.
>>
>> I have sent this patch by mistake, but anyway, the fact of it always
>> being defined is true with autotools, but it is not with meson.
> 
> So with meson it's either 1 or undefined ?
> 
> Note that in this case the current code would fail to build
> when ENABLE_EXTRA_CHECKS is undefined.
> 
>> Do you think it would make sense to have this patch or is it better to
>> keep as is? If the latter, I think it would be better to keep a static
>> variable and change its value according to the define.
> 
> This patch makes sense to me.
> 
> Perhaps replace the #ifdef with
> #if defined(ENABLE_EXTRA_CHECKS) && ENABLE_EXTRA_CHECKS

Or add something like this (in an .h file all .c include)
#ifndef ENABLE_EXTRA_CHECKS
#define ENABLE_EXTRA_CHECKS 0
#endif

and replace the #ifdef with an #if

> 
> Uri.
> 


More information about the Spice-devel mailing list