aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/compiler.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/compiler.h')
-rw-r--r--include/linux/compiler.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index 92669cd182a6..2472740d7ab2 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -170,6 +170,10 @@ void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect);
170 (typeof(ptr)) (__ptr + (off)); }) 170 (typeof(ptr)) (__ptr + (off)); })
171#endif 171#endif
172 172
173#ifndef OPTIMIZER_HIDE_VAR
174#define OPTIMIZER_HIDE_VAR(var) barrier()
175#endif
176
173/* Not-quite-unique ID. */ 177/* Not-quite-unique ID. */
174#ifndef __UNIQUE_ID 178#ifndef __UNIQUE_ID
175# define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __LINE__) 179# define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __LINE__)
@@ -298,6 +302,11 @@ void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect);
298# define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b)) 302# define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b))
299#endif 303#endif
300 304
305/* Is this type a native word size -- useful for atomic operations */
306#ifndef __native_word
307# define __native_word(t) (sizeof(t) == sizeof(int) || sizeof(t) == sizeof(long))
308#endif
309
301/* Compile time object size, -1 for unknown */ 310/* Compile time object size, -1 for unknown */
302#ifndef __compiletime_object_size 311#ifndef __compiletime_object_size
303# define __compiletime_object_size(obj) -1 312# define __compiletime_object_size(obj) -1
@@ -337,6 +346,10 @@ void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect);
337#define compiletime_assert(condition, msg) \ 346#define compiletime_assert(condition, msg) \
338 _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__) 347 _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
339 348
349#define compiletime_assert_atomic_type(t) \
350 compiletime_assert(__native_word(t), \
351 "Need native word sized stores/loads for atomicity.")
352
340/* 353/*
341 * Prevent the compiler from merging or refetching accesses. The compiler 354 * Prevent the compiler from merging or refetching accesses. The compiler
342 * is also forbidden from reordering successive instances of ACCESS_ONCE(), 355 * is also forbidden from reordering successive instances of ACCESS_ONCE(),