Go to the documentation of this file. 1 #ifndef __LINUX_COMPILER_H
2 #define __LINUX_COMPILER_H
7 # define __user __attribute__((noderef, address_space(1)))
8 # define __kernel __attribute__((address_space(0)))
9 # define __safe __attribute__((safe))
10 # define __force __attribute__((force))
11 # define __nocast __attribute__((nocast))
12 # define __iomem __attribute__((noderef, address_space(2)))
13 # define __acquires(x) __attribute__((context(x,0,1)))
14 # define __releases(x) __attribute__((context(x,1,0)))
15 # define __acquire(x) __context__(x,1)
16 # define __release(x) __context__(x,-1)
17 # define __cond_lock(x,c) ((c) ? ({ __acquire(x); 1; }) : 0)
18 # define __percpu __attribute__((noderef, address_space(3)))
19 #ifdef CONFIG_SPARSE_RCU_POINTER
20 # define __rcu __attribute__((noderef, address_space(4)))
33 # define __chk_user_ptr(x) (void)0
34 # define __chk_io_ptr(x) (void)0
35 # define __builtin_warning(x, y...) (1)
36 # define __acquires(x)
37 # define __releases(x)
38 # define __acquire(x) (void)0
39 # define __release(x) (void)0
40 # define __cond_lock(x,c) (c)
51 #define notrace __attribute__((no_instrument_function))
56 #ifdef __INTEL_COMPILER
66 struct ftrace_branch_data {
72 unsigned long correct;
73 unsigned long incorrect;
79 unsigned long miss_hit[2];
87 #if defined(CONFIG_TRACE_BRANCH_PROFILING) \
88 && !defined(DISABLE_BRANCH_PROFILING) && !defined(__CHECKER__)
91 #define likely_notrace(x) __builtin_expect(!!(x), 1)
92 #define unlikely_notrace(x) __builtin_expect(!!(x), 0)
94 #define __branch_check__(x, expect) ({ \
96 static struct ftrace_branch_data \
97 __attribute__((__aligned__(4))) \
98 __attribute__((section("_ftrace_annotated_branch"))) \
104 ______r = likely_notrace(x); \
105 ftrace_likely_update(&______f, ______r, expect); \
115 # define likely(x) (__builtin_constant_p(x) ? !!(x) : __branch_check__(x, 1))
118 # define unlikely(x) (__builtin_constant_p(x) ? !!(x) : __branch_check__(x, 0))
121 #ifdef CONFIG_PROFILE_ALL_BRANCHES
126 #define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
127 #define __trace_if(cond) \
128 if (__builtin_constant_p((cond)) ? !!(cond) : \
131 static struct ftrace_branch_data \
132 __attribute__((__aligned__(4))) \
133 __attribute__((section("_ftrace_branch"))) \
139 ______r = !!(cond); \
140 ______f.miss_hit[______r]++; \
146 # define likely(x) __builtin_expect(!!(x), 1)
147 # define unlikely(x) __builtin_expect(!!(x), 0)
152 # define barrier() __memory_barrier()
157 # define unreachable() do { } while (1)
161 # define RELOC_HIDE(ptr, off) \
162 ({ unsigned long __ptr; \
163 __ptr = (unsigned long) (ptr); \
164 (typeof(ptr)) (__ptr + (off)); })
179 # define __deprecated
183 #define __deprecated_for_modules __deprecated
185 #define __deprecated_for_modules
192 #ifndef CONFIG_ENABLE_MUST_CHECK
196 #ifndef CONFIG_ENABLE_WARN_DEPRECATED
198 #undef __deprecated_for_modules
200 #define __deprecated_for_modules
225 #ifndef __maybe_unused
226 # define __maybe_unused
229 #ifndef __always_unused
230 # define __always_unused
241 #define noinline_for_stack noinline
243 #ifndef __always_inline
244 #define __always_inline inline
263 #ifndef __attribute_const__
264 # define __attribute_const__
278 # define __section(S) __attribute__ ((__section__(#S)))
287 # define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b))
291 #ifndef __compiletime_object_size
292 # define __compiletime_object_size(obj) -1
294 #ifndef __compiletime_warning
295 # define __compiletime_warning(message)
297 #ifndef __compiletime_error
298 # define __compiletime_error(message)
300 #ifndef __linktime_error
301 # define __linktime_error(message)
315 #define ACCESS_ONCE(x) (*(volatile typeof(x) *)&(x))