WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-3.2-testing] Revert all usages of gcc's __extension

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-3.2-testing] Revert all usages of gcc's __extension__ keyword, and instead assert
From: "Xen patchbot-3.2-testing" <patchbot-3.2-testing@xxxxxxxxxxxxxxxxxxx>
Date: Mon, 31 Mar 2008 19:40:29 -0700
Delivery-date: Mon, 31 Mar 2008 19:40:32 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1206982124 -3600
# Node ID 382e8107dfefce855ba092bb53007e1d3a5ce736
# Parent  ca7bfc8f5ea5d39188309fed05afb4b55974df4a
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>
xen-unstable changeset:   17326:615ee2933137e057e625ffdb9c84ace56d07881b
xen-unstable date:        Mon Mar 31 17:43:18 2008 +0100
---
 xen/include/public/arch-ia64.h           |   14 +++++++-------
 xen/include/public/arch-powerpc.h        |    2 ++
 xen/include/public/arch-x86/xen-x86_64.h |    4 ++--
 xen/include/public/arch-x86/xen.h        |    2 ++
 xen/include/public/foreign/mkheader.py   |    2 +-
 xen/include/public/xen-compat.h          |    4 ++++
 6 files changed, 18 insertions(+), 10 deletions(-)

diff -r ca7bfc8f5ea5 -r 382e8107dfef xen/include/public/arch-ia64.h
--- a/xen/include/public/arch-ia64.h    Mon Mar 31 16:40:34 2008 +0100
+++ b/xen/include/public/arch-ia64.h    Mon Mar 31 17:48:44 2008 +0100
@@ -23,6 +23,8 @@
  *
  */
 
+#include "xen.h"
+
 #ifndef __HYPERVISOR_IF_IA64_H__
 #define __HYPERVISOR_IF_IA64_H__
 
@@ -72,8 +74,6 @@ DEFINE_XEN_GUEST_HANDLE(xen_pfn_t);
 #define MAX_VIRT_CPUS 64
 
 #ifndef __ASSEMBLY__
-
-#define __anonymous_union __extension__ union
 
 typedef unsigned long xen_ulong_t;
 
@@ -176,11 +176,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
     };
@@ -191,7 +191,7 @@ struct mapped_regs {
     unsigned long  vpsr;
     unsigned long  vpr;
     unsigned long  reserved4[76];
-    __anonymous_union {
+    union {
         unsigned long  vcr[128];
         struct {
             unsigned long dcr;  // CR0
@@ -225,7 +225,7 @@ struct mapped_regs {
             unsigned long rsv6[46];
         };
     };
-    __anonymous_union {
+    union {
         unsigned long  reserved5[128];
         struct {
             unsigned long precover_ifs;
@@ -619,7 +619,7 @@ struct xen_ia64_opt_feature {
 struct xen_ia64_opt_feature {
        unsigned long cmd;              /* Which feature */
        unsigned char on;               /* Switch feature on/off */
-       __anonymous_union {
+       union {
                struct {
                                /* The page protection bit mask of the pte.
                                 * This will be or'ed with the pte. */
diff -r ca7bfc8f5ea5 -r 382e8107dfef xen/include/public/arch-powerpc.h
--- a/xen/include/public/arch-powerpc.h Mon Mar 31 16:40:34 2008 +0100
+++ b/xen/include/public/arch-powerpc.h Mon Mar 31 17:48:44 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 ca7bfc8f5ea5 -r 382e8107dfef xen/include/public/arch-x86/xen-x86_64.h
--- a/xen/include/public/arch-x86/xen-x86_64.h  Mon Mar 31 16:40:34 2008 +0100
+++ b/xen/include/public/arch-x86/xen-x86_64.h  Mon Mar 31 17:48:44 2008 +0100
@@ -139,9 +139,9 @@ 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) __extension__ union { \
+#define __DECL_REG(name) union { \
     uint64_t r ## name, e ## name; \
     uint32_t _e ## name; \
 }
diff -r ca7bfc8f5ea5 -r 382e8107dfef xen/include/public/arch-x86/xen.h
--- a/xen/include/public/arch-x86/xen.h Mon Mar 31 16:40:34 2008 +0100
+++ b/xen/include/public/arch-x86/xen.h Mon Mar 31 17:48:44 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__
diff -r ca7bfc8f5ea5 -r 382e8107dfef xen/include/public/foreign/mkheader.py
--- a/xen/include/public/foreign/mkheader.py    Mon Mar 31 16:40:34 2008 +0100
+++ b/xen/include/public/foreign/mkheader.py    Mon Mar 31 17:48:44 2008 +0100
@@ -37,7 +37,7 @@ inttypes["x86_64"] = {
     "xen_pfn_t"     : "__align8__ uint64_t",
 };
 header["x86_64"] = """
-#ifdef __GNUC__
+#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
 # define __DECL_REG(name) __extension__ union { uint64_t r ## name, e ## name; 
}
 # define __align8__ __attribute__((aligned (8)))
 #else
diff -r ca7bfc8f5ea5 -r 382e8107dfef xen/include/public/xen-compat.h
--- a/xen/include/public/xen-compat.h   Mon Mar 31 16:40:34 2008 +0100
+++ b/xen/include/public/xen-compat.h   Mon Mar 31 17:48:44 2008 +0100
@@ -48,4 +48,8 @@
 #define XEN_GUEST_HANDLE_00030205(type) type *
 #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__ */

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-3.2-testing] Revert all usages of gcc's __extension__ keyword, and instead assert, Xen patchbot-3.2-testing <=