All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anthony Liguori <aliguori@us.ibm.com>
To: PUCCETTI Armand <armand.puccetti@cea.fr>
Cc: xen-devel@lists.xensource.com
Subject: Re: non-ANSI Unions
Date: Fri, 23 Mar 2007 10:41:39 -0500	[thread overview]
Message-ID: <4603F533.5070003@us.ibm.com> (raw)
In-Reply-To: <4603F338.6050507@cea.fr>

PUCCETTI Armand wrote:
> Many "unions' are present in the code, but are non-ANSI!

Anonymous unions/structs are a rather common C extension.  They are much 
preferred to using a named union for the syntactical convenience of writing:

page_info.list

vs writing:

page_info.u.list

Also, this is not the only C extension that Xen utilizes.  If your 
analysis tool doesn't support the various GCC extensions, then it's not 
going to be much help.

Regards,

Anthony Liguori

> For instance, I see:
> 
> struct page_info
> {
>    /* Each frame can be threaded onto a doubly-linked list. */
>    union {
>        struct list_head list;
>        /* Shadow uses this field as an up-pointer in lower-level shadows */
>        paddr_t up;
>    };
>    /* Reference count and various PGC_xxx flags and fields. */
>    u32 count_info;
> ...}
> 
> which should be written properly:
> 
> struct page_info
> {
>    /* Each frame can be threaded onto a doubly-linked list. */
>    union {
>        struct list_head list;
>        /* Shadow uses this field as an up-pointer in lower-level shadows */
>        paddr_t up;
>    } foo;
> 
>    /* Reference count and various PGC_xxx flags and fields. */
>    u32 count_info;
> ...}
> 
> Is there any good reason to do so? Is it possible to change that, to 
> comply with the standard
> (and therefore with analysis tools too) ?
> 
> Armand

  reply	other threads:[~2007-03-23 15:41 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-23 15:33 non-ANSI Unions PUCCETTI Armand
2007-03-23 15:41 ` Anthony Liguori [this message]
2007-03-23 16:00   ` PUCCETTI Armand

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=4603F533.5070003@us.ibm.com \
    --to=aliguori@us.ibm.com \
    --cc=armand.puccetti@cea.fr \
    --cc=xen-devel@lists.xensource.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.