1 | /* |
2 | * Distributed under the Boost Software License, Version 1.0. |
3 | * (See accompanying file LICENSE_1_0.txt or copy at |
4 | * http://www.boost.org/LICENSE_1_0.txt) |
5 | * |
6 | * Copyright (c) 2014 Andrey Semashev |
7 | */ |
8 | /*! |
9 | * \file atomic/capabilities.hpp |
10 | * |
11 | * This header defines feature capabilities macros. |
12 | */ |
13 | |
14 | #ifndef BOOST_ATOMIC_CAPABILITIES_HPP_INCLUDED_ |
15 | #define BOOST_ATOMIC_CAPABILITIES_HPP_INCLUDED_ |
16 | |
17 | #include <boost/atomic/detail/config.hpp> |
18 | #include <boost/atomic/detail/platform.hpp> |
19 | #include <boost/atomic/detail/int_sizes.hpp> |
20 | |
21 | #if !defined(BOOST_ATOMIC_EMULATED) |
22 | #include BOOST_ATOMIC_DETAIL_HEADER(boost/atomic/detail/caps_) |
23 | #endif |
24 | |
25 | #ifdef BOOST_HAS_PRAGMA_ONCE |
26 | #pragma once |
27 | #endif |
28 | |
29 | #ifndef BOOST_ATOMIC_INT8_LOCK_FREE |
30 | #define BOOST_ATOMIC_INT8_LOCK_FREE 0 |
31 | #endif |
32 | |
33 | #ifndef BOOST_ATOMIC_INT16_LOCK_FREE |
34 | #define BOOST_ATOMIC_INT16_LOCK_FREE 0 |
35 | #endif |
36 | |
37 | #ifndef BOOST_ATOMIC_INT32_LOCK_FREE |
38 | #define BOOST_ATOMIC_INT32_LOCK_FREE 0 |
39 | #endif |
40 | |
41 | #ifndef BOOST_ATOMIC_INT64_LOCK_FREE |
42 | #define BOOST_ATOMIC_INT64_LOCK_FREE 0 |
43 | #endif |
44 | |
45 | #ifndef BOOST_ATOMIC_INT128_LOCK_FREE |
46 | #define BOOST_ATOMIC_INT128_LOCK_FREE 0 |
47 | #endif |
48 | |
49 | |
50 | #ifndef BOOST_ATOMIC_CHAR_LOCK_FREE |
51 | #define BOOST_ATOMIC_CHAR_LOCK_FREE BOOST_ATOMIC_INT8_LOCK_FREE |
52 | #endif |
53 | |
54 | #ifndef BOOST_ATOMIC_CHAR16_T_LOCK_FREE |
55 | #define BOOST_ATOMIC_CHAR16_T_LOCK_FREE BOOST_ATOMIC_INT16_LOCK_FREE |
56 | #endif |
57 | |
58 | #ifndef BOOST_ATOMIC_CHAR32_T_LOCK_FREE |
59 | #define BOOST_ATOMIC_CHAR32_T_LOCK_FREE BOOST_ATOMIC_INT32_LOCK_FREE |
60 | #endif |
61 | |
62 | #ifndef BOOST_ATOMIC_WCHAR_T_LOCK_FREE |
63 | #if BOOST_ATOMIC_DETAIL_SIZEOF_WCHAR_T == 1 |
64 | #define BOOST_ATOMIC_WCHAR_T_LOCK_FREE BOOST_ATOMIC_INT8_LOCK_FREE |
65 | #elif BOOST_ATOMIC_DETAIL_SIZEOF_WCHAR_T == 2 |
66 | #define BOOST_ATOMIC_WCHAR_T_LOCK_FREE BOOST_ATOMIC_INT16_LOCK_FREE |
67 | #elif BOOST_ATOMIC_DETAIL_SIZEOF_WCHAR_T == 4 |
68 | #define BOOST_ATOMIC_WCHAR_T_LOCK_FREE BOOST_ATOMIC_INT32_LOCK_FREE |
69 | #elif BOOST_ATOMIC_DETAIL_SIZEOF_WCHAR_T == 8 |
70 | #define BOOST_ATOMIC_WCHAR_T_LOCK_FREE BOOST_ATOMIC_INT64_LOCK_FREE |
71 | #else |
72 | #define BOOST_ATOMIC_WCHAR_T_LOCK_FREE 0 |
73 | #endif |
74 | #endif |
75 | |
76 | #ifndef BOOST_ATOMIC_SHORT_LOCK_FREE |
77 | #if BOOST_ATOMIC_DETAIL_SIZEOF_SHORT == 1 |
78 | #define BOOST_ATOMIC_SHORT_LOCK_FREE BOOST_ATOMIC_INT8_LOCK_FREE |
79 | #elif BOOST_ATOMIC_DETAIL_SIZEOF_SHORT == 2 |
80 | #define BOOST_ATOMIC_SHORT_LOCK_FREE BOOST_ATOMIC_INT16_LOCK_FREE |
81 | #elif BOOST_ATOMIC_DETAIL_SIZEOF_SHORT == 4 |
82 | #define BOOST_ATOMIC_SHORT_LOCK_FREE BOOST_ATOMIC_INT32_LOCK_FREE |
83 | #elif BOOST_ATOMIC_DETAIL_SIZEOF_SHORT == 8 |
84 | #define BOOST_ATOMIC_SHORT_LOCK_FREE BOOST_ATOMIC_INT64_LOCK_FREE |
85 | #else |
86 | #define BOOST_ATOMIC_SHORT_LOCK_FREE 0 |
87 | #endif |
88 | #endif |
89 | |
90 | #ifndef BOOST_ATOMIC_INT_LOCK_FREE |
91 | #if BOOST_ATOMIC_DETAIL_SIZEOF_INT == 1 |
92 | #define BOOST_ATOMIC_INT_LOCK_FREE BOOST_ATOMIC_INT8_LOCK_FREE |
93 | #elif BOOST_ATOMIC_DETAIL_SIZEOF_INT == 2 |
94 | #define BOOST_ATOMIC_INT_LOCK_FREE BOOST_ATOMIC_INT16_LOCK_FREE |
95 | #elif BOOST_ATOMIC_DETAIL_SIZEOF_INT == 4 |
96 | #define BOOST_ATOMIC_INT_LOCK_FREE BOOST_ATOMIC_INT32_LOCK_FREE |
97 | #elif BOOST_ATOMIC_DETAIL_SIZEOF_INT == 8 |
98 | #define BOOST_ATOMIC_INT_LOCK_FREE BOOST_ATOMIC_INT64_LOCK_FREE |
99 | #else |
100 | #define BOOST_ATOMIC_INT_LOCK_FREE 0 |
101 | #endif |
102 | #endif |
103 | |
104 | #ifndef BOOST_ATOMIC_LONG_LOCK_FREE |
105 | #if BOOST_ATOMIC_DETAIL_SIZEOF_LONG == 1 |
106 | #define BOOST_ATOMIC_LONG_LOCK_FREE BOOST_ATOMIC_INT8_LOCK_FREE |
107 | #elif BOOST_ATOMIC_DETAIL_SIZEOF_LONG == 2 |
108 | #define BOOST_ATOMIC_LONG_LOCK_FREE BOOST_ATOMIC_INT16_LOCK_FREE |
109 | #elif BOOST_ATOMIC_DETAIL_SIZEOF_LONG == 4 |
110 | #define BOOST_ATOMIC_LONG_LOCK_FREE BOOST_ATOMIC_INT32_LOCK_FREE |
111 | #elif BOOST_ATOMIC_DETAIL_SIZEOF_LONG == 8 |
112 | #define BOOST_ATOMIC_LONG_LOCK_FREE BOOST_ATOMIC_INT64_LOCK_FREE |
113 | #else |
114 | #define BOOST_ATOMIC_LONG_LOCK_FREE 0 |
115 | #endif |
116 | #endif |
117 | |
118 | #ifndef BOOST_ATOMIC_LLONG_LOCK_FREE |
119 | #if BOOST_ATOMIC_DETAIL_SIZEOF_LLONG == 1 |
120 | #define BOOST_ATOMIC_LLONG_LOCK_FREE BOOST_ATOMIC_INT8_LOCK_FREE |
121 | #elif BOOST_ATOMIC_DETAIL_SIZEOF_LLONG == 2 |
122 | #define BOOST_ATOMIC_LLONG_LOCK_FREE BOOST_ATOMIC_INT16_LOCK_FREE |
123 | #elif BOOST_ATOMIC_DETAIL_SIZEOF_LLONG == 4 |
124 | #define BOOST_ATOMIC_LLONG_LOCK_FREE BOOST_ATOMIC_INT32_LOCK_FREE |
125 | #elif BOOST_ATOMIC_DETAIL_SIZEOF_LLONG == 8 |
126 | #define BOOST_ATOMIC_LLONG_LOCK_FREE BOOST_ATOMIC_INT64_LOCK_FREE |
127 | #else |
128 | #define BOOST_ATOMIC_LLONG_LOCK_FREE 0 |
129 | #endif |
130 | #endif |
131 | |
132 | #ifndef BOOST_ATOMIC_POINTER_LOCK_FREE |
133 | #if (BOOST_ATOMIC_DETAIL_SIZEOF_POINTER + 0) == 8 |
134 | #define BOOST_ATOMIC_POINTER_LOCK_FREE BOOST_ATOMIC_INT64_LOCK_FREE |
135 | #elif (BOOST_ATOMIC_DETAIL_SIZEOF_POINTER + 0) == 4 |
136 | #define BOOST_ATOMIC_POINTER_LOCK_FREE BOOST_ATOMIC_INT32_LOCK_FREE |
137 | #else |
138 | #define BOOST_ATOMIC_POINTER_LOCK_FREE 0 |
139 | #endif |
140 | #endif |
141 | |
142 | #define BOOST_ATOMIC_ADDRESS_LOCK_FREE BOOST_ATOMIC_POINTER_LOCK_FREE |
143 | |
144 | #ifndef BOOST_ATOMIC_BOOL_LOCK_FREE |
145 | // We store bools in 1-byte storage in all backends |
146 | #define BOOST_ATOMIC_BOOL_LOCK_FREE BOOST_ATOMIC_INT8_LOCK_FREE |
147 | #endif |
148 | |
149 | #ifndef BOOST_ATOMIC_FLAG_LOCK_FREE |
150 | #define BOOST_ATOMIC_FLAG_LOCK_FREE BOOST_ATOMIC_BOOL_LOCK_FREE |
151 | #endif |
152 | |
153 | #ifndef BOOST_ATOMIC_THREAD_FENCE |
154 | #define BOOST_ATOMIC_THREAD_FENCE 0 |
155 | #endif |
156 | |
157 | #ifndef BOOST_ATOMIC_SIGNAL_FENCE |
158 | #define BOOST_ATOMIC_SIGNAL_FENCE 0 |
159 | #endif |
160 | |
161 | #endif // BOOST_ATOMIC_CAPABILITIES_HPP_INCLUDED_ |
162 | |