Rev 4103 | Rev 5270 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4103 | Rev 5056 | ||
---|---|---|---|
Line 61... | Line 61... | ||
61 | */ |
61 | */ |
62 | #ifdef __INTEL_COMPILER |
62 | #ifdef __INTEL_COMPILER |
63 | # include |
63 | # include |
64 | #endif |
64 | #endif |
Line -... | Line 65... | ||
- | 65 | ||
- | 66 | /* Clang compiler defines __GNUC__. So we will overwrite implementations |
|
- | 67 | * coming from above header files here |
|
- | 68 | */ |
|
- | 69 | #ifdef __clang__ |
|
- | 70 | #include |
|
- | 71 | #endif |
|
65 | 72 | ||
66 | /* |
73 | /* |
67 | * Generic compiler-dependent macros required for kernel |
74 | * Generic compiler-dependent macros required for kernel |
68 | * build go below this comment. Actual compiler/compiler version |
75 | * build go below this comment. Actual compiler/compiler version |
69 | * specific implementations come from the above header files |
76 | * specific implementations come from the above header files |
Line 168... | Line 175... | ||
168 | ({ unsigned long __ptr; \ |
175 | ({ unsigned long __ptr; \ |
169 | __ptr = (unsigned long) (ptr); \ |
176 | __ptr = (unsigned long) (ptr); \ |
170 | (typeof(ptr)) (__ptr + (off)); }) |
177 | (typeof(ptr)) (__ptr + (off)); }) |
171 | #endif |
178 | #endif |
Line -... | Line 179... | ||
- | 179 | ||
- | 180 | #ifndef OPTIMIZER_HIDE_VAR |
|
- | 181 | #define OPTIMIZER_HIDE_VAR(var) barrier() |
|
- | 182 | #endif |
|
172 | 183 | ||
173 | /* Not-quite-unique ID. */ |
184 | /* Not-quite-unique ID. */ |
174 | #ifndef __UNIQUE_ID |
185 | #ifndef __UNIQUE_ID |
175 | # define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __LINE__) |
186 | # define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __LINE__) |
Line 296... | Line 307... | ||
296 | /* Are two types/vars the same type (ignoring qualifiers)? */ |
307 | /* Are two types/vars the same type (ignoring qualifiers)? */ |
297 | #ifndef __same_type |
308 | #ifndef __same_type |
298 | # define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b)) |
309 | # define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b)) |
299 | #endif |
310 | #endif |
Line -... | Line 311... | ||
- | 311 | ||
- | 312 | /* Is this type a native word size -- useful for atomic operations */ |
|
- | 313 | #ifndef __native_word |
|
- | 314 | # define __native_word(t) (sizeof(t) == sizeof(int) || sizeof(t) == sizeof(long)) |
|
- | 315 | #endif |
|
300 | 316 | ||
301 | /* Compile time object size, -1 for unknown */ |
317 | /* Compile time object size, -1 for unknown */ |
302 | #ifndef __compiletime_object_size |
318 | #ifndef __compiletime_object_size |
303 | # define __compiletime_object_size(obj) -1 |
319 | # define __compiletime_object_size(obj) -1 |
304 | #endif |
320 | #endif |
305 | #ifndef __compiletime_warning |
321 | #ifndef __compiletime_warning |
306 | # define __compiletime_warning(message) |
322 | # define __compiletime_warning(message) |
307 | #endif |
323 | #endif |
308 | #ifndef __compiletime_error |
324 | #ifndef __compiletime_error |
- | 325 | # define __compiletime_error(message) |
|
- | 326 | /* |
|
- | 327 | * Sparse complains of variable sized arrays due to the temporary variable in |
|
- | 328 | * __compiletime_assert. Unfortunately we can't just expand it out to make |
|
- | 329 | * sparse see a constant array size without breaking compiletime_assert on old |
|
- | 330 | * versions of GCC (e.g. 4.2.4), so hide the array from sparse altogether. |
|
- | 331 | */ |
|
309 | # define __compiletime_error(message) |
332 | # ifndef __CHECKER__ |
310 | # define __compiletime_error_fallback(condition) \ |
333 | # define __compiletime_error_fallback(condition) \ |
- | 334 | do { ((void)sizeof(char[1 - 2 * condition])); } while (0) |
|
311 | do { ((void)sizeof(char[1 - 2 * condition])); } while (0) |
335 | # endif |
- | 336 | #endif |
|
312 | #else |
337 | #ifndef __compiletime_error_fallback |
313 | # define __compiletime_error_fallback(condition) do { } while (0) |
338 | # define __compiletime_error_fallback(condition) do { } while (0) |
Line 314... | Line 339... | ||
314 | #endif |
339 | #endif |
315 | 340 | ||
Line 335... | Line 360... | ||
335 | * compiler has support to do so. |
360 | * compiler has support to do so. |
336 | */ |
361 | */ |
337 | #define compiletime_assert(condition, msg) \ |
362 | #define compiletime_assert(condition, msg) \ |
338 | _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__) |
363 | _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__) |
Line -... | Line 364... | ||
- | 364 | ||
- | 365 | #define compiletime_assert_atomic_type(t) \ |
|
- | 366 | compiletime_assert(__native_word(t), \ |
|
- | 367 | "Need native word sized stores/loads for atomicity.") |
|
339 | 368 | ||
340 | /* |
369 | /* |
341 | * Prevent the compiler from merging or refetching accesses. The compiler |
370 | * Prevent the compiler from merging or refetching accesses. The compiler |
342 | * is also forbidden from reordering successive instances of ACCESS_ONCE(), |
371 | * is also forbidden from reordering successive instances of ACCESS_ONCE(), |
343 | * but only when the compiler is aware of some particular ordering. One way |
372 | * but only when the compiler is aware of some particular ordering. One way |
Line 352... | Line 381... | ||
352 | #define ACCESS_ONCE(x) (*(volatile typeof(x) *)&(x)) |
381 | #define ACCESS_ONCE(x) (*(volatile typeof(x) *)&(x)) |
Line 353... | Line 382... | ||
353 | 382 | ||
354 | /* Ignore/forbid kprobes attach on very low level functions marked by this attribute: */ |
383 | /* Ignore/forbid kprobes attach on very low level functions marked by this attribute: */ |
355 | #ifdef CONFIG_KPROBES |
384 | #ifdef CONFIG_KPROBES |
- | 385 | # define __kprobes __attribute__((__section__(".kprobes.text"))) |
|
356 | # define __kprobes __attribute__((__section__(".kprobes.text"))) |
386 | # define nokprobe_inline __always_inline |
357 | #else |
387 | #else |
- | 388 | # define __kprobes |
|
358 | # define __kprobes |
389 | # define nokprobe_inline inline |
359 | #endif |
390 | #endif |