libuavcan/libuavcan/include/uavcan/build_config.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2014 Pavel Kirienko <pavel.kirienko@gmail.com>
3  */
4 
5 #ifndef UAVCAN_BUILD_CONFIG_HPP_INCLUDED
6 #define UAVCAN_BUILD_CONFIG_HPP_INCLUDED
7 
11 #define UAVCAN_VERSION_MAJOR 1
12 #define UAVCAN_VERSION_MINOR 0
13 
28 #define UAVCAN_CPP17 2017
29 #define UAVCAN_CPP14 2014
30 #define UAVCAN_CPP11 2011
31 #define UAVCAN_CPP03 2003
32 
33 #ifndef UAVCAN_CPP_VERSION
34 # if __cplusplus > 201200
35 # error Unsupported C++ standard. You can explicitly set UAVCAN_CPP_VERSION=UAVCAN_CPP11 to silence this error.
36 # elif (__cplusplus > 201100) || defined(__GXX_EXPERIMENTAL_CXX0X__)
37 # define UAVCAN_CPP_VERSION UAVCAN_CPP11
38 # else
39 # define UAVCAN_CPP_VERSION UAVCAN_CPP03
40 # endif
41 #endif
42 
47 #ifndef UAVCAN_NULLPTR
48 # if UAVCAN_CPP_VERSION >= UAVCAN_CPP11
49 # define UAVCAN_NULLPTR nullptr
50 # else
51 # define UAVCAN_NULLPTR NULL
52 # endif
53 #endif
54 
60 #ifndef UAVCAN_GENERAL_PURPOSE_PLATFORM
61 # if (defined(__linux__) || defined(__linux) || defined(__APPLE__) ||\
62  defined(_WIN64) || defined(_WIN32) || defined(__ANDROID__) ||\
63  defined(_SYSTYPE_BSD) || defined(__FreeBSD__))
64 # define UAVCAN_GENERAL_PURPOSE_PLATFORM 1
65 # else
66 # define UAVCAN_GENERAL_PURPOSE_PLATFORM 0
67 # endif
68 #endif
69 
74 #ifndef UAVCAN_DEBUG
75 # define UAVCAN_DEBUG 0
76 #endif
77 
83 #ifndef UAVCAN_EXCEPTIONS
84 # define UAVCAN_EXCEPTIONS UAVCAN_GENERAL_PURPOSE_PLATFORM
85 #endif
86 
91 #ifndef UAVCAN_NOEXCEPT
92 # if UAVCAN_EXCEPTIONS
93 # if UAVCAN_CPP_VERSION >= UAVCAN_CPP11
94 # define UAVCAN_NOEXCEPT noexcept
95 # else
96 # define UAVCAN_NOEXCEPT throw()
97 # endif
98 # else
99 # define UAVCAN_NOEXCEPT
100 # endif
101 #endif
102 
107 #ifndef UAVCAN_EXPORT
108 # define UAVCAN_EXPORT
109 #endif
110 
117 #ifndef UAVCAN_TINY
118 # define UAVCAN_TINY 0
119 #endif
120 
124 #ifndef UAVCAN_NO_GLOBAL_DATA_TYPE_REGISTRY
125 # define UAVCAN_NO_GLOBAL_DATA_TYPE_REGISTRY 0
126 #endif
127 
132 #ifndef UAVCAN_TOSTRING
133 # if UAVCAN_EXCEPTIONS
134 # define UAVCAN_TOSTRING UAVCAN_GENERAL_PURPOSE_PLATFORM
135 # else
136 # define UAVCAN_TOSTRING 0
137 # endif
138 #endif
139 
140 #if UAVCAN_TOSTRING
141 # if !UAVCAN_EXCEPTIONS
142 # error UAVCAN_TOSTRING requires UAVCAN_EXCEPTIONS
143 # endif
144 # include <string>
145 #endif
146 
152 #ifndef UAVCAN_IMPLEMENT_PLACEMENT_NEW
153 # define UAVCAN_IMPLEMENT_PLACEMENT_NEW 0
154 #endif
155 
160 #ifndef UAVCAN_USE_EXTERNAL_SNPRINTF
161 # define UAVCAN_USE_EXTERNAL_SNPRINTF 0
162 #endif
163 
168 #ifndef UAVCAN_USE_EXTERNAL_FLOAT16_CONVERSION
169 # define UAVCAN_USE_EXTERNAL_FLOAT16_CONVERSION 0
170 #endif
171 
177 #ifndef UAVCAN_ASSERT
178 # ifndef UAVCAN_NO_ASSERTIONS
179 # define UAVCAN_NO_ASSERTIONS 0
180 # endif
181 # if UAVCAN_NO_ASSERTIONS
182 # define UAVCAN_ASSERT(x)
183 # else
184 # define UAVCAN_ASSERT(x) assert(x)
185 # endif
186 #endif
187 
188 #ifndef UAVCAN_LIKELY
189 # if __GNUC__
190 # define UAVCAN_LIKELY(x) __builtin_expect(!!(x), true)
191 # else
192 # define UAVCAN_LIKELY(x) (x)
193 # endif
194 #endif
195 
196 #ifndef UAVCAN_UNLIKELY
197 # if __GNUC__
198 # define UAVCAN_UNLIKELY(x) __builtin_expect(!!(x), false)
199 # else
200 # define UAVCAN_UNLIKELY(x) (x)
201 # endif
202 #endif
203 
204 namespace uavcan
205 {
220 #ifdef UAVCAN_MEM_POOL_BLOCK_SIZE
221 static const unsigned MemPoolBlockSize = UAVCAN_MEM_POOL_BLOCK_SIZE;
223 #elif defined(__BIGGEST_ALIGNMENT__) && (__BIGGEST_ALIGNMENT__ <= 8)
224 static const unsigned MemPoolBlockSize = 56;
226 #else
227 static const unsigned MemPoolBlockSize = 64;
229 #endif
230 
231 #ifdef __BIGGEST_ALIGNMENT__
232 static const unsigned MemPoolAlignment = __BIGGEST_ALIGNMENT__;
233 #else
234 static const unsigned MemPoolAlignment = 16;
235 #endif
236 
238 
243 template <typename T>
245 {
246  static void check()
247  {
248  char dummy[(sizeof(T) <= MemPoolBlockSize) ? 1 : -1] = { '0' };
249  (void)dummy;
250  }
251 };
252 
259 #ifdef UAVCAN_FLOAT_COMPARISON_EPSILON_MULT
260 static const unsigned FloatComparisonEpsilonMult = UAVCAN_FLOAT_COMPARISON_EPSILON_MULT;
261 #else
262 static const unsigned FloatComparisonEpsilonMult = 10;
263 #endif
264 
268 #ifdef UAVCAN_MAX_CAN_ACCEPTANCE_FILTERS
269 static const unsigned MaxCanAcceptanceFilters = UAVCAN_MAX_CAN_ACCEPTANCE_FILTERS;
271 #else
272 static const unsigned MaxCanAcceptanceFilters = 32;
274 #endif
275 
276 }
277 
278 #endif // UAVCAN_BUILD_CONFIG_HPP_INCLUDED
uavcan::FloatComparisonEpsilonMult
static const unsigned FloatComparisonEpsilonMult
Definition: libuavcan/libuavcan/include/uavcan/build_config.hpp:262
uavcan::MemPoolAlignment
static const unsigned MemPoolAlignment
Definition: libuavcan/libuavcan/include/uavcan/build_config.hpp:234
uavcan::MaxCanAcceptanceFilters
static const unsigned MaxCanAcceptanceFilters
Default that should be OK for any platform.
Definition: libuavcan/libuavcan/include/uavcan/build_config.hpp:273
uavcan::IsDynamicallyAllocatable
Definition: libuavcan/libuavcan/include/uavcan/build_config.hpp:244
uavcan::IsDynamicallyAllocatable::check
static void check()
Definition: libuavcan/libuavcan/include/uavcan/build_config.hpp:246
uavcan::_alignment_check_for_MEM_POOL_BLOCK_SIZE
char _alignment_check_for_MEM_POOL_BLOCK_SIZE[((MemPoolBlockSize &(MemPoolAlignment - 1))==0) ? 1 :-1]
Definition: libuavcan/libuavcan/include/uavcan/build_config.hpp:237
UAVCAN_EXPORT
#define UAVCAN_EXPORT
Definition: libuavcan/libuavcan/include/uavcan/build_config.hpp:108
uavcan::MemPoolBlockSize
static const unsigned MemPoolBlockSize
Safe default that should be OK for any platform.
Definition: libuavcan/libuavcan/include/uavcan/build_config.hpp:228
libuavcan_dsdl_compiler.pyratemp.dummy
def dummy(*_, **__)
Definition: pyratemp.py:252
uavcan
Definition: libuavcan/libuavcan/include/uavcan/build_config.hpp:204


uavcan_communicator
Author(s):
autogenerated on Fri Dec 13 2024 03:10:02