[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH 2/2] xen/build: Use C99 booleans



On 14/07/16 17:12, Julien Grall wrote:
> Hi Andrew,
>
> On 14/07/16 16:58, Andrew Cooper wrote:
>> and switch bool_t to being of type _Bool rather than char.
>>
>> Using bool_t as char causes several subtle problems; first that a bool_t
>> actually has more than two values, and that (bool_t)0x100 actually
>> has the
>> value 0 rather than the expected 1, due to truncation.
>>
>> Making this change reveals two bugs now caught by the compiler.
>> errata_c6_eoi_workaround() actually makes use of bool_t having more
>> than two
>> states, while generic_apic_probe() has a integer in the middle of a
>> compound
>> bool_t assignment (which triggers a [-Werror=parentheses] warning on
>> Debian
>> Jessie).
>>
>> Finally, it turns out that ARM is mixing and matching bool_t and
>> bool, despite
>> their different semantics.  This change brings the semantics of
>> bool_t to
>> match bool, but does not alter the current mix.
>
> I will add an item in my todo list to clean-up the ARM code. Is there
> any plan to retire either bool_t or bool?

I would prefer if we start making a trend towards bool, and the use of
true/false where appropriate.  Jan appears to agree; it is consistent
with Linux, and I think its easier to read and understand.

I am not suggesting that we do a bulk replace right now, and it will
take a while for contributors to change their style.

>
>> Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
>
> From ARM bits:
>
> Acked-by: Julien Grall <julien.grall@xxxxxxx>

Thanks,

~Andrew

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.