xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Dario Faggioli <raistlin@linux.it>
To: Ian Jackson <Ian.Jackson@eu.citrix.com>
Cc: Christoph Egger <Christoph.Egger@amd.com>,
	Ian Campbell <Ian.Campbell@citrix.com>,
	"xen-devel@lists.xen.org" <xen-devel@lists.xen.org>
Subject: Re: [PATCH] libxl: Introduce LIBXL_DOMAIN_TYPE_INVALID to make gcc happy
Date: Wed, 23 May 2012 14:49:10 +0200	[thread overview]
Message-ID: <1337777350.27368.82.camel@Solace> (raw)
In-Reply-To: <20412.55808.555103.132979@mariner.uk.xensource.com>


[-- Attachment #1.1: Type: text/plain, Size: 1463 bytes --]

On Wed, 2012-05-23 at 13:37 +0100, Ian Jackson wrote:
> I think that would be best, if you're willing, thanks.
> 
Doing it right now.

> I would recommend the use of "case" rather than "default" clauses in
> this case.  That way if we introduce a new domain type the compiler
> will spot all the missing places for us.
> 
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?

Thanks and Regards,
Dario

-- 
<<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 #1.2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

[-- Attachment #2: Type: text/plain, Size: 126 bytes --]

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

  reply	other threads:[~2012-05-23 12:49 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-18 11:24 libxl: build failure due to 'libxl_domain_type' Christoph Egger
2012-05-18 12:21 ` [PATCH] libxl: Introduce LIBXL_DOMAIN_TYPE_INVALID to make gcc happy Christoph Egger
2012-05-18 14:30   ` Dario Faggioli
2012-05-18 14:39     ` Ian Campbell
2012-05-18 14:48       ` Dario Faggioli
2012-05-18 14:55         ` Ian Campbell
2012-05-18 15:07           ` Dario Faggioli
2012-05-22 10:16             ` Ian Campbell
2012-05-22 14:58               ` Dario Faggioli
2012-05-22 15:07                 ` Ian Campbell
2012-05-22 16:18                   ` Dario Faggioli
2012-05-23  8:59                     ` Christoph Egger
2012-05-23  9:23                       ` Dario Faggioli
2012-05-23  9:30                         ` Christoph Egger
2012-05-18 15:11           ` Christoph Egger
2012-05-18 15:22             ` Ian Campbell
2012-05-23 10:53           ` Ian Jackson
2012-05-23 11:17             ` Dario Faggioli
2012-05-23 12:37               ` Ian Jackson
2012-05-23 12:49                 ` Dario Faggioli [this message]
2012-05-23 13:12                   ` Dario Faggioli
2012-05-23 13:47                     ` Christoph Egger
2012-05-23 14:36                   ` Ian Jackson
2012-05-23 15:21                     ` Dario Faggioli

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1337777350.27368.82.camel@Solace \
    --to=raistlin@linux.it \
    --cc=Christoph.Egger@amd.com \
    --cc=Ian.Campbell@citrix.com \
    --cc=Ian.Jackson@eu.citrix.com \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).