WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] Re: non-ANSI Unions

To: Anthony Liguori <aliguori@xxxxxxxxxx>
Subject: [Xen-devel] Re: non-ANSI Unions
From: PUCCETTI Armand <armand.puccetti@xxxxxx>
Date: Fri, 23 Mar 2007 17:00:31 +0100
Cc: xen-devel@xxxxxxxxxxxxxxxxxxx
Delivery-date: Fri, 23 Mar 2007 08:58:37 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <4603F533.5070003@xxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <4603F338.6050507@xxxxxx> <4603F533.5070003@xxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Thunderbird 1.5.0.10 (X11/20070306)
Sorry, it was an err in the tool. Such unions are now understood properly.

Anthony Liguori a écrit :
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




_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>