]> xenbits.xensource.com Git - xen.git/commitdiff
Revert all usages of gcc's __extension__ keyword, and instead assert
authorKeir Fraser <keir.fraser@citrix.com>
Mon, 31 Mar 2008 16:43:18 +0000 (17:43 +0100)
committerKeir Fraser <keir.fraser@citrix.com>
Mon, 31 Mar 2008 16:43:18 +0000 (17:43 +0100)
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>
16 files changed:
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

index 264bf799b55ef5cafbcdeddf14571c5a4aae2b63..66c17b19e9f46cc93241a52abe7faad81283cfde 100644 (file)
@@ -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:
index 17873e484221dbaa5692df09f62965e612be09d3..8b249e3dfcbc15299707506d2ebf826607833e15 100644 (file)
@@ -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
index 0a89ea9b278c78ecd19fc52300924f0d7aef23fc..a600a69f0d42015c79c9d50543176b00dc823fb2 100644 (file)
@@ -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 ""
index 2a060678e4bd976d30f21f717e22970416d45a88..f0e9145f91964346ad1fe2f97a19fa641495c6be 100644 (file)
@@ -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)
index 0cb7b76a109affb2d19a206a90b0cdcc29ccaa1b..0460c483f3bd7d83c90cd88de804c48f5b5e49ae 100644 (file)
@@ -21,7 +21,6 @@
 #include <inttypes.h>
 
 #include <xen/xen.h>
-#include <xen/arch-ia64.h>
 #include <asm/bundle.h>
 
 #include "xg_private.h"
index 514e40fc9ccec1bac1bbb8ec55ccc367562be2d7..87b3fe52c375ba50352788e514db696fee776ee6 100644 (file)
@@ -38,7 +38,6 @@
 #include <inttypes.h>
 
 #include <xen/xen.h>
-#include <xen/arch-ia64.h>
 
 #include "xg_private.h"
 #include "xc_dom.h"
index d304a46820846a8f17b3f624a1080e73085099c7..9a1b67200477dc3824f53e0f4b1ea9014debbe46 100644 (file)
@@ -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;
index 1e792843ecc070c807e71e9625b4326bdd15fe0f..a2650b591692184d7c48fc8f7be67038fe0929c3 100644 (file)
@@ -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 */
         };
index be668baec2d6cee7ef76d771bc8f439ed2025530..d92532f3ce1839be64187324217e8e1052c47f6f 100644 (file)
@@ -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__
 
index 7042ea51a027734210cdee93545e0054e03aef2b..73b390998e5643e241867dd98864f8dfdf3a2837 100644 (file)
@@ -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];
     };
index 95562cbc88181172c223e1aa67a2dcc8e0f58368..d62902e802f6f58addc0c9ab47c46bf19a80dd1f 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 { __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)                      \
index 9355596429447199adc4902120e4c2706f9c8dfc..1e54cf92a746118ea207fa03c60a692579b301af 100644 (file)
@@ -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). */
index a7189e5d6219d36328c5c5093783d66665f5c161..5f7579aab1ee35df4d258b3fef2997baa37115f4 100644 (file)
@@ -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  */
         };
index c2894990cd0e7cb2cf5416f3098db7958511b1a1..3514943d82c01c714e5caae9c53d0cd2454a0117 100644 (file)
@@ -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__ */
index bb0ce00685793a894ae63cf7a40796176a8978fa..cce608606291ec7c942b8ce10687e220d61575cc 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__)
index 2842cf08395baf945067dd4a9705687c233029b0..723369e2488e1fa5c10b50e58032a3a19b9688c1 100644 (file)
@@ -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>