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

Re: [Xen-devel] [PATCH] libxl: Introduce LIBXL_DOMAIN_TYPE_INVALID to make gcc happy



On 05/18/12 16:55, Ian Campbell wrote:

> On Fri, 2012-05-18 at 15:48 +0100, Dario Faggioli wrote:
>> On Fri, 2012-05-18 at 15:39 +0100, Ian Campbell wrote:
>>>> Which actually seems to be right:
>>>>
>>>> $ grep LIBXL_DOMAIN_TYPE_INVALID tools/* -R
>>>> tools/libxl/libxl_dm.c:    case LIBXL_DOMAIN_TYPE_INVALID:
>>>> tools/libxl/libxl_dm.c:    case LIBXL_DOMAIN_TYPE_INVALID:
>>>> tools/libxl/libxl_dom.c:        return LIBXL_DOMAIN_TYPE_INVALID;
>>>> tools/libxl/libxl_dom.c:        return LIBXL_DOMAIN_TYPE_INVALID;
>>>> tools/libxl/libxl.c:        case LIBXL_DOMAIN_TYPE_INVALID:
>>>>
>>>> Am I missing something?
>>>
>>> This should be defined in tools/libxl/libxl_types.idl but the patch
>>> doesn't seem to add it.
>>>
>> Yep, I'm adding it myself with the attached patch, but I'm now getting
>> this:
>>
>> _libxl_types.c: In function âlibxl_domain_build_info_disposeâ:
>> _libxl_types.c:91:5: error: enumeration value âLIBXL_DOMAIN_TYPE_INVALIDâ 
>> not handled in switch [-Werror=switch]
>> _libxl_types.c: In function âlibxl_domain_build_info_init_typeâ:
>> _libxl_types.c:284:5: error: enumeration value âLIBXL_DOMAIN_TYPE_INVALIDâ 
>> not handled in switch [-Werror=switch]
>> testidl.c: In function âlibxl_domain_build_info_rand_initâ:
>> testidl.c:366:5: error: enumeration value âLIBXL_DOMAIN_TYPE_INVALIDâ not 
>> handled in switch [-Werror=switch]
>> _libxl_types.c: In function âlibxl_domain_build_info_gen_jsonâ:
>> _libxl_types.c:1713:5: error: enumeration value âLIBXL_DOMAIN_TYPE_INVALIDâ 
>> not handled in switch [-Werror=switch]
>> cc1: all warnings being treated as errors
>>
>> :-O
> 
> I wonder if just changing the return type of libxl__domain_type to int
> would be better than this? I guess it'll probably be much the same.


Is libxl_domain_type part of the API ? If yes then it is better to use
'int' and change the enum to #defines to be safe side. An enum used
in the API has a backward-compatibility issue related to its size:

An enum is as small as possible to hold the largest value.
Whatever 'as small as possible' means depends on the architecture.

Christoph

-- 
---to satisfy European Law for business letters:
Advanced Micro Devices GmbH
Einsteinring 24, 85689 Dornach b. Muenchen
Geschaeftsfuehrer: Alberto Bozzo, Andrew Bowd
Sitz: Dornach, Gemeinde Aschheim, Landkreis Muenchen
Registergericht Muenchen, HRB Nr. 43632


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

 


Rackspace

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