]> xenbits.xensource.com Git - xen.git/commitdiff
Explicitly tag every anonymous aggregate in the public headers.
authorKeir Fraser <keir.fraser@citrix.com>
Wed, 26 Mar 2008 10:14:50 +0000 (10:14 +0000)
committerKeir Fraser <keir.fraser@citrix.com>
Wed, 26 Mar 2008 10:14:50 +0000 (10:14 +0000)
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
tools/include/xen-foreign/mkchecker.py
tools/include/xen-foreign/mkheader.py
xen/include/public/arch-ia64.h
xen/include/public/arch-ia64/hvm/save.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.h

index 66c17b19e9f46cc93241a52abe7faad81283cfde..264bf799b55ef5cafbcdeddf14571c5a4aae2b63 100644 (file)
@@ -19,6 +19,9 @@ f.write('''
 #include <stdlib.h>
 #include <stddef.h>
 #include <inttypes.h>
+
+#define __anonymous_struct __extension__ struct
+#define __anonymous_union __extension__ union
 ''');
 
 for a in archs:
index ba6f98cfce447d8b0dacbfc0fe56a951e0cf5771..17873e484221dbaa5692df09f62965e612be09d3 100644 (file)
@@ -38,7 +38,7 @@ inttypes["x86_64"] = {
 };
 header["x86_64"] = """
 #ifdef __GNUC__
-# define __DECL_REG(name) __extension__ union { uint64_t r ## name, e ## name; }
+# define __DECL_REG(name) __anonymous_union { uint64_t r ## name, e ## name; }
 # define __align8__ __attribute__((aligned (8)))
 #else
 # define __DECL_REG(name) uint64_t r ## name
index afb2a52164ee901b7ec2db0c392c09b6390ba302..d304a46820846a8f17b3f624a1080e73085099c7 100644 (file)
@@ -64,8 +64,6 @@ typedef unsigned long xen_pfn_t;
 
 #ifndef __ASSEMBLY__
 
-#define __anonymous_union __extension__ union
-
 typedef unsigned long xen_ulong_t;
 
 #ifdef __XEN_TOOLS__
@@ -133,7 +131,7 @@ struct pt_fpreg {
 
 union vac {
     unsigned long value;
-    struct {
+    __anonymous_struct {
         int a_int:1;
         int a_from_int_cr:1;
         int a_to_int_cr:1;
@@ -148,7 +146,7 @@ typedef union vac vac_t;
 
 union vdc {
     unsigned long value;
-    struct {
+    __anonymous_struct {
         int d_vmsw:1;
         int d_extint:1;
         int d_ibr_dbr:1;
@@ -184,7 +182,7 @@ struct mapped_regs {
     unsigned long  reserved4[76];
     __anonymous_union {
         unsigned long  vcr[128];
-        struct {
+        __anonymous_struct {
             unsigned long dcr;  // CR0
             unsigned long itm;
             unsigned long iva;
@@ -218,7 +216,7 @@ struct mapped_regs {
     };
     __anonymous_union {
         unsigned long  reserved5[128];
-        struct {
+        __anonymous_struct {
             unsigned long precover_ifs;
             unsigned long unat;  // not sure if this is needed until NaT arch is done
             int interrupt_collection_enabled; // virtual psr.ic
@@ -304,7 +302,7 @@ struct vcpu_tr_regs {
 
 union vcpu_ar_regs {
     unsigned long ar[128];
-    struct {
+    __anonymous_struct {
         unsigned long kr[8];
         unsigned long rsv1[8];
         unsigned long rsc;
@@ -341,7 +339,7 @@ union vcpu_ar_regs {
 
 union vcpu_cr_regs {
     unsigned long cr[128];
-    struct {
+    __anonymous_struct {
         unsigned long dcr;  // CR0
         unsigned long itm;
         unsigned long iva;
@@ -611,7 +609,7 @@ struct xen_ia64_opt_feature {
        unsigned long cmd;              /* Which feature */
        unsigned char on;               /* Switch feature on/off */
        __anonymous_union {
-               struct {
+               __anonymous_struct {
                                /* The page protection bit mask of the pte.
                                 * This will be or'ed with the pte. */
                        unsigned long pgprot;
index a2650b591692184d7c48fc8f7be67038fe0929c3..1e792843ecc070c807e71e9625b4326bdd15fe0f 100644 (file)
@@ -109,7 +109,7 @@ DECLARE_HVM_SAVE_TYPE(VTIME, 5, struct hvm_hw_ia64_vtime);
 union viosapic_rte
 {
     uint64_t bits;
-    struct {
+    __anonymous_struct {
         uint8_t vector;
 
         uint8_t delivery_mode  : 3;
@@ -143,8 +143,8 @@ DECLARE_HVM_SAVE_TYPE(VIOSAPIC, 6, struct hvm_hw_ia64_viosapic);
  * PM timer
  */
 struct vacpi_regs {
-    union {
-        struct {
+    __anonymous_union {
+        __anonymous_struct {
             uint32_t pm1a_sts:16;/* PM1a_EVT_BLK.PM1a_STS: status register */
             uint32_t pm1a_en:16; /* PM1a_EVT_BLK.PM1a_EN: enable register */
         };
index 73b390998e5643e241867dd98864f8dfdf3a2837..7042ea51a027734210cdee93545e0054e03aef2b 100644 (file)
@@ -144,9 +144,9 @@ struct hvm_hw_cpu {
     uint64_t tsc;
 
     /* pending event, if any */
-    union {
+    __anonymous_union {
         uint32_t pending_event;
-        struct {
+        __anonymous_struct {
             uint8_t  pending_vector:8;
             uint8_t  pending_type:3;
             uint8_t  pending_error_valid:1;
@@ -286,7 +286,7 @@ struct hvm_hw_pci_irqs {
      * Virtual interrupt wires for a single PCI bus.
      * Indexed by: device*4 + INTx#.
      */
-    union {
+    __anonymous_union {
         DECLARE_BITMAP(i, 32*4);
         uint64_t pad[2];
     };
@@ -299,7 +299,7 @@ struct hvm_hw_isa_irqs {
      * Virtual interrupt wires for ISA devices.
      * Indexed by ISA IRQ (assumes no ISA-device IRQ sharing).
      */
-    union {
+    __anonymous_union {
         DECLARE_BITMAP(i, 16);
         uint64_t pad[1];
     };
index d62902e802f6f58addc0c9ab47c46bf19a80dd1f..95562cbc88181172c223e1aa67a2dcc8e0f58368 100644 (file)
 /* 32-/64-bit invariability for control interfaces (domctl/sysctl). */
 #if defined(__XEN__) || defined(__XEN_TOOLS__)
 #undef ___DEFINE_XEN_GUEST_HANDLE
-#define ___DEFINE_XEN_GUEST_HANDLE(name, type)                  \
-    typedef struct { type *p; }                                 \
-        __guest_handle_ ## name;                                \
-    typedef struct { union { type *p; uint64_aligned_t q; }; }  \
+#define ___DEFINE_XEN_GUEST_HANDLE(name, type)                              \
+    typedef struct { type *p; }                                             \
+        __guest_handle_ ## name;                                            \
+    typedef struct { __anonymous_union { type *p; uint64_aligned_t q; }; }  \
         __guest_handle_64_ ## name
 #undef set_xen_guest_handle
 #define set_xen_guest_handle(hnd, val)                      \
index d07f03904bd7178ff2ab42c01f92eefcc4a23ab8..9355596429447199adc4902120e4c2706f9c8dfc 100644 (file)
@@ -142,9 +142,9 @@ struct iret_context {
 
 #ifdef __GNUC__
 /* Anonymous union includes both 32- and 64-bit names (e.g., eax/rax). */
-#define __DECL_REG(name) __extension__ union { \
-    uint64_t r ## name, e ## name; \
-    uint32_t _e ## name; \
+#define __DECL_REG(name) __anonymous_union {    \
+    uint64_t r ## name, e ## name;              \
+    uint32_t _e ## name;                        \
 }
 #else
 /* Non-gcc sources must always use the proper 64-bit name (e.g., rax). */
index 0638901b1fa32fdb236560b092997b4517d5e9e7..a7189e5d6219d36328c5c5093783d66665f5c161 100644 (file)
@@ -140,9 +140,9 @@ struct vcpu_guest_context {
     unsigned long event_callback_eip;
     unsigned long failsafe_callback_eip;
 #ifdef __XEN__
-    union {
+    __anonymous_union {
         unsigned long syscall_callback_eip;
-        struct {
+        __anonymous_struct {
             unsigned int event_callback_cs;    /* compat CS of event cb     */
             unsigned int failsafe_callback_cs; /* compat CS of failsafe cb  */
         };
index cce608606291ec7c942b8ce10687e220d61575cc..bb0ce00685793a894ae63cf7a40796176a8978fa 100644 (file)
 
 #include "xen-compat.h"
 
+#ifdef __GNUC__
+#define __anonymous_union __extension__ union
+#define __anonymous_struct __extension__ union
+#endif
+
 #if defined(__i386__) || defined(__x86_64__)
 #include "arch-x86/xen.h"
 #elif defined(__ia64__)