source: GPL/trunk/include/linux/compiler.h@ 424

Last change on this file since 424 was 305, checked in by Paul Smedley, 17 years ago

Update source to ALSA 1.0.16 level

File size: 3.3 KB
Line 
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# define __safe __attribute__((safe))
8#else
9# define __user
10# define __kernel
11# define __safe
12#endif
13
14#define __GNUC__ 3
15
16#ifndef __ASSEMBLY__
17#if __GNUC__ > 3
18# include <linux/compiler-gcc+.h> /* catch-all for GCC 4, 5, etc. */
19#elif __GNUC__ == 3
20# include <linux/compiler-gcc3.h>
21#elif __GNUC__ == 2
22# include <linux/compiler-gcc2.h>
23#else
24# error Sorry, your compiler is too old/not recognized.
25#endif
26
27/* Intel compiler defines __GNUC__. So we will overwrite implementations
28 * coming from above header files here
29 */
30#ifdef __INTEL_COMPILER
31# include <linux/compiler-intel.h>
32#endif
33
34/*
35 * Generic compiler-dependent macros required for kernel
36 * build go below this comment. Actual compiler/compiler version
37 * specific implementations come from the above header files
38 */
39
40#define likely(x) __builtin_expect(!!(x), 1)
41#define unlikely(x) __builtin_expect(!!(x), 0)
42
43/* Optimization barrier */
44#ifndef barrier
45# define barrier() __memory_barrier()
46#endif
47
48#ifndef RELOC_HIDE
49# define RELOC_HIDE(ptr, off) \
50 ({ unsigned long __ptr; \
51 __ptr = (unsigned long) (ptr); \
52 (typeof(ptr)) (__ptr + (off)); })
53#endif
54
55#endif /* __KERNEL__ */
56
57/*
58 * Allow us to mark functions as 'deprecated' and have gcc emit a nice
59 * warning for each use, in hopes of speeding the functions removal.
60 * Usage is:
61 * int __deprecated foo(void)
62 */
63#ifndef __deprecated
64# define __deprecated /* unimplemented */
65#endif
66
67/*
68 * Allow us to avoid 'defined but not used' warnings on functions and data,
69 * as well as force them to be emitted to the assembly file.
70 *
71 * As of gcc 3.3, static functions that are not marked with attribute((used))
72 * may be elided from the assembly file. As of gcc 3.3, static data not so
73 * marked will not be elided, but this may change in a future gcc version.
74 *
75 * In prior versions of gcc, such functions and data would be emitted, but
76 * would be warned about except with attribute((unused)).
77 */
78#ifndef __attribute_used__
79# define __attribute_used__ /* unimplemented */
80#endif
81
82/*
83 * From the GCC manual:
84 *
85 * Many functions have no effects except the return value and their
86 * return value depends only on the parameters and/or global
87 * variables. Such a function can be subject to common subexpression
88 * elimination and loop optimization just as an arithmetic operator
89 * would be.
90 * [...]
91 */
92#ifndef __attribute_pure__
93# define __attribute_pure__ /* unimplemented */
94#endif
95
96/*
97 * From the GCC manual:
98 *
99 * Many functions do not examine any values except their arguments,
100 * and have no effects except the return value. Basically this is
101 * just slightly more strict class than the `pure' attribute above,
102 * since function is not allowed to read global memory.
103 *
104 * Note that a function that has pointer arguments and examines the
105 * data pointed to must _not_ be declared `const'. Likewise, a
106 * function that calls a non-`const' function usually must not be
107 * `const'. It does not make sense for a `const' function to return
108 * `void'.
109 */
110#ifndef __attribute_const__
111# define __attribute_const__ /* unimplemented */
112#endif
113
114#ifndef noinline
115#define noinline
116#endif
117
118#endif /* __LINUX_COMPILER_H */
Note: See TracBrowser for help on using the repository browser.