aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKeir Fraser <keir.fraser@citrix.com>2008-03-31 17:43:18 +0100
committerKeir Fraser <keir.fraser@citrix.com>2008-03-31 17:43:18 +0100
commitefeb49b8138d9e5d97fda8ded0ce6b0dc21092ff (patch)
treea8a42db1ce90de1601f9f1ea82f44749e8a17ee0
parent0aa49ebc5e3f9061f5e9d2d94ec29a994f663493 (diff)
downloadxen-efeb49b8138d9e5d97fda8ded0ce6b0dc21092ff.tar.gz
xen-efeb49b8138d9e5d97fda8ded0ce6b0dc21092ff.tar.bz2
xen-efeb49b8138d9e5d97fda8ded0ce6b0dc21092ff.zip
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>
-rw-r--r--tools/include/xen-foreign/mkchecker.py3
-rw-r--r--tools/include/xen-foreign/mkheader.py4
-rw-r--r--tools/python/xen/xm/messages/xen-xm.pot7
-rw-r--r--xen/arch/ia64/vmx/save.c1
-rw-r--r--xen/arch/ia64/xen/dom_fw_common.c1
-rw-r--r--xen/arch/ia64/xen/dom_fw_domu.c1
-rw-r--r--xen/include/public/arch-ia64.h26
-rw-r--r--xen/include/public/arch-ia64/hvm/save.h6
-rw-r--r--xen/include/public/arch-powerpc.h2
-rw-r--r--xen/include/public/arch-x86/hvm/save.h8
-rw-r--r--xen/include/public/arch-x86/xen-x86_32.h8
-rw-r--r--xen/include/public/arch-x86/xen-x86_64.h8
-rw-r--r--xen/include/public/arch-x86/xen.h6
-rw-r--r--xen/include/public/xen-compat.h4
-rw-r--r--xen/include/public/xen.h5
-rw-r--r--xen/include/xen/hvm/save.h1
16 files changed, 48 insertions, 43 deletions
diff --git a/tools/include/xen-foreign/mkchecker.py b/tools/include/xen-foreign/mkchecker.py
index 264bf799b5..66c17b19e9 100644
--- a/tools/include/xen-foreign/mkchecker.py
+++ b/tools/include/xen-foreign/mkchecker.py
@@ -19,9 +19,6 @@ 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:
diff --git a/tools/include/xen-foreign/mkheader.py b/tools/include/xen-foreign/mkheader.py
index 17873e4842..8b249e3dfc 100644
--- a/tools/include/xen-foreign/mkheader.py
+++ b/tools/include/xen-foreign/mkheader.py
@@ -37,8 +37,8 @@ inttypes["x86_64"] = {
"xen_pfn_t" : "__align8__ uint64_t",
};
header["x86_64"] = """
-#ifdef __GNUC__
-# define __DECL_REG(name) __anonymous_union { uint64_t r ## name, e ## name; }
+#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
+# define __DECL_REG(name) union { uint64_t r ## name, e ## name; }
# define __align8__ __attribute__((aligned (8)))
#else
# define __DECL_REG(name) uint64_t r ## name
diff --git a/tools/python/xen/xm/messages/xen-xm.pot b/tools/python/xen/xm/messages/xen-xm.pot
index 0a89ea9b27..a600a69f0d 100644
--- a/tools/python/xen/xm/messages/xen-xm.pot
+++ b/tools/python/xen/xm/messages/xen-xm.pot
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2007-04-05 14:17-0400\n"
+"POT-Creation-Date: 2008-03-31 17:40+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -61,3 +61,8 @@ msgid ""
"The network you specified already has a PIF attached to it, and so another "
"one may not be attached."
msgstr ""
+
+#: xen/xm/XenAPI.py:67
+#, python-format
+msgid "%(2)s"
+msgstr ""
diff --git a/xen/arch/ia64/vmx/save.c b/xen/arch/ia64/vmx/save.c
index 2a060678e4..f0e9145f91 100644
--- a/xen/arch/ia64/vmx/save.c
+++ b/xen/arch/ia64/vmx/save.c
@@ -21,7 +21,6 @@
*/
#include <xen/types.h>
-#include <public/xen.h>
#include <xen/hvm/save.h>
void arch_hvm_save(struct domain *d, struct hvm_save_header *hdr)
diff --git a/xen/arch/ia64/xen/dom_fw_common.c b/xen/arch/ia64/xen/dom_fw_common.c
index 0cb7b76a10..0460c483f3 100644
--- a/xen/arch/ia64/xen/dom_fw_common.c
+++ b/xen/arch/ia64/xen/dom_fw_common.c
@@ -21,7 +21,6 @@
#include <inttypes.h>
#include <xen/xen.h>
-#include <xen/arch-ia64.h>
#include <asm/bundle.h>
#include "xg_private.h"
diff --git a/xen/arch/ia64/xen/dom_fw_domu.c b/xen/arch/ia64/xen/dom_fw_domu.c
index 514e40fc9c..87b3fe52c3 100644
--- a/xen/arch/ia64/xen/dom_fw_domu.c
+++ b/xen/arch/ia64/xen/dom_fw_domu.c
@@ -38,7 +38,6 @@
#include <inttypes.h>
#include <xen/xen.h>
-#include <xen/arch-ia64.h>
#include "xg_private.h"
#include "xc_dom.h"
diff --git a/xen/include/public/arch-ia64.h b/xen/include/public/arch-ia64.h
index d304a46820..9a1b672004 100644
--- a/xen/include/public/arch-ia64.h
+++ b/xen/include/public/arch-ia64.h
@@ -23,6 +23,8 @@
*
*/
+#include "xen.h"
+
#ifndef __HYPERVISOR_IF_IA64_H__
#define __HYPERVISOR_IF_IA64_H__
@@ -131,7 +133,7 @@ struct pt_fpreg {
union vac {
unsigned long value;
- __anonymous_struct {
+ struct {
int a_int:1;
int a_from_int_cr:1;
int a_to_int_cr:1;
@@ -146,7 +148,7 @@ typedef union vac vac_t;
union vdc {
unsigned long value;
- __anonymous_struct {
+ struct {
int d_vmsw:1;
int d_extint:1;
int d_ibr_dbr:1;
@@ -165,11 +167,11 @@ struct mapped_regs {
unsigned long reserved1[29];
unsigned long vhpi;
unsigned long reserved2[95];
- __anonymous_union {
+ union {
unsigned long vgr[16];
unsigned long bank1_regs[16]; // bank1 regs (r16-r31) when bank0 active
};
- __anonymous_union {
+ union {
unsigned long vbgr[16];
unsigned long bank0_regs[16]; // bank0 regs (r16-r31) when bank1 active
};
@@ -180,9 +182,9 @@ struct mapped_regs {
unsigned long vpsr;
unsigned long vpr;
unsigned long reserved4[76];
- __anonymous_union {
+ union {
unsigned long vcr[128];
- __anonymous_struct {
+ struct {
unsigned long dcr; // CR0
unsigned long itm;
unsigned long iva;
@@ -214,9 +216,9 @@ struct mapped_regs {
unsigned long rsv6[46];
};
};
- __anonymous_union {
+ union {
unsigned long reserved5[128];
- __anonymous_struct {
+ 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
@@ -302,7 +304,7 @@ struct vcpu_tr_regs {
union vcpu_ar_regs {
unsigned long ar[128];
- __anonymous_struct {
+ struct {
unsigned long kr[8];
unsigned long rsv1[8];
unsigned long rsc;
@@ -339,7 +341,7 @@ union vcpu_ar_regs {
union vcpu_cr_regs {
unsigned long cr[128];
- __anonymous_struct {
+ struct {
unsigned long dcr; // CR0
unsigned long itm;
unsigned long iva;
@@ -608,8 +610,8 @@ struct xen_ia64_boot_param {
struct xen_ia64_opt_feature {
unsigned long cmd; /* Which feature */
unsigned char on; /* Switch feature on/off */
- __anonymous_union {
- __anonymous_struct {
+ union {
+ 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 1e792843ec..a2650b5916 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;
- __anonymous_struct {
+ 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 {
- __anonymous_union {
- __anonymous_struct {
+ union {
+ 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-powerpc.h b/xen/include/public/arch-powerpc.h
index be668baec2..d92532f3ce 100644
--- a/xen/include/public/arch-powerpc.h
+++ b/xen/include/public/arch-powerpc.h
@@ -22,6 +22,8 @@
* Authors: Hollis Blanchard <hollisb@us.ibm.com>
*/
+#include "xen.h"
+
#ifndef __XEN_PUBLIC_ARCH_PPC_64_H__
#define __XEN_PUBLIC_ARCH_PPC_64_H__
diff --git a/xen/include/public/arch-x86/hvm/save.h b/xen/include/public/arch-x86/hvm/save.h
index 7042ea51a0..73b390998e 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 */
- __anonymous_union {
+ union {
uint32_t pending_event;
- __anonymous_struct {
+ 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#.
*/
- __anonymous_union {
+ 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).
*/
- __anonymous_union {
+ 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 95562cbc88..d62902e802 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 { __anonymous_union { type *p; uint64_aligned_t q; }; } \
+#define ___DEFINE_XEN_GUEST_HANDLE(name, type) \
+ typedef struct { type *p; } \
+ __guest_handle_ ## name; \
+ typedef struct { 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 9355596429..1e54cf92a7 100644
--- a/xen/include/public/arch-x86/xen-x86_64.h
+++ b/xen/include/public/arch-x86/xen-x86_64.h
@@ -140,11 +140,11 @@ struct iret_context {
/* Bottom of iret stack frame. */
};
-#ifdef __GNUC__
+#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
/* Anonymous union includes both 32- and 64-bit names (e.g., eax/rax). */
-#define __DECL_REG(name) __anonymous_union { \
- uint64_t r ## name, e ## name; \
- uint32_t _e ## name; \
+#define __DECL_REG(name) 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 a7189e5d62..5f7579aab1 100644
--- a/xen/include/public/arch-x86/xen.h
+++ b/xen/include/public/arch-x86/xen.h
@@ -24,6 +24,8 @@
* Copyright (c) 2004-2006, K A Fraser
*/
+#include "../xen.h"
+
#ifndef __XEN_PUBLIC_ARCH_X86_XEN_H__
#define __XEN_PUBLIC_ARCH_X86_XEN_H__
@@ -140,9 +142,9 @@ struct vcpu_guest_context {
unsigned long event_callback_eip;
unsigned long failsafe_callback_eip;
#ifdef __XEN__
- __anonymous_union {
+ union {
unsigned long syscall_callback_eip;
- __anonymous_struct {
+ 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-compat.h b/xen/include/public/xen-compat.h
index c2894990cd..3514943d82 100644
--- a/xen/include/public/xen-compat.h
+++ b/xen/include/public/xen-compat.h
@@ -41,4 +41,8 @@
#error "These header files do not support the requested interface version."
#endif
+#if defined(__GNUC__) && defined(__STRICT_ANSI__)
+#error "These headers files use GNU extensions when built with GCC."
+#endif
+
#endif /* __XEN_PUBLIC_XEN_COMPAT_H__ */
diff --git a/xen/include/public/xen.h b/xen/include/public/xen.h
index bb0ce00685..cce6086062 100644
--- a/xen/include/public/xen.h
+++ b/xen/include/public/xen.h
@@ -29,11 +29,6 @@
#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__)
diff --git a/xen/include/xen/hvm/save.h b/xen/include/xen/hvm/save.h
index 2842cf0839..723369e248 100644
--- a/xen/include/xen/hvm/save.h
+++ b/xen/include/xen/hvm/save.h
@@ -18,6 +18,7 @@
#ifndef __XEN_HVM_SAVE_H__
#define __XEN_HVM_SAVE_H__
+#include <public/xen.h>
#include <public/hvm/save.h>
#include <asm/types.h>