[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 Tue, 2012-05-22 at 16:07 +0100, Ian Campbell wrote:
> > > I did, I guess we need to check that all callers can cope with this new
> > > return value though?
> > > 
> > Sure, that was only to be sure I got what you were saying. :-)
> > 
> > What I'm not getting right now is whether or not a proper patch doing
> > such is still interesting or not? Also, how come am I almost the only
> > one seeing that issue? Does it relate to gcc version? :-O
> 
> There's been a handful of other reports this week. It does seem to be to
> do with gcc version, yes.
> 
Ok then, I didn't notice that. I went through the callers and they seem
to be fine with the change, as the return type of the function is pretty
much always converted to the enum (i.e., libxl_domain_type) and used in
a switch with a proper 'default' clause, in case they care about
something different from _HVM or _PV.

So, the below is what I'm using to build (and run) these days... Or was
it something different that you meant when saying "check that all
callers can cope with this" ?

(I can repost as a separate mail if wanted)

Dario

8<---------------------------

libxl: make libxl__domain_type return 'int'

To avoid gcc > 4.6.3  complaining about:

libxl.c: In function âlibxl_primary_console_execâ:
libxl.c:1233:9: error: case value â4294967295â not in enumerated type 
âlibxl_domain_typeâ [-Werror=switch]

Callers have been checked and are fine with the change.

Signed-off-by: Dario Faggioli <dario.faggioli@xxxxxxxxxx>

diff -r 6dc80df50fa8 tools/libxl/libxl_dom.c
--- a/tools/libxl/libxl_dom.c   Tue May 22 16:30:11 2012 +0200
+++ b/tools/libxl/libxl_dom.c   Tue May 22 18:06:41 2012 +0200
@@ -25,7 +25,7 @@
 
 #include "libxl_internal.h"
 
-libxl_domain_type libxl__domain_type(libxl__gc *gc, uint32_t domid)
+int libxl__domain_type(libxl__gc *gc, uint32_t domid)
 {
     libxl_ctx *ctx = libxl__gc_owner(gc);
     xc_domaininfo_t info;
diff -r 6dc80df50fa8 tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h      Tue May 22 16:30:11 2012 +0200
+++ b/tools/libxl/libxl_internal.h      Tue May 22 18:06:41 2012 +0200
@@ -714,7 +714,7 @@ int libxl__self_pipe_eatall(int fd); /* 
 
 
 /* from xl_dom */
-_hidden libxl_domain_type libxl__domain_type(libxl__gc *gc, uint32_t domid);
+_hidden int libxl__domain_type(libxl__gc *gc, uint32_t domid);
 _hidden int libxl__domain_shutdown_reason(libxl__gc *gc, uint32_t domid);
 _hidden int libxl__sched_set_params(libxl__gc *gc, uint32_t domid, 
libxl_sched_params *scparams);
 #define LIBXL__DOMAIN_IS_TYPE(gc, domid, type) \


-- 
<<This happens because I choose it to happen!>> (Raistlin Majere)
-----------------------------------------------------------------
Dario Faggioli, Ph.D, http://retis.sssup.it/people/faggioli
Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK)

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
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®.