]>
git.proxmox.com Git - mirror_lxc.git/blob - src/lxc/compiler.h
1 /* SPDX-License-Identifier: LGPL-2.1+ */
3 #ifndef __LXC_COMPILER_H
4 #define __LXC_COMPILER_H
13 #if __STDC_VERSION__ >= 201112L && \
14 !(defined(__STDC_NO_THREADS__) || \
15 (defined(__GNU_LIBRARY__) && __GLIBC__ == 2 && __GLIBC_MINOR__ < 16))
16 #define thread_local _Thread_local
18 #define thread_local __thread
23 #define __fallthrough /* fall through */
27 # if __STDC_VERSION__ >= 201112L
29 # define __noreturn _Noreturn
31 # define __noreturn __attribute__((__noreturn__))
34 # define __noreturn __attribute__((__noreturn__))
36 # define __noreturn __attribute__((noreturn))
41 # define __hot __attribute__((hot))
44 #ifndef __returns_twice
45 #define __returns_twice __attribute__((returns_twice))
48 /* This attribute is required to silence clang warnings */
50 #define __lxc_unused __attribute__ ((unused))
55 /* Indicates taking ownership */
60 /* access attribute */
61 #define __access_r(x, y)
62 #define __access_w(x, y)
63 #define __access_rw(x, y)
65 #ifdef __has_attribute
66 #if __has_attribute(access)
68 #define __access_r(x, y) __attribute__((access(read_only, x, y)))
71 #define __access_w(x, y) __attribute__((access(write_only, x, y)))
74 #define __access_rw(x, y) __attribute__((access(read_write, x, y)))
79 #define __hidden __attribute__((visibility("hidden")))
83 #define __public __attribute__((visibility("default")))
86 #endif /* __LXC_COMPILER_H */