All of lore.kernel.org
 help / color / mirror / Atom feed
* non-ANSI Unions
@ 2007-03-23 15:33 PUCCETTI Armand
  2007-03-23 15:41 ` Anthony Liguori
  0 siblings, 1 reply; 3+ messages in thread
From: PUCCETTI Armand @ 2007-03-23 15:33 UTC (permalink / raw)
  To: xen-devel

Many "unions' are present in the code, but are non-ANSI!

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: non-ANSI Unions
  2007-03-23 15:33 non-ANSI Unions PUCCETTI Armand
@ 2007-03-23 15:41 ` Anthony Liguori
  2007-03-23 16:00   ` PUCCETTI Armand
  0 siblings, 1 reply; 3+ messages in thread
From: Anthony Liguori @ 2007-03-23 15:41 UTC (permalink / raw)
  To: PUCCETTI Armand; +Cc: xen-devel

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: non-ANSI Unions
  2007-03-23 15:41 ` Anthony Liguori
@ 2007-03-23 16:00   ` PUCCETTI Armand
  0 siblings, 0 replies; 3+ messages in thread
From: PUCCETTI Armand @ 2007-03-23 16:00 UTC (permalink / raw)
  To: Anthony Liguori; +Cc: xen-devel

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
>
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-03-23 16:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-03-23 15:33 non-ANSI Unions PUCCETTI Armand
2007-03-23 15:41 ` Anthony Liguori
2007-03-23 16:00   ` PUCCETTI Armand

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.