From: Keir Fraser Date: Wed, 26 Mar 2008 10:14:50 +0000 (+0000) Subject: Explicitly tag every anonymous aggregate in the public headers. X-Git-Tag: 3.3.0-rc1~246^2~46 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=d1e5ff74409bc94c940d924a0efb39339e400a8b;p=xen.git Explicitly tag every anonymous aggregate in the public headers. Signed-off-by: Keir Fraser --- diff --git a/tools/include/xen-foreign/mkchecker.py b/tools/include/xen-foreign/mkchecker.py index 66c17b19e9..264bf799b5 100644 --- a/tools/include/xen-foreign/mkchecker.py +++ b/tools/include/xen-foreign/mkchecker.py @@ -19,6 +19,9 @@ f.write(''' #include #include #include + +#define __anonymous_struct __extension__ struct +#define __anonymous_union __extension__ union '''); for a in archs: diff --git a/tools/include/xen-foreign/mkheader.py b/tools/include/xen-foreign/mkheader.py index ba6f98cfce..17873e4842 100644 --- a/tools/include/xen-foreign/mkheader.py +++ b/tools/include/xen-foreign/mkheader.py @@ -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 diff --git a/xen/include/public/arch-ia64.h b/xen/include/public/arch-ia64.h index afb2a52164..d304a46820 100644 --- a/xen/include/public/arch-ia64.h +++ b/xen/include/public/arch-ia64.h @@ -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; diff --git a/xen/include/public/arch-ia64/hvm/save.h b/xen/include/public/arch-ia64/hvm/save.h index a2650b5916..1e792843ec 100644 --- a/xen/include/public/arch-ia64/hvm/save.h +++ b/xen/include/public/arch-ia64/hvm/save.h @@ -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 */ }; diff --git a/xen/include/public/arch-x86/hvm/save.h b/xen/include/public/arch-x86/hvm/save.h index 73b390998e..7042ea51a0 100644 --- a/xen/include/public/arch-x86/hvm/save.h +++ b/xen/include/public/arch-x86/hvm/save.h @@ -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]; }; diff --git a/xen/include/public/arch-x86/xen-x86_32.h b/xen/include/public/arch-x86/xen-x86_32.h index d62902e802..95562cbc88 100644 --- a/xen/include/public/arch-x86/xen-x86_32.h +++ b/xen/include/public/arch-x86/xen-x86_32.h @@ -108,10 +108,10 @@ /* 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) \ diff --git a/xen/include/public/arch-x86/xen-x86_64.h b/xen/include/public/arch-x86/xen-x86_64.h index d07f03904b..9355596429 100644 --- a/xen/include/public/arch-x86/xen-x86_64.h +++ b/xen/include/public/arch-x86/xen-x86_64.h @@ -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). */ diff --git a/xen/include/public/arch-x86/xen.h b/xen/include/public/arch-x86/xen.h index 0638901b1f..a7189e5d62 100644 --- a/xen/include/public/arch-x86/xen.h +++ b/xen/include/public/arch-x86/xen.h @@ -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 */ }; diff --git a/xen/include/public/xen.h b/xen/include/public/xen.h index cce6086062..bb0ce00685 100644 --- a/xen/include/public/xen.h +++ b/xen/include/public/xen.h @@ -29,6 +29,11 @@ #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__)