Commit | Line | Data |
---|---|---|
9f36eaed MJ |
1 | /* SPDX-License-Identifier: (GPL-2.0 or LGPL-2.1) |
2 | * | |
40d6e366 MD |
3 | * wrapper/compiler.h |
4 | * | |
5 | * Copyright (C) 2013 Mathieu Desnoyers <mathieu.desnoyers@efficios.com> | |
40d6e366 MD |
6 | */ |
7 | ||
9f36eaed MJ |
8 | #ifndef _LTTNG_WRAPPER_COMPILER_H |
9 | #define _LTTNG_WRAPPER_COMPILER_H | |
10 | ||
40d6e366 MD |
11 | #include <linux/compiler.h> |
12 | ||
13 | /* | |
14 | * Don't allow compiling with buggy compiler. | |
15 | */ | |
16 | ||
cf262f57 MD |
17 | #ifdef GCC_VERSION |
18 | ||
40d6e366 MD |
19 | /* |
20 | * http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58854 | |
21 | */ | |
cf262f57 MD |
22 | # ifdef __ARMEL__ |
23 | # if GCC_VERSION >= 40800 && GCC_VERSION <= 40802 | |
24 | # error Your gcc version produces clobbered frame accesses | |
25 | # endif | |
40d6e366 MD |
26 | # endif |
27 | #endif | |
28 | ||
a8f2d0c7 MJ |
29 | /* |
30 | * READ/WRITE_ONCE were introduced in kernel 3.19 and ACCESS_ONCE | |
31 | * was removed in 4.15. Prefer READ/WRITE but fallback to ACCESS | |
32 | * when they are not available. | |
33 | */ | |
34 | #ifndef READ_ONCE | |
35 | # define READ_ONCE(x) ACCESS_ONCE(x) | |
36 | #endif | |
37 | ||
38 | #ifndef WRITE_ONCE | |
39 | # define WRITE_ONCE(x, val) ({ ACCESS_ONCE(x) = val; }) | |
40 | #endif | |
41 | ||
40d6e366 | 42 | #endif /* _LTTNG_WRAPPER_COMPILER_H */ |