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.1-testing] Revert all usages of gcc's __extension

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-3.1-testing] Revert all usages of gcc's __extension__ keyword, and instead assert
From: "Xen patchbot-3.1-testing" <patchbot-3.1-testing@xxxxxxxxxxxxxxxxxxx>
Date: Tue, 01 Apr 2008 02:00:32 -0700
Delivery-date: Tue, 01 Apr 2008 02:01:38 -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 1206982293 -3600
# Node ID ebe372ba761aa2a75bd7185363d57d45fd12b383
# Parent  b24ae60cf73e36e2938af2aef73e21043f42f185
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           |   12 ++++++------
 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   |    4 ++--
 xen/include/public/xen-compat.h          |    4 ++++
 6 files changed, 18 insertions(+), 10 deletions(-)

diff -r b24ae60cf73e -r ebe372ba761a xen/include/public/arch-ia64.h
--- a/xen/include/public/arch-ia64.h    Mon Mar 31 16:49:23 2008 +0100
+++ b/xen/include/public/arch-ia64.h    Mon Mar 31 17:51:33 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;
 
@@ -243,11 +243,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
     };
@@ -258,7 +258,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
@@ -292,7 +292,7 @@ struct mapped_regs {
             unsigned long rsv6[46];
         };
     };
-    __anonymous_union {
+    union {
         unsigned long  reserved5[128];
         struct {
             unsigned long precover_ifs;
diff -r b24ae60cf73e -r ebe372ba761a xen/include/public/arch-powerpc.h
--- a/xen/include/public/arch-powerpc.h Mon Mar 31 16:49:23 2008 +0100
+++ b/xen/include/public/arch-powerpc.h Mon Mar 31 17:51:33 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 b24ae60cf73e -r ebe372ba761a xen/include/public/arch-x86/xen-x86_64.h
--- a/xen/include/public/arch-x86/xen-x86_64.h  Mon Mar 31 16:49:23 2008 +0100
+++ b/xen/include/public/arch-x86/xen-x86_64.h  Mon Mar 31 17:51:33 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 b24ae60cf73e -r ebe372ba761a xen/include/public/arch-x86/xen.h
--- a/xen/include/public/arch-x86/xen.h Mon Mar 31 16:49:23 2008 +0100
+++ b/xen/include/public/arch-x86/xen.h Mon Mar 31 17:51:33 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 b24ae60cf73e -r ebe372ba761a xen/include/public/foreign/mkheader.py
--- a/xen/include/public/foreign/mkheader.py    Mon Mar 31 16:49:23 2008 +0100
+++ b/xen/include/public/foreign/mkheader.py    Mon Mar 31 17:51:33 2008 +0100
@@ -37,8 +37,8 @@ inttypes["x86_64"] = {
     "xen_pfn_t"     : "__align8__ uint64_t",
 };
 header["x86_64"] = """
-#ifdef __GNUC__
-# define __DECL_REG(name) __extension__ 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 b24ae60cf73e -r ebe372ba761a xen/include/public/xen-compat.h
--- a/xen/include/public/xen-compat.h   Mon Mar 31 16:49:23 2008 +0100
+++ b/xen/include/public/xen-compat.h   Mon Mar 31 17:51:33 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.1-testing] Revert all usages of gcc's __extension__ keyword, and instead assert, Xen patchbot-3.1-testing <=