[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] Clean up compiler.h to define a few more things and update



# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID dc3c59367403959b0ae135966c1acfe9678a8f0d
# Parent  d7c99adf8a35212bfe1322b2d237907399ee788a
Clean up compiler.h to define a few more things and update
for gcc4.

Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>

diff -r d7c99adf8a35 -r dc3c59367403 xen/arch/x86/shutdown.c
--- a/xen/arch/x86/shutdown.c   Mon May 01 17:41:02 2006 +0100
+++ b/xen/arch/x86/shutdown.c   Mon May 01 17:44:51 2006 +0100
@@ -41,7 +41,7 @@ static inline void kb_wait(void)
             break;
 }
 
-static void __machine_halt(void *unused) __attribute__((noreturn))
+static void  __attribute__((noreturn)) __machine_halt(void *unused)
 {
     for ( ; ; )
         __asm__ __volatile__ ( "hlt" );
diff -r d7c99adf8a35 -r dc3c59367403 xen/include/asm-ia64/config.h
--- a/xen/include/asm-ia64/config.h     Mon May 01 17:41:02 2006 +0100
+++ b/xen/include/asm-ia64/config.h     Mon May 01 17:44:51 2006 +0100
@@ -79,8 +79,6 @@ extern char _end[]; /* standard ELF symb
 extern char _end[]; /* standard ELF symbol */
 
 // linux/include/linux/compiler.h
-#define __attribute_const__
-#define __user
 //#define __kernel
 //#define __safe
 #define __force
@@ -98,7 +96,6 @@ extern char _end[]; /* standard ELF symb
 // xen/include/asm/config.h
 //#define HZ 1000
 // FIXME SMP: leave SMP for a later time
-#define barrier() __asm__ __volatile__("": : :"memory")
 
 ///////////////////////////////////////////////////////////////
 // xen/include/asm/config.h
diff -r d7c99adf8a35 -r dc3c59367403 xen/include/asm-x86/config.h
--- a/xen/include/asm-x86/config.h      Mon May 01 17:41:02 2006 +0100
+++ b/xen/include/asm-x86/config.h      Mon May 01 17:44:51 2006 +0100
@@ -62,8 +62,6 @@
   ALIGN;                                        \
   name:
 #endif
-
-#define barrier() __asm__ __volatile__("": : :"memory")
 
 /* A power-of-two value greater than or equal to number of hypercalls. */
 #define NR_hypercalls 64
diff -r d7c99adf8a35 -r dc3c59367403 xen/include/asm-x86/uaccess.h
--- a/xen/include/asm-x86/uaccess.h     Mon May 01 17:41:02 2006 +0100
+++ b/xen/include/asm-x86/uaccess.h     Mon May 01 17:44:51 2006 +0100
@@ -7,8 +7,6 @@
 #include <xen/errno.h>
 #include <xen/prefetch.h>
 #include <asm/page.h>
-
-#define __user
 
 #ifdef __x86_64__
 #include <asm/x86_64/uaccess.h>
diff -r d7c99adf8a35 -r dc3c59367403 xen/include/xen/compiler.h
--- a/xen/include/xen/compiler.h        Mon May 01 17:41:02 2006 +0100
+++ b/xen/include/xen/compiler.h        Mon May 01 17:44:51 2006 +0100
@@ -1,17 +1,21 @@
 #ifndef __LINUX_COMPILER_H
 #define __LINUX_COMPILER_H
 
-/* Somewhere in the middle of the GCC 2.96 development cycle, we implemented
-   a mechanism by which the user can annotate likely branch directions and
-   expect the blocks to be reordered appropriately.  Define __builtin_expect
-   to nothing for earlier compilers.  */
-
-#if __GNUC__ == 2 && __GNUC_MINOR__ < 96
-#define __builtin_expect(x, expected_value) (x)
+#if !defined(__GNUC__) || (__GNUC__ < 3)
+#error Sorry, your compiler is too old/not recognized.
 #endif
 
-#define likely(x)      __builtin_expect((x),1)
-#define unlikely(x)    __builtin_expect((x),0)
+#define barrier()     __asm__ __volatile__("": : :"memory")
+
+#define likely(x)     __builtin_expect((x),1)
+#define unlikely(x)   __builtin_expect((x),0)
+
+#define inline        __inline__
+#define always_inline __inline__ __attribute__ ((always_inline))
+#define noinline      __attribute__((noinline))
+
+#define __attribute_pure__  __attribute__((pure))
+#define __attribute_const__ __attribute__((__const__))
 
 #if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)
 #define __attribute_used__ __attribute__((__used__))
@@ -23,6 +27,12 @@
 #define __must_check __attribute__((warn_unused_result))
 #else
 #define __must_check
+#endif
+
+#if __GNUC__ > 3
+#define offsetof(a,b) __builtin_offsetof(a,b)
+#else
+#define offsetof(a,b) ((unsigned long)&(((a *)0)->b))
 #endif
 
 /* This macro obfuscates arithmetic on a variable address so that gcc
diff -r d7c99adf8a35 -r dc3c59367403 xen/include/xen/config.h
--- a/xen/include/xen/config.h  Mon May 01 17:41:02 2006 +0100
+++ b/xen/include/xen/config.h  Mon May 01 17:44:51 2006 +0100
@@ -10,10 +10,7 @@
 #include <asm/config.h>
 
 #define EXPORT_SYMBOL(var)
-#define offsetof(_p,_f) ((unsigned long)&(((_p *)0)->_f))
 #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
-
-#define always_inline __inline__ __attribute__ ((always_inline))
 
 /* Linux syslog levels. */
 #define KERN_NOTICE  ""

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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.