ia64/xen-unstable

changeset 17356:615ee2933137

Revert all usages of gcc's __extension__ keyword, and instead assert
that our headers are not built with __GNUC__ and __STRICT_ANSI__.

__extension__ had some weird (and buggy) behaviours when nested which
make it a risky proposition for general usage in our header
files. Better to disallow -ansi, -std=c99, and similar gcc options
when building against Xen headers.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Mon Mar 31 17:43:18 2008 +0100 (2008-03-31)
parents ffcc213f8711
children da9bd2e81288
files tools/include/xen-foreign/mkchecker.py tools/include/xen-foreign/mkheader.py tools/python/xen/xm/messages/xen-xm.pot xen/arch/ia64/vmx/save.c xen/arch/ia64/xen/dom_fw_common.c xen/arch/ia64/xen/dom_fw_domu.c xen/include/public/arch-ia64.h xen/include/public/arch-ia64/hvm/save.h xen/include/public/arch-powerpc.h xen/include/public/arch-x86/hvm/save.h xen/include/public/arch-x86/xen-x86_32.h xen/include/public/arch-x86/xen-x86_64.h xen/include/public/arch-x86/xen.h xen/include/public/xen-compat.h xen/include/public/xen.h xen/include/xen/hvm/save.h
line diff
     1.1 --- a/tools/include/xen-foreign/mkchecker.py	Mon Mar 31 16:32:33 2008 +0100
     1.2 +++ b/tools/include/xen-foreign/mkchecker.py	Mon Mar 31 17:43:18 2008 +0100
     1.3 @@ -19,9 +19,6 @@ f.write('''
     1.4  #include <stdlib.h>
     1.5  #include <stddef.h>
     1.6  #include <inttypes.h>
     1.7 -
     1.8 -#define __anonymous_struct __extension__ struct
     1.9 -#define __anonymous_union __extension__ union
    1.10  ''');
    1.11  
    1.12  for a in archs:
     2.1 --- a/tools/include/xen-foreign/mkheader.py	Mon Mar 31 16:32:33 2008 +0100
     2.2 +++ b/tools/include/xen-foreign/mkheader.py	Mon Mar 31 17:43:18 2008 +0100
     2.3 @@ -37,8 +37,8 @@ inttypes["x86_64"] = {
     2.4      "xen_pfn_t"     : "__align8__ uint64_t",
     2.5  };
     2.6  header["x86_64"] = """
     2.7 -#ifdef __GNUC__
     2.8 -# define __DECL_REG(name) __anonymous_union { uint64_t r ## name, e ## name; }
     2.9 +#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
    2.10 +# define __DECL_REG(name) union { uint64_t r ## name, e ## name; }
    2.11  # define __align8__ __attribute__((aligned (8)))
    2.12  #else
    2.13  # define __DECL_REG(name) uint64_t r ## name
     3.1 --- a/tools/python/xen/xm/messages/xen-xm.pot	Mon Mar 31 16:32:33 2008 +0100
     3.2 +++ b/tools/python/xen/xm/messages/xen-xm.pot	Mon Mar 31 17:43:18 2008 +0100
     3.3 @@ -8,7 +8,7 @@ msgid ""
     3.4  msgstr ""
     3.5  "Project-Id-Version: PACKAGE VERSION\n"
     3.6  "Report-Msgid-Bugs-To: \n"
     3.7 -"POT-Creation-Date: 2007-04-05 14:17-0400\n"
     3.8 +"POT-Creation-Date: 2008-03-31 17:40+0100\n"
     3.9  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
    3.10  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
    3.11  "Language-Team: LANGUAGE <LL@li.org>\n"
    3.12 @@ -61,3 +61,8 @@ msgid ""
    3.13  "The network you specified already has a PIF attached to it, and so another "
    3.14  "one may not be attached."
    3.15  msgstr ""
    3.16 +
    3.17 +#: xen/xm/XenAPI.py:67
    3.18 +#, python-format
    3.19 +msgid "%(2)s"
    3.20 +msgstr ""
     4.1 --- a/xen/arch/ia64/vmx/save.c	Mon Mar 31 16:32:33 2008 +0100
     4.2 +++ b/xen/arch/ia64/vmx/save.c	Mon Mar 31 17:43:18 2008 +0100
     4.3 @@ -21,7 +21,6 @@
     4.4   */
     4.5  
     4.6  #include <xen/types.h>
     4.7 -#include <public/xen.h>
     4.8  #include <xen/hvm/save.h>
     4.9  
    4.10  void arch_hvm_save(struct domain *d, struct hvm_save_header *hdr)
     5.1 --- a/xen/arch/ia64/xen/dom_fw_common.c	Mon Mar 31 16:32:33 2008 +0100
     5.2 +++ b/xen/arch/ia64/xen/dom_fw_common.c	Mon Mar 31 17:43:18 2008 +0100
     5.3 @@ -21,7 +21,6 @@
     5.4  #include <inttypes.h>
     5.5  
     5.6  #include <xen/xen.h>
     5.7 -#include <xen/arch-ia64.h>
     5.8  #include <asm/bundle.h>
     5.9  
    5.10  #include "xg_private.h"
     6.1 --- a/xen/arch/ia64/xen/dom_fw_domu.c	Mon Mar 31 16:32:33 2008 +0100
     6.2 +++ b/xen/arch/ia64/xen/dom_fw_domu.c	Mon Mar 31 17:43:18 2008 +0100
     6.3 @@ -38,7 +38,6 @@
     6.4  #include <inttypes.h>
     6.5  
     6.6  #include <xen/xen.h>
     6.7 -#include <xen/arch-ia64.h>
     6.8  
     6.9  #include "xg_private.h"
    6.10  #include "xc_dom.h"
     7.1 --- a/xen/include/public/arch-ia64.h	Mon Mar 31 16:32:33 2008 +0100
     7.2 +++ b/xen/include/public/arch-ia64.h	Mon Mar 31 17:43:18 2008 +0100
     7.3 @@ -23,6 +23,8 @@
     7.4   *
     7.5   */
     7.6  
     7.7 +#include "xen.h"
     7.8 +
     7.9  #ifndef __HYPERVISOR_IF_IA64_H__
    7.10  #define __HYPERVISOR_IF_IA64_H__
    7.11  
    7.12 @@ -131,7 +133,7 @@ struct pt_fpreg {
    7.13  
    7.14  union vac {
    7.15      unsigned long value;
    7.16 -    __anonymous_struct {
    7.17 +    struct {
    7.18          int a_int:1;
    7.19          int a_from_int_cr:1;
    7.20          int a_to_int_cr:1;
    7.21 @@ -146,7 +148,7 @@ typedef union vac vac_t;
    7.22  
    7.23  union vdc {
    7.24      unsigned long value;
    7.25 -    __anonymous_struct {
    7.26 +    struct {
    7.27          int d_vmsw:1;
    7.28          int d_extint:1;
    7.29          int d_ibr_dbr:1;
    7.30 @@ -165,11 +167,11 @@ struct mapped_regs {
    7.31      unsigned long  reserved1[29];
    7.32      unsigned long  vhpi;
    7.33      unsigned long  reserved2[95];
    7.34 -    __anonymous_union {
    7.35 +    union {
    7.36          unsigned long  vgr[16];
    7.37          unsigned long bank1_regs[16]; // bank1 regs (r16-r31) when bank0 active
    7.38      };
    7.39 -    __anonymous_union {
    7.40 +    union {
    7.41          unsigned long  vbgr[16];
    7.42          unsigned long bank0_regs[16]; // bank0 regs (r16-r31) when bank1 active
    7.43      };
    7.44 @@ -180,9 +182,9 @@ struct mapped_regs {
    7.45      unsigned long  vpsr;
    7.46      unsigned long  vpr;
    7.47      unsigned long  reserved4[76];
    7.48 -    __anonymous_union {
    7.49 +    union {
    7.50          unsigned long  vcr[128];
    7.51 -        __anonymous_struct {
    7.52 +        struct {
    7.53              unsigned long dcr;  // CR0
    7.54              unsigned long itm;
    7.55              unsigned long iva;
    7.56 @@ -214,9 +216,9 @@ struct mapped_regs {
    7.57              unsigned long rsv6[46];
    7.58          };
    7.59      };
    7.60 -    __anonymous_union {
    7.61 +    union {
    7.62          unsigned long  reserved5[128];
    7.63 -        __anonymous_struct {
    7.64 +        struct {
    7.65              unsigned long precover_ifs;
    7.66              unsigned long unat;  // not sure if this is needed until NaT arch is done
    7.67              int interrupt_collection_enabled; // virtual psr.ic
    7.68 @@ -302,7 +304,7 @@ struct vcpu_tr_regs {
    7.69  
    7.70  union vcpu_ar_regs {
    7.71      unsigned long ar[128];
    7.72 -    __anonymous_struct {
    7.73 +    struct {
    7.74          unsigned long kr[8];
    7.75          unsigned long rsv1[8];
    7.76          unsigned long rsc;
    7.77 @@ -339,7 +341,7 @@ union vcpu_ar_regs {
    7.78  
    7.79  union vcpu_cr_regs {
    7.80      unsigned long cr[128];
    7.81 -    __anonymous_struct {
    7.82 +    struct {
    7.83          unsigned long dcr;  // CR0
    7.84          unsigned long itm;
    7.85          unsigned long iva;
    7.86 @@ -608,8 +610,8 @@ struct xen_ia64_boot_param {
    7.87  struct xen_ia64_opt_feature {
    7.88  	unsigned long cmd;		/* Which feature */
    7.89  	unsigned char on;		/* Switch feature on/off */
    7.90 -	__anonymous_union {
    7.91 -		__anonymous_struct {
    7.92 +	union {
    7.93 +		struct {
    7.94  				/* The page protection bit mask of the pte.
    7.95  			 	 * This will be or'ed with the pte. */
    7.96  			unsigned long pgprot;
     8.1 --- a/xen/include/public/arch-ia64/hvm/save.h	Mon Mar 31 16:32:33 2008 +0100
     8.2 +++ b/xen/include/public/arch-ia64/hvm/save.h	Mon Mar 31 17:43:18 2008 +0100
     8.3 @@ -109,7 +109,7 @@ DECLARE_HVM_SAVE_TYPE(VTIME, 5, struct h
     8.4  union viosapic_rte
     8.5  {
     8.6      uint64_t bits;
     8.7 -    __anonymous_struct {
     8.8 +    struct {
     8.9          uint8_t vector;
    8.10  
    8.11          uint8_t delivery_mode  : 3;
    8.12 @@ -143,8 +143,8 @@ DECLARE_HVM_SAVE_TYPE(VIOSAPIC, 6, struc
    8.13   * PM timer
    8.14   */
    8.15  struct vacpi_regs {
    8.16 -    __anonymous_union {
    8.17 -        __anonymous_struct {
    8.18 +    union {
    8.19 +        struct {
    8.20              uint32_t pm1a_sts:16;/* PM1a_EVT_BLK.PM1a_STS: status register */
    8.21              uint32_t pm1a_en:16; /* PM1a_EVT_BLK.PM1a_EN: enable register */
    8.22          };
     9.1 --- a/xen/include/public/arch-powerpc.h	Mon Mar 31 16:32:33 2008 +0100
     9.2 +++ b/xen/include/public/arch-powerpc.h	Mon Mar 31 17:43:18 2008 +0100
     9.3 @@ -22,6 +22,8 @@
     9.4   * Authors: Hollis Blanchard <hollisb@us.ibm.com>
     9.5   */
     9.6  
     9.7 +#include "xen.h"
     9.8 +
     9.9  #ifndef __XEN_PUBLIC_ARCH_PPC_64_H__
    9.10  #define __XEN_PUBLIC_ARCH_PPC_64_H__
    9.11  
    10.1 --- a/xen/include/public/arch-x86/hvm/save.h	Mon Mar 31 16:32:33 2008 +0100
    10.2 +++ b/xen/include/public/arch-x86/hvm/save.h	Mon Mar 31 17:43:18 2008 +0100
    10.3 @@ -144,9 +144,9 @@ struct hvm_hw_cpu {
    10.4      uint64_t tsc;
    10.5  
    10.6      /* pending event, if any */
    10.7 -    __anonymous_union {
    10.8 +    union {
    10.9          uint32_t pending_event;
   10.10 -        __anonymous_struct {
   10.11 +        struct {
   10.12              uint8_t  pending_vector:8;
   10.13              uint8_t  pending_type:3;
   10.14              uint8_t  pending_error_valid:1;
   10.15 @@ -286,7 +286,7 @@ struct hvm_hw_pci_irqs {
   10.16       * Virtual interrupt wires for a single PCI bus.
   10.17       * Indexed by: device*4 + INTx#.
   10.18       */
   10.19 -    __anonymous_union {
   10.20 +    union {
   10.21          DECLARE_BITMAP(i, 32*4);
   10.22          uint64_t pad[2];
   10.23      };
   10.24 @@ -299,7 +299,7 @@ struct hvm_hw_isa_irqs {
   10.25       * Virtual interrupt wires for ISA devices.
   10.26       * Indexed by ISA IRQ (assumes no ISA-device IRQ sharing).
   10.27       */
   10.28 -    __anonymous_union {
   10.29 +    union {
   10.30          DECLARE_BITMAP(i, 16);
   10.31          uint64_t pad[1];
   10.32      };
    11.1 --- a/xen/include/public/arch-x86/xen-x86_32.h	Mon Mar 31 16:32:33 2008 +0100
    11.2 +++ b/xen/include/public/arch-x86/xen-x86_32.h	Mon Mar 31 17:43:18 2008 +0100
    11.3 @@ -108,10 +108,10 @@
    11.4  /* 32-/64-bit invariability for control interfaces (domctl/sysctl). */
    11.5  #if defined(__XEN__) || defined(__XEN_TOOLS__)
    11.6  #undef ___DEFINE_XEN_GUEST_HANDLE
    11.7 -#define ___DEFINE_XEN_GUEST_HANDLE(name, type)                              \
    11.8 -    typedef struct { type *p; }                                             \
    11.9 -        __guest_handle_ ## name;                                            \
   11.10 -    typedef struct { __anonymous_union { type *p; uint64_aligned_t q; }; }  \
   11.11 +#define ___DEFINE_XEN_GUEST_HANDLE(name, type)                  \
   11.12 +    typedef struct { type *p; }                                 \
   11.13 +        __guest_handle_ ## name;                                \
   11.14 +    typedef struct { union { type *p; uint64_aligned_t q; }; }  \
   11.15          __guest_handle_64_ ## name
   11.16  #undef set_xen_guest_handle
   11.17  #define set_xen_guest_handle(hnd, val)                      \
    12.1 --- a/xen/include/public/arch-x86/xen-x86_64.h	Mon Mar 31 16:32:33 2008 +0100
    12.2 +++ b/xen/include/public/arch-x86/xen-x86_64.h	Mon Mar 31 17:43:18 2008 +0100
    12.3 @@ -140,11 +140,11 @@ struct iret_context {
    12.4      /* Bottom of iret stack frame. */
    12.5  };
    12.6  
    12.7 -#ifdef __GNUC__
    12.8 +#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
    12.9  /* Anonymous union includes both 32- and 64-bit names (e.g., eax/rax). */
   12.10 -#define __DECL_REG(name) __anonymous_union {    \
   12.11 -    uint64_t r ## name, e ## name;              \
   12.12 -    uint32_t _e ## name;                        \
   12.13 +#define __DECL_REG(name) union { \
   12.14 +    uint64_t r ## name, e ## name; \
   12.15 +    uint32_t _e ## name; \
   12.16  }
   12.17  #else
   12.18  /* Non-gcc sources must always use the proper 64-bit name (e.g., rax). */
    13.1 --- a/xen/include/public/arch-x86/xen.h	Mon Mar 31 16:32:33 2008 +0100
    13.2 +++ b/xen/include/public/arch-x86/xen.h	Mon Mar 31 17:43:18 2008 +0100
    13.3 @@ -24,6 +24,8 @@
    13.4   * Copyright (c) 2004-2006, K A Fraser
    13.5   */
    13.6  
    13.7 +#include "../xen.h"
    13.8 +
    13.9  #ifndef __XEN_PUBLIC_ARCH_X86_XEN_H__
   13.10  #define __XEN_PUBLIC_ARCH_X86_XEN_H__
   13.11  
   13.12 @@ -140,9 +142,9 @@ struct vcpu_guest_context {
   13.13      unsigned long event_callback_eip;
   13.14      unsigned long failsafe_callback_eip;
   13.15  #ifdef __XEN__
   13.16 -    __anonymous_union {
   13.17 +    union {
   13.18          unsigned long syscall_callback_eip;
   13.19 -        __anonymous_struct {
   13.20 +        struct {
   13.21              unsigned int event_callback_cs;    /* compat CS of event cb     */
   13.22              unsigned int failsafe_callback_cs; /* compat CS of failsafe cb  */
   13.23          };
    14.1 --- a/xen/include/public/xen-compat.h	Mon Mar 31 16:32:33 2008 +0100
    14.2 +++ b/xen/include/public/xen-compat.h	Mon Mar 31 17:43:18 2008 +0100
    14.3 @@ -41,4 +41,8 @@
    14.4  #error "These header files do not support the requested interface version."
    14.5  #endif
    14.6  
    14.7 +#if defined(__GNUC__) && defined(__STRICT_ANSI__)
    14.8 +#error "These headers files use GNU extensions when built with GCC."
    14.9 +#endif
   14.10 +
   14.11  #endif /* __XEN_PUBLIC_XEN_COMPAT_H__ */
    15.1 --- a/xen/include/public/xen.h	Mon Mar 31 16:32:33 2008 +0100
    15.2 +++ b/xen/include/public/xen.h	Mon Mar 31 17:43:18 2008 +0100
    15.3 @@ -29,11 +29,6 @@
    15.4  
    15.5  #include "xen-compat.h"
    15.6  
    15.7 -#ifdef __GNUC__
    15.8 -#define __anonymous_union __extension__ union
    15.9 -#define __anonymous_struct __extension__ union
   15.10 -#endif
   15.11 -
   15.12  #if defined(__i386__) || defined(__x86_64__)
   15.13  #include "arch-x86/xen.h"
   15.14  #elif defined(__ia64__)
    16.1 --- a/xen/include/xen/hvm/save.h	Mon Mar 31 16:32:33 2008 +0100
    16.2 +++ b/xen/include/xen/hvm/save.h	Mon Mar 31 17:43:18 2008 +0100
    16.3 @@ -18,6 +18,7 @@
    16.4  #ifndef __XEN_HVM_SAVE_H__
    16.5  #define __XEN_HVM_SAVE_H__
    16.6  
    16.7 +#include <public/xen.h>
    16.8  #include <public/hvm/save.h>
    16.9  #include <asm/types.h>
   16.10