uatomic: Fix header guard comment
[urcu.git] / include / urcu / uatomic / builtins.h
1 // SPDX-FileCopyrightText: 2023 Olivier Dion <odion@efficios.com>
2 //
3 // SPDX-License-Identifier: LGPL-2.1-or-later
4
5 /*
6 * urcu/uatomic/builtins.h
7 */
8
9 #ifndef _URCU_UATOMIC_BUILTINS_H
10 #define _URCU_UATOMIC_BUILTINS_H
11
12 #include <urcu/arch.h>
13
14 #if defined(__has_builtin)
15 # if !__has_builtin(__atomic_store_n)
16 # error "Toolchain does not support __atomic_store_n."
17 # endif
18 # if !__has_builtin(__atomic_load_n)
19 # error "Toolchain does not support __atomic_load_n."
20 # endif
21 # if !__has_builtin(__atomic_exchange_n)
22 # error "Toolchain does not support __atomic_exchange_n."
23 # endif
24 # if !__has_builtin(__atomic_compare_exchange_n)
25 # error "Toolchain does not support __atomic_compare_exchange_n."
26 # endif
27 # if !__has_builtin(__atomic_add_fetch)
28 # error "Toolchain does not support __atomic_add_fetch."
29 # endif
30 # if !__has_builtin(__atomic_sub_fetch)
31 # error "Toolchain does not support __atomic_sub_fetch."
32 # endif
33 # if !__has_builtin(__atomic_or_fetch)
34 # error "Toolchain does not support __atomic_or_fetch."
35 # endif
36 # if !__has_builtin(__atomic_thread_fence)
37 # error "Toolchain does not support __atomic_thread_fence."
38 # endif
39 # if !__has_builtin(__atomic_signal_fence)
40 # error "Toolchain does not support __atomic_signal_fence."
41 # endif
42 #elif defined(__GNUC__)
43 # define GCC_VERSION (__GNUC__ * 10000 + \
44 __GNUC_MINOR__ * 100 + \
45 __GNUC_PATCHLEVEL__)
46 # if GCC_VERSION < 40700
47 # error "GCC version is too old. Version must be 4.7 or greater"
48 # endif
49 # undef GCC_VERSION
50 #else
51 # error "Toolchain is not supported."
52 #endif
53
54 #if defined(__GNUC__)
55 # define UATOMIC_HAS_ATOMIC_BYTE __GCC_ATOMIC_CHAR_LOCK_FREE
56 # define UATOMIC_HAS_ATOMIC_SHORT __GCC_ATOMIC_SHORT_LOCK_FREE
57 #elif defined(__clang__)
58 # define UATOMIC_HAS_ATOMIC_BYTE __CLANG_ATOMIC_CHAR_LOCK_FREE
59 # define UATOMIC_HAS_ATOMIC_SHORT __CLANG_ATOMIC_SHORT_LOCK_FREE
60 #else
61 /* # define UATOMIC_HAS_ATOMIC_BYTE */
62 /* # define UATOMIC_HAS_ATOMIC_SHORT */
63 #endif
64
65 #include <urcu/uatomic/builtins-generic.h>
66
67 #endif /* _URCU_UATOMIC_BUILTINS_H */
This page took 0.031061 seconds and 5 git commands to generate.