# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1206981798 -3600
# Node ID 615ee2933137e057e625ffdb9c84ace56d07881b
# Parent ffcc213f87112a9bcae2524dc9dd08bc13911d8c
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@xxxxxxxxxx>
---
tools/include/xen-foreign/mkchecker.py | 3 ---
tools/include/xen-foreign/mkheader.py | 4 ++--
tools/python/xen/xm/messages/xen-xm.pot | 7 ++++++-
xen/arch/ia64/vmx/save.c | 1 -
xen/arch/ia64/xen/dom_fw_common.c | 1 -
xen/arch/ia64/xen/dom_fw_domu.c | 1 -
xen/include/public/arch-ia64.h | 26 ++++++++++++++------------
xen/include/public/arch-ia64/hvm/save.h | 6 +++---
xen/include/public/arch-powerpc.h | 2 ++
xen/include/public/arch-x86/hvm/save.h | 8 ++++----
xen/include/public/arch-x86/xen-x86_32.h | 8 ++++----
xen/include/public/arch-x86/xen-x86_64.h | 8 ++++----
xen/include/public/arch-x86/xen.h | 6 ++++--
xen/include/public/xen-compat.h | 4 ++++
xen/include/public/xen.h | 5 -----
xen/include/xen/hvm/save.h | 1 +
16 files changed, 48 insertions(+), 43 deletions(-)
diff -r ffcc213f8711 -r 615ee2933137 tools/include/xen-foreign/mkchecker.py
--- a/tools/include/xen-foreign/mkchecker.py Mon Mar 31 16:32:33 2008 +0100
+++ b/tools/include/xen-foreign/mkchecker.py Mon Mar 31 17:43:18 2008 +0100
@@ -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 -r ffcc213f8711 -r 615ee2933137 tools/include/xen-foreign/mkheader.py
--- a/tools/include/xen-foreign/mkheader.py Mon Mar 31 16:32:33 2008 +0100
+++ b/tools/include/xen-foreign/mkheader.py Mon Mar 31 17:43:18 2008 +0100
@@ -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 -r ffcc213f8711 -r 615ee2933137 tools/python/xen/xm/messages/xen-xm.pot
--- a/tools/python/xen/xm/messages/xen-xm.pot Mon Mar 31 16:32:33 2008 +0100
+++ b/tools/python/xen/xm/messages/xen-xm.pot Mon Mar 31 17:43:18 2008 +0100
@@ -8,7 +8,7 @@ msgstr ""
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@xxxxxx>\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 -r ffcc213f8711 -r 615ee2933137 xen/arch/ia64/vmx/save.c
--- a/xen/arch/ia64/vmx/save.c Mon Mar 31 16:32:33 2008 +0100
+++ b/xen/arch/ia64/vmx/save.c Mon Mar 31 17:43:18 2008 +0100
@@ -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 -r ffcc213f8711 -r 615ee2933137 xen/arch/ia64/xen/dom_fw_common.c
--- a/xen/arch/ia64/xen/dom_fw_common.c Mon Mar 31 16:32:33 2008 +0100
+++ b/xen/arch/ia64/xen/dom_fw_common.c Mon Mar 31 17:43:18 2008 +0100
@@ -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 -r ffcc213f8711 -r 615ee2933137 xen/arch/ia64/xen/dom_fw_domu.c
--- a/xen/arch/ia64/xen/dom_fw_domu.c Mon Mar 31 16:32:33 2008 +0100
+++ b/xen/arch/ia64/xen/dom_fw_domu.c Mon Mar 31 17:43:18 2008 +0100
@@ -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 -r ffcc213f8711 -r 615ee2933137 xen/include/public/arch-ia64.h
--- a/xen/include/public/arch-ia64.h Mon Mar 31 16:32:33 2008 +0100
+++ b/xen/include/public/arch-ia64.h Mon Mar 31 17:43:18 2008 +0100
@@ -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_opt_feature {
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 -r ffcc213f8711 -r 615ee2933137 xen/include/public/arch-ia64/hvm/save.h
--- a/xen/include/public/arch-ia64/hvm/save.h Mon Mar 31 16:32:33 2008 +0100
+++ b/xen/include/public/arch-ia64/hvm/save.h Mon Mar 31 17:43:18 2008 +0100
@@ -109,7 +109,7 @@ union viosapic_rte
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, struc
* 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 -r ffcc213f8711 -r 615ee2933137 xen/include/public/arch-powerpc.h
--- a/xen/include/public/arch-powerpc.h Mon Mar 31 16:32:33 2008 +0100
+++ b/xen/include/public/arch-powerpc.h Mon Mar 31 17:43:18 2008 +0100
@@ -21,6 +21,8 @@
*
* Authors: Hollis Blanchard <hollisb@xxxxxxxxxx>
*/
+
+#include "xen.h"
#ifndef __XEN_PUBLIC_ARCH_PPC_64_H__
#define __XEN_PUBLIC_ARCH_PPC_64_H__
diff -r ffcc213f8711 -r 615ee2933137 xen/include/public/arch-x86/hvm/save.h
--- a/xen/include/public/arch-x86/hvm/save.h Mon Mar 31 16:32:33 2008 +0100
+++ b/xen/include/public/arch-x86/hvm/save.h Mon Mar 31 17:43:18 2008 +0100
@@ -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 -r ffcc213f8711 -r 615ee2933137 xen/include/public/arch-x86/xen-x86_32.h
--- a/xen/include/public/arch-x86/xen-x86_32.h Mon Mar 31 16:32:33 2008 +0100
+++ b/xen/include/public/arch-x86/xen-x86_32.h Mon Mar 31 17:43:18 2008 +0100
@@ -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 -r ffcc213f8711 -r 615ee2933137 xen/include/public/arch-x86/xen-x86_64.h
--- a/xen/include/public/arch-x86/xen-x86_64.h Mon Mar 31 16:32:33 2008 +0100
+++ b/xen/include/public/arch-x86/xen-x86_64.h Mon Mar 31 17:43:18 2008 +0100
@@ -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 -r ffcc213f8711 -r 615ee2933137 xen/include/public/arch-x86/xen.h
--- a/xen/include/public/arch-x86/xen.h Mon Mar 31 16:32:33 2008 +0100
+++ b/xen/include/public/arch-x86/xen.h Mon Mar 31 17:43:18 2008 +0100
@@ -23,6 +23,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 -r ffcc213f8711 -r 615ee2933137 xen/include/public/xen-compat.h
--- a/xen/include/public/xen-compat.h Mon Mar 31 16:32:33 2008 +0100
+++ b/xen/include/public/xen-compat.h Mon Mar 31 17:43:18 2008 +0100
@@ -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 -r ffcc213f8711 -r 615ee2933137 xen/include/public/xen.h
--- a/xen/include/public/xen.h Mon Mar 31 16:32:33 2008 +0100
+++ b/xen/include/public/xen.h Mon Mar 31 17:43:18 2008 +0100
@@ -28,11 +28,6 @@
#define __XEN_PUBLIC_XEN_H__
#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"
diff -r ffcc213f8711 -r 615ee2933137 xen/include/xen/hvm/save.h
--- a/xen/include/xen/hvm/save.h Mon Mar 31 16:32:33 2008 +0100
+++ b/xen/include/xen/hvm/save.h Mon Mar 31 17:43:18 2008 +0100
@@ -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>
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|