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>
This commit is contained in:
Keir Fraser committed 2008-03-31 17:43:18 +01:00
1 parent 0aa49ebc5e
commit efeb49b813
16 files changed
+48 -43

No files matched your search

-3
View 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:
+2 -2
View 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
+6 -1
View 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 ""
-1
View 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)
-1
View 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"
-1
View 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"
+14 -12
View 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;
+3 -3
View 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 */
};
+2
View 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__
+4 -4
View 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];
};
+4 -4
View File
@@ -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) \
+4 -4
View 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). */
+4 -2
View 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 */
};
+4
View 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__ */
-5
View File
@@ -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__)
+1
View 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>
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.