2 * urcu/uatomic/builtins.h
4 * Copyright (c) 2023 Olivier Dion <odion@efficios.com>
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 #ifndef _URCU_UATOMIC_BUILTINS_H
22 #define _URCU_UATOMIC_BUILTINS_H
24 #include <urcu/arch.h>
26 #if defined(__has_builtin)
27 # if !__has_builtin(__atomic_store_n)
28 # error "Toolchain does not support __atomic_store_n."
30 # if !__has_builtin(__atomic_load_n)
31 # error "Toolchain does not support __atomic_load_n."
33 # if !__has_builtin(__atomic_exchange_n)
34 # error "Toolchain does not support __atomic_exchange_n."
36 # if !__has_builtin(__atomic_compare_exchange_n)
37 # error "Toolchain does not support __atomic_compare_exchange_n."
39 # if !__has_builtin(__atomic_add_fetch)
40 # error "Toolchain does not support __atomic_add_fetch."
42 # if !__has_builtin(__atomic_sub_fetch)
43 # error "Toolchain does not support __atomic_sub_fetch."
45 # if !__has_builtin(__atomic_or_fetch)
46 # error "Toolchain does not support __atomic_or_fetch."
48 # if !__has_builtin(__atomic_thread_fence)
49 # error "Toolchain does not support __atomic_thread_fence."
51 # if !__has_builtin(__atomic_signal_fence)
52 # error "Toolchain does not support __atomic_signal_fence."
54 #elif defined(__GNUC__)
55 # define GCC_VERSION (__GNUC__ * 10000 + \
56 __GNUC_MINOR__ * 100 + \
58 # if GCC_VERSION < 40700
59 # error "GCC version is too old. Version must be 4.7 or greater"
63 # error "Toolchain is not supported."
67 # define UATOMIC_HAS_ATOMIC_BYTE __GCC_ATOMIC_CHAR_LOCK_FREE
68 # define UATOMIC_HAS_ATOMIC_SHORT __GCC_ATOMIC_SHORT_LOCK_FREE
69 #elif defined(__clang__)
70 # define UATOMIC_HAS_ATOMIC_BYTE __CLANG_ATOMIC_CHAR_LOCK_FREE
71 # define UATOMIC_HAS_ATOMIC_SHORT __CLANG_ATOMIC_SHORT_LOCK_FREE
73 /* # define UATOMIC_HAS_ATOMIC_BYTE */
74 /* # define UATOMIC_HAS_ATOMIC_SHORT */
77 #include <urcu/uatomic/builtins-generic.h>
79 #endif /* _URCU_UATOMIC_BUILTINS_H */
This page took 0.030663 seconds and 4 git commands to generate.