Cleanup: Move wrapper/ headers to include/wrapper/
[lttng-modules.git] / include / wrapper / compiler.h
1 /* SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only)
2 *
3 * wrapper/compiler.h
4 *
5 * Copyright (C) 2013 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 */
7
8 #ifndef _LTTNG_WRAPPER_COMPILER_H
9 #define _LTTNG_WRAPPER_COMPILER_H
10
11 #include <linux/compiler.h>
12
13 /*
14 * Don't allow compiling with buggy compiler.
15 */
16
17 #ifdef GCC_VERSION
18
19 /*
20 * http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58854
21 */
22 # ifdef __ARMEL__
23 # if GCC_VERSION >= 40800 && GCC_VERSION <= 40802
24 # error Your gcc version produces clobbered frame accesses
25 # endif
26 # endif
27 #endif
28
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
42 #define __LTTNG_COMPOUND_LITERAL(type, ...) (type[]) { __VA_ARGS__ }
43
44 #endif /* _LTTNG_WRAPPER_COMPILER_H */
This page took 0.029229 seconds and 4 git commands to generate.