[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

Dario Faggioli writes ("Re: [Xen-devel] [PATCH] libxl: Introduce 
LIBXL_DOMAIN_TYPE_INVALID to make gcc happy"):
> That's what I'm doing for any explicit usage of the enum. Problem arises
> with auto-generated code, e.g., in gentypes.py for build_info related
> functions. In this case, in fact, the libxl_domain_type enum is the key
> of the keyed-union. For those cases, I was thinking at something like
> the below:
>     if isinstance(ty, idl.KeyedUnion):
>         if parent is None:
>             raise Exception("KeyedUnion type must have a parent")
>         s += "switch (%s) {\n" % (parent + ty.keyvar.name)
>         for f in ty.fields:
>             (nparent,fexpr) = ty.member(v, f, parent is None)
>             s += "case %s:\n" % f.enumname
>             s += libxl_C_type_dispose(f.type, fexpr, indent + "    ", nparent)
>             s += "    break;\n"
> +       s += "default:\n    break;\n";
>         s += "}\n"
> Would it make sense?

No, I don't think so.  Surely the idl should contain an explicitly
empty structure ?


Xen-devel mailing list



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