ia64/xen-unstable

changeset 9910:dc3c59367403

Clean up compiler.h to define a few more things and update
for gcc4.

Signed-off-by: Keir Fraser <keir@xensource.com>
author kaf24@firebug.cl.cam.ac.uk
date Mon May 01 17:44:51 2006 +0100 (2006-05-01)
parents d7c99adf8a35
children f6507937cb7c
files xen/arch/x86/shutdown.c xen/include/asm-ia64/config.h xen/include/asm-x86/config.h xen/include/asm-x86/uaccess.h xen/include/xen/compiler.h xen/include/xen/config.h
line diff
     1.1 --- a/xen/arch/x86/shutdown.c	Mon May 01 17:41:02 2006 +0100
     1.2 +++ b/xen/arch/x86/shutdown.c	Mon May 01 17:44:51 2006 +0100
     1.3 @@ -41,7 +41,7 @@ static inline void kb_wait(void)
     1.4              break;
     1.5  }
     1.6  
     1.7 -static void __machine_halt(void *unused) __attribute__((noreturn))
     1.8 +static void  __attribute__((noreturn)) __machine_halt(void *unused)
     1.9  {
    1.10      for ( ; ; )
    1.11          __asm__ __volatile__ ( "hlt" );
     2.1 --- a/xen/include/asm-ia64/config.h	Mon May 01 17:41:02 2006 +0100
     2.2 +++ b/xen/include/asm-ia64/config.h	Mon May 01 17:44:51 2006 +0100
     2.3 @@ -79,8 +79,6 @@ extern struct page_info *mem_map;
     2.4  extern char _end[]; /* standard ELF symbol */
     2.5  
     2.6  // linux/include/linux/compiler.h
     2.7 -#define __attribute_const__
     2.8 -#define __user
     2.9  //#define __kernel
    2.10  //#define __safe
    2.11  #define __force
    2.12 @@ -98,7 +96,6 @@ extern char _end[]; /* standard ELF symb
    2.13  // xen/include/asm/config.h
    2.14  //#define HZ 1000
    2.15  // FIXME SMP: leave SMP for a later time
    2.16 -#define barrier() __asm__ __volatile__("": : :"memory")
    2.17  
    2.18  ///////////////////////////////////////////////////////////////
    2.19  // xen/include/asm/config.h
     3.1 --- a/xen/include/asm-x86/config.h	Mon May 01 17:41:02 2006 +0100
     3.2 +++ b/xen/include/asm-x86/config.h	Mon May 01 17:44:51 2006 +0100
     3.3 @@ -63,8 +63,6 @@
     3.4    name:
     3.5  #endif
     3.6  
     3.7 -#define barrier() __asm__ __volatile__("": : :"memory")
     3.8 -
     3.9  /* A power-of-two value greater than or equal to number of hypercalls. */
    3.10  #define NR_hypercalls 64
    3.11  
     4.1 --- a/xen/include/asm-x86/uaccess.h	Mon May 01 17:41:02 2006 +0100
     4.2 +++ b/xen/include/asm-x86/uaccess.h	Mon May 01 17:44:51 2006 +0100
     4.3 @@ -8,8 +8,6 @@
     4.4  #include <xen/prefetch.h>
     4.5  #include <asm/page.h>
     4.6  
     4.7 -#define __user
     4.8 -
     4.9  #ifdef __x86_64__
    4.10  #include <asm/x86_64/uaccess.h>
    4.11  #else
     5.1 --- a/xen/include/xen/compiler.h	Mon May 01 17:41:02 2006 +0100
     5.2 +++ b/xen/include/xen/compiler.h	Mon May 01 17:44:51 2006 +0100
     5.3 @@ -1,17 +1,21 @@
     5.4  #ifndef __LINUX_COMPILER_H
     5.5  #define __LINUX_COMPILER_H
     5.6  
     5.7 -/* Somewhere in the middle of the GCC 2.96 development cycle, we implemented
     5.8 -   a mechanism by which the user can annotate likely branch directions and
     5.9 -   expect the blocks to be reordered appropriately.  Define __builtin_expect
    5.10 -   to nothing for earlier compilers.  */
    5.11 -
    5.12 -#if __GNUC__ == 2 && __GNUC_MINOR__ < 96
    5.13 -#define __builtin_expect(x, expected_value) (x)
    5.14 +#if !defined(__GNUC__) || (__GNUC__ < 3)
    5.15 +#error Sorry, your compiler is too old/not recognized.
    5.16  #endif
    5.17  
    5.18 -#define likely(x)	__builtin_expect((x),1)
    5.19 -#define unlikely(x)	__builtin_expect((x),0)
    5.20 +#define barrier()     __asm__ __volatile__("": : :"memory")
    5.21 +
    5.22 +#define likely(x)     __builtin_expect((x),1)
    5.23 +#define unlikely(x)   __builtin_expect((x),0)
    5.24 +
    5.25 +#define inline        __inline__
    5.26 +#define always_inline __inline__ __attribute__ ((always_inline))
    5.27 +#define noinline      __attribute__((noinline))
    5.28 +
    5.29 +#define __attribute_pure__  __attribute__((pure))
    5.30 +#define __attribute_const__ __attribute__((__const__))
    5.31  
    5.32  #if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)
    5.33  #define __attribute_used__ __attribute__((__used__))
    5.34 @@ -25,6 +29,12 @@
    5.35  #define __must_check
    5.36  #endif
    5.37  
    5.38 +#if __GNUC__ > 3
    5.39 +#define offsetof(a,b) __builtin_offsetof(a,b)
    5.40 +#else
    5.41 +#define offsetof(a,b) ((unsigned long)&(((a *)0)->b))
    5.42 +#endif
    5.43 +
    5.44  /* This macro obfuscates arithmetic on a variable address so that gcc
    5.45     shouldn't recognize the original var, and make assumptions about it */
    5.46  /*
     6.1 --- a/xen/include/xen/config.h	Mon May 01 17:41:02 2006 +0100
     6.2 +++ b/xen/include/xen/config.h	Mon May 01 17:44:51 2006 +0100
     6.3 @@ -10,11 +10,8 @@
     6.4  #include <asm/config.h>
     6.5  
     6.6  #define EXPORT_SYMBOL(var)
     6.7 -#define offsetof(_p,_f) ((unsigned long)&(((_p *)0)->_f))
     6.8  #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
     6.9  
    6.10 -#define always_inline __inline__ __attribute__ ((always_inline))
    6.11 -
    6.12  /* Linux syslog levels. */
    6.13  #define KERN_NOTICE  ""
    6.14  #define KERN_WARNING ""