1 #ifndef __LINUX_COMPILER_H
2 #define __LINUX_COMPILER_H
7 # define __user __attribute__((noderef, address_space(1)))
8 # define __kernel /* default address space */
9 # define __safe __attribute__((safe))
10 # define __force __attribute__((force))
11 # define __iomem __attribute__((noderef, address_space(2)))
12 extern void __chk_user_ptr(void __user *);
13 extern void __chk_io_ptr(void __iomem *);
20 # define __chk_user_ptr(x) (void)0
21 # define __chk_io_ptr(x) (void)0
27 # include <linux/compiler-gcc+.h> /* catch-all for GCC 4, 5, etc. */
29 # include <linux/compiler-gcc3.h>
31 # include <linux/compiler-gcc2.h>
33 # error Sorry, your compiler is too old/not recognized.
36 /* Intel compiler defines __GNUC__. So we will overwrite implementations
37 * coming from above header files here
39 #ifdef __INTEL_COMPILER
40 # include <linux/compiler-intel.h>
44 * Generic compiler-dependent macros required for kernel
45 * build go below this comment. Actual compiler/compiler version
46 * specific implementations come from the above header files
49 #define likely(x) __builtin_expect(!!(x), 1)
50 #define unlikely(x) __builtin_expect(!!(x), 0)
52 /* Optimization barrier */
54 # define barrier() __memory_barrier()
58 # define RELOC_HIDE(ptr, off) \
59 ({ unsigned long __ptr; \
60 __ptr = (unsigned long) (ptr); \
61 (typeof(ptr)) (__ptr + (off)); })
64 #endif /* __ASSEMBLY__ */
66 #endif /* __KERNEL__ */
69 * Allow us to mark functions as 'deprecated' and have gcc emit a nice
70 * warning for each use, in hopes of speeding the functions removal.
72 * int __deprecated foo(void)
75 # define __deprecated /* unimplemented */
83 * Allow us to avoid 'defined but not used' warnings on functions and data,
84 * as well as force them to be emitted to the assembly file.
86 * As of gcc 3.3, static functions that are not marked with attribute((used))
87 * may be elided from the assembly file. As of gcc 3.3, static data not so
88 * marked will not be elided, but this may change in a future gcc version.
90 * In prior versions of gcc, such functions and data would be emitted, but
91 * would be warned about except with attribute((unused)).
93 #ifndef __attribute_used__
94 # define __attribute_used__ /* unimplemented */
98 * From the GCC manual:
100 * Many functions have no effects except the return value and their
101 * return value depends only on the parameters and/or global
102 * variables. Such a function can be subject to common subexpression
103 * elimination and loop optimization just as an arithmetic operator
107 #ifndef __attribute_pure__
108 # define __attribute_pure__ /* unimplemented */
112 * From the GCC manual:
114 * Many functions do not examine any values except their arguments,
115 * and have no effects except the return value. Basically this is
116 * just slightly more strict class than the `pure' attribute above,
117 * since function is not allowed to read global memory.
119 * Note that a function that has pointer arguments and examines the
120 * data pointed to must _not_ be declared `const'. Likewise, a
121 * function that calls a non-`const' function usually must not be
122 * `const'. It does not make sense for a `const' function to return
125 #ifndef __attribute_const__
126 # define __attribute_const__ /* unimplemented */
133 #ifndef __always_inline
134 #define __always_inline inline
137 #endif /* __LINUX_COMPILER_H */