Subversion Repositories shark

Rev

Rev 422 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
422 giacomo 1
#ifndef __LINUX_COMPILER_H
2
#define __LINUX_COMPILER_H
3
 
4
#ifdef __CHECKER__
5
# define __user         __attribute__((noderef, address_space(1)))
6
# define __kernel       /* default address space */
7
#else
8
# define __user
9
# define __kernel
10
#endif
11
 
12
#ifndef __ASSEMBLY__
13
#if __GNUC__ > 3
14
# include <linux/compiler-gcc+.h>       /* catch-all for GCC 4, 5, etc. */
15
#elif __GNUC__ == 3
16
# include <linux/compiler-gcc3.h>
17
#elif __GNUC__ == 2
18
# include <linux/compiler-gcc2.h>
19
#else
20
# error Sorry, your compiler is too old/not recognized.
21
#endif
22
#endif
23
 
24
/* Intel compiler defines __GNUC__. So we will overwrite implementations
25
 * coming from above header files here
26
 */
27
#ifdef __INTEL_COMPILER
28
# include <linux/compiler-intel.h>
29
#endif
30
 
31
/*
32
 * Generic compiler-dependent macros required for kernel
33
 * build go below this comment. Actual compiler/compiler version
34
 * specific implementations come from the above header files
35
 */
36
 
37
#define likely(x)       __builtin_expect(!!(x), 1)
38
#define unlikely(x)     __builtin_expect(!!(x), 0)
39
 
40
/*
41
 * Allow us to mark functions as 'deprecated' and have gcc emit a nice
42
 * warning for each use, in hopes of speeding the functions removal.
43
 * Usage is:
44
 *              int __deprecated foo(void)
45
 */
46
#ifndef __deprecated
47
# define __deprecated           /* unimplemented */
48
#endif
49
 
50
/*
51
 * Allow us to avoid 'defined but not used' warnings on functions and data,
52
 * as well as force them to be emitted to the assembly file.
53
 *
54
 * As of gcc 3.3, static functions that are not marked with attribute((used))
55
 * may be elided from the assembly file.  As of gcc 3.3, static data not so
56
 * marked will not be elided, but this may change in a future gcc version.
57
 *
58
 * In prior versions of gcc, such functions and data would be emitted, but
59
 * would be warned about except with attribute((unused)).
60
 */
61
#ifndef __attribute_used__
62
# define __attribute_used__     /* unimplemented */
63
#endif
64
 
65
/*
66
 * From the GCC manual:
67
 *
68
 * Many functions have no effects except the return value and their
69
 * return value depends only on the parameters and/or global
70
 * variables.  Such a function can be subject to common subexpression
71
 * elimination and loop optimization just as an arithmetic operator
72
 * would be.
73
 * [...]
74
 */
75
#ifndef __attribute_pure__
76
# define __attribute_pure__     /* unimplemented */
77
#endif
78
 
79
/* Optimization barrier */
80
#ifndef barrier
81
# define barrier() __memory_barrier()
82
#endif
83
 
84
#ifndef RELOC_HIDE
85
# define RELOC_HIDE(ptr, off)                                   \
86
  ({ unsigned long __ptr;                                       \
87
     __ptr = (unsigned long) (ptr);                             \
88
    (typeof(ptr)) (__ptr + (off)); })
89
#endif
90
 
91
#endif /* __LINUX_COMPILER_H */