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.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index 92669cd182a6..fe7a686dfd8d 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -298,6 +298,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)) 298# define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b))
299#endif 299#endif
300 300
301/* Is this type a native word size -- useful for atomic operations */
302#ifndef __native_word
303# define __native_word(t) (sizeof(t) == sizeof(int) || sizeof(t) == sizeof(long))
304#endif
305
301/* Compile time object size, -1 for unknown */ 306/* Compile time object size, -1 for unknown */
302#ifndef __compiletime_object_size 307#ifndef __compiletime_object_size
303# define __compiletime_object_size(obj) -1 308# define __compiletime_object_size(obj) -1
@@ -337,6 +342,10 @@ void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect);
337#define compiletime_assert(condition, msg) \ 342#define compiletime_assert(condition, msg) \
338 _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__) 343 _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
339 344
345#define compiletime_assert_atomic_type(t) \
346 compiletime_assert(__native_word(t), \
347 "Need native word sized stores/loads for atomicity.")
348
340/* 349/*
341 * Prevent the compiler from merging or refetching accesses. The compiler 350 * Prevent the compiler from merging or refetching accesses. The compiler
342 * is also forbidden from reordering successive instances of ACCESS_ONCE(), 351 * is also forbidden from reordering successive instances of ACCESS_ONCE(),