31#ifndef ETL_PLATFORM_INCLUDED
32#define ETL_PLATFORM_INCLUDED
37#if !defined(__STDC_LIMIT_MACROS)
38 #define __STDC_LIMIT_MACROS
44#if !defined(__STDC_CONSTANT_MACROS)
45 #define __STDC_CONSTANT_MACROS
56#if !defined(ETL_NO_PROFILE_HEADER) && defined(__has_include)
57 #if !__has_include("etl_profile.h")
58 #define ETL_NO_PROFILE_HEADER
62#if !defined(ETL_NO_PROFILE_HEADER)
63 #include "etl_profile.h"
67#define ETL_DO_NOTHING static_cast<void>(0)
70#define ETL_PLATFORM_16BIT (UINT16_MAX == UINTPTR_MAX)
71#define ETL_PLATFORM_32BIT (UINT32_MAX == UINTPTR_MAX)
72#define ETL_PLATFORM_64BIT (UINT64_MAX == UINTPTR_MAX)
76#if (defined(_DEBUG) || defined(DEBUG)) && !defined(ETL_DEBUG)
81 #define ETL_IS_DEBUG_BUILD 1
83 #define ETL_IS_DEBUG_BUILD 0
90#if defined(ETL_NO_STL)
91 #define ETL_USING_STL 0
92 #define ETL_NOT_USING_STL 1
94 #define ETL_USING_STL 1
95 #define ETL_NOT_USING_STL 0
100#if defined(ETL_STLPORT)
101 #define ETL_USING_STLPORT 1
102 #define ETL_NOT_USING_STLPORT 0
104 #define ETL_USING_STLPORT 0
105 #define ETL_NOT_USING_STLPORT 1
111 #define ETL_USING_8BIT_TYPES 1
112 #define ETL_NOT_USING_8BIT_TYPES 0
114 #define ETL_USING_8BIT_TYPES 0
115 #define ETL_NOT_USING_8BIT_TYPES 1
118#define ETL_8BIT_SUPPORT (CHAR_BIT == 8)
122#if defined(ETL_USE_20BIT_TYPES)
123 #define ETL_USING_20BIT_TYPES 1
124 #define ETL_NOT_USING_20BIT_TYPES 0
126 #define ETL_USING_20BIT_TYPES 0
127 #define ETL_NOT_USING_20BIT_TYPES 1
133#if defined(ETL_NO_64BIT_TYPES)
134 #define ETL_USING_64BIT_TYPES 0
135 #define ETL_NOT_USING_64BIT_TYPES 1
137 #define ETL_USING_64BIT_TYPES 1
138 #define ETL_NOT_USING_64BIT_TYPES 0
152#if !ETL_USING_CPP11 || defined(ETL_USE_LEGACY_VARIANT)
153 #define ETL_USING_LEGACY_VARIANT 1
154 #define ETL_NOT_USING_LEGACY_VARIANT 0
156 #define ETL_USING_LEGACY_VARIANT 0
157 #define ETL_NOT_USING_LEGACY_VARIANT 1
162#if !defined(WCHAR_MIN)
163 #define WCHAR_MIN 0x0000
166#if !defined(WCHAR_MAX)
167 #define WCHAR_MAX 0xFFFF
172#if defined(ETL_FORCE_EXPLICIT_STRING_CONVERSION_FROM_CHAR)
173 #define ETL_EXPLICIT_STRING_FROM_CHAR explicit
175 #define ETL_EXPLICIT_STRING_FROM_CHAR
180#if defined(ETL_DISABLE_STRING_TRUNCATION_CHECKS)
181 #define ETL_HAS_STRING_TRUNCATION_CHECKS 0
183 #define ETL_HAS_STRING_TRUNCATION_CHECKS 1
188#if defined(ETL_DISABLE_STRING_CLEAR_AFTER_USE)
189 #define ETL_HAS_STRING_CLEAR_AFTER_USE 0
191 #define ETL_HAS_STRING_CLEAR_AFTER_USE 1
196#if defined(ETL_ENABLE_ERROR_ON_STRING_TRUNCATION)
197 #define ETL_HAS_ERROR_ON_STRING_TRUNCATION 1
199 #define ETL_HAS_ERROR_ON_STRING_TRUNCATION 0
204#if defined(ETL_ISTRING_REPAIR_ENABLE)
205 #define ETL_HAS_ISTRING_REPAIR 1
207 #define ETL_HAS_ISTRING_REPAIR 0
212#if defined(ETL_IVECTOR_REPAIR_ENABLE)
213 #define ETL_HAS_IVECTOR_REPAIR 1
215 #define ETL_HAS_IVECTOR_REPAIR 0
220#if defined(ETL_IDEQUE_REPAIR_ENABLE)
221 #define ETL_HAS_IDEQUE_REPAIR 1
223 #define ETL_HAS_IDEQUE_REPAIR 0
228#if defined(ETL_ICIRCULAR_BUFFER_REPAIR_ENABLE)
229#define ETL_HAS_ICIRCULAR_BUFFER_REPAIR 1
231#define ETL_HAS_ICIRCULAR_BUFFER_REPAIR 0
236#if defined(ETL_THROW_EXCEPTIONS)
237 #define ETL_USING_EXCEPTIONS 1
239 #define ETL_USING_EXCEPTIONS 0
244#if ETL_NO_NULLPTR_SUPPORT
245 #define ETL_HAS_NULLPTR 0
247 #define ETL_HAS_NULLPTR 1
252#if defined(ETL_USE_LEGACY_BITSET)
253 #define ETL_USING_LEGACY_BITSET 1
255 #define ETL_USING_LEGACY_BITSET 0
260#if defined(ETL_ARRAY_VIEW_IS_MUTABLE)
261 #define ETL_HAS_MUTABLE_ARRAY_VIEW 1
263 #define ETL_HAS_MUTABLE_ARRAY_VIEW 0
268#if defined(ETL_MESSAGES_ARE_NOT_VIRTUAL)
269 #define ETL_HAS_VIRTUAL_MESSAGES 0
271 #define ETL_HAS_VIRTUAL_MESSAGES 1
277#if ETL_USING_CPP11 && !defined(ETL_FORCE_NO_ADVANCED_CPP)
278 #define ETL_CONSTEXPR constexpr
279 #define ETL_CONSTEXPR11 constexpr
280 #define ETL_CONSTANT constexpr
281 #define ETL_DELETE = delete
282 #define ETL_EXPLICIT explicit
283 #define ETL_OVERRIDE override
284 #define ETL_FINAL final
285 #define ETL_NORETURN [[noreturn]]
286 #define ETL_MOVE(x) etl::move(x)
287 #define ETL_ENUM_CLASS(name) enum class name
288 #define ETL_ENUM_CLASS_TYPE(name, type) enum class name : type
289 #define ETL_LVALUE_REF_QUALIFIER &
291 #if ETL_USING_EXCEPTIONS
292 #define ETL_NOEXCEPT noexcept
293 #define ETL_NOEXCEPT_EXPR(...) noexcept(__VA_ARGS__)
296 #define ETL_NOEXCEPT_EXPR(...)
299 #define ETL_CONSTEXPR
300 #define ETL_CONSTEXPR11
301 #define ETL_CONSTANT const
308 #define ETL_NOEXCEPT_EXPR(...)
309 #define ETL_MOVE(x) x
310 #define ETL_ENUM_CLASS(name) enum name
311 #define ETL_ENUM_CLASS_TYPE(name, type) enum name
312 #define ETL_LVALUE_REF_QUALIFIER
317#if ETL_USING_CPP14 && !defined(ETL_FORCE_NO_ADVANCED_CPP)
318 #define ETL_CONSTEXPR14 constexpr
319 #define ETL_DEPRECATED [[deprecated]]
320 #define ETL_DEPRECATED_REASON(reason) [[deprecated(reason)]]
322 #define ETL_CONSTEXPR14
323 #define ETL_DEPRECATED
324 #define ETL_DEPRECATED_REASON(reason)
329#if ETL_USING_CPP17 && !defined(ETL_FORCE_NO_ADVANCED_CPP)
330 #define ETL_CONSTEXPR17 constexpr
331 #define ETL_IF_CONSTEXPR constexpr
332 #define ETL_NODISCARD [[nodiscard]]
333 #define ETL_MAYBE_UNUSED [[maybe_unused]]
334 #define ETL_FALLTHROUGH [[fallthrough]]
335 #define ETL_INLINE_VAR inline
337 #define ETL_CONSTEXPR17
338 #define ETL_IF_CONSTEXPR
339 #define ETL_NODISCARD
340 #define ETL_MAYBE_UNUSED
341 #define ETL_FALLTHROUGH
342 #define ETL_INLINE_VAR
347#if ETL_USING_CPP20 && !defined(ETL_FORCE_NO_ADVANCED_CPP)
348 #define ETL_LIKELY [[likely]]
349 #define ETL_UNLIKELY [[unlikely]]
350 #define ETL_CONSTEXPR20 constexpr
351 #define ETL_CONSTEVAL consteval
352 #define ETL_CONSTINIT constinit
353 #define ETL_NO_UNIQUE_ADDRESS [[no_unique_address]]
354 #define ETL_EXPLICIT_EXPR(...) explicit(__VA_ARGS__)
358 #define ETL_CONSTEXPR20
359 #define ETL_CONSTEVAL
360 #define ETL_CONSTINIT
361 #define ETL_NO_UNIQUE_ADDRESS
362 #define ETL_EXPLICIT_EXPR(...) explicit
365#if ETL_USING_CPP20 && ETL_USING_STL
366 #define ETL_CONSTEXPR20_STL constexpr
368 #define ETL_CONSTEXPR20_STL
373#if ETL_USING_CPP23 && !defined(ETL_FORCE_NO_ADVANCED_CPP)
374 #define ETL_ASSUME(expression) [[assume(expression)]]
376 #define ETL_ASSUME ETL_DO_NOTHING
381#if ETL_NO_SMALL_CHAR_SUPPORT
383 typedef uint_least8_t char8_t;
384 #define ETL_HAS_CHAR8_T 1
385 #define ETL_HAS_NATIVE_CHAR8_T 0
388 #define ETL_HAS_CHAR8_T 1
389 #define ETL_HAS_NATIVE_CHAR8_T 1
394#if ETL_NO_LARGE_CHAR_SUPPORT
395 typedef uint_least16_t char16_t;
396 typedef uint_least32_t char32_t;
397 #define ETL_HAS_NATIVE_CHAR16_T 0
398 #define ETL_HAS_NATIVE_CHAR32_T 0
400 #define ETL_HAS_NATIVE_CHAR16_T 1
401 #define ETL_HAS_NATIVE_CHAR32_T 1
406#if !defined(ETL_HAS_STD_ARRAY)
407 #if ETL_USING_STL && ETL_USING_CPP11
408 #define ETL_HAS_STD_ARRAY 1
410 #define ETL_HAS_STD_ARRAY 0
416#if defined(ETL_NO_ATOMICS) || \
417 defined(ETL_TARGET_DEVICE_ARM_CORTEX_M0) || \
418 defined(ETL_TARGET_DEVICE_ARM_CORTEX_M0_PLUS) || \
419 defined(__STDC_NO_ATOMICS__)
420 #define ETL_HAS_ATOMIC 0
422 #if ((ETL_USING_CPP11 && (ETL_USING_STL || defined(ETL_IN_UNIT_TEST))) || \
423 defined(ETL_COMPILER_ARM5) || \
424 defined(ETL_COMPILER_ARM6) || \
425 defined(ETL_COMPILER_GCC) || \
426 defined(ETL_COMPILER_CLANG))
427 #define ETL_HAS_ATOMIC 1
429 #define ETL_HAS_ATOMIC 0
435#if (defined(ETL_FORCE_ETL_INITIALIZER_LIST) && defined(ETL_FORCE_STD_INITIALIZER_LIST))
436 #error ETL_FORCE_ETL_INITIALIZER_LIST and ETL_FORCE_STD_INITIALIZER_LIST both been defined. Choose one or neither.
439#if (ETL_USING_CPP11 && !defined(ETL_NO_INITIALIZER_LIST))
441 #if (ETL_USING_STL && ETL_NOT_USING_STLPORT && !defined(ETL_FORCE_ETL_INITIALIZER_LIST)) || defined(ETL_IN_UNIT_TEST) || defined(ETL_FORCE_STD_INITIALIZER_LIST)
442 #define ETL_HAS_INITIALIZER_LIST 1
445 #if defined(ETL_COMPILER_MICROSOFT) || defined(ETL_COMPILER_GCC) || defined(ETL_COMPILER_CLANG) || \
446 defined(ETL_COMPILER_ARM6) || defined(ETL_COMPILER_ARM7) || defined(ETL_COMPILER_IAR) || \
447 defined(ETL_COMPILER_TEXAS_INSTRUMENTS) || defined(ETL_COMPILER_INTEL)
448 #define ETL_HAS_INITIALIZER_LIST 1
450 #define ETL_HAS_INITIALIZER_LIST 0
454 #define ETL_HAS_INITIALIZER_LIST 0
471 static ETL_CONSTANT
long cplusplus = __cplusplus;
472 static ETL_CONSTANT
int language_standard = ETL_LANGUAGE_STANDARD;
475 static ETL_CONSTANT
bool using_stl = (ETL_USING_STL == 1);
476 static ETL_CONSTANT
bool using_stlport = (ETL_USING_STLPORT == 1);
477 static ETL_CONSTANT
bool using_cpp11 = (ETL_USING_CPP11 == 1);
478 static ETL_CONSTANT
bool using_cpp14 = (ETL_USING_CPP14 == 1);
479 static ETL_CONSTANT
bool using_cpp17 = (ETL_USING_CPP17 == 1);
480 static ETL_CONSTANT
bool using_cpp20 = (ETL_USING_CPP20 == 1);
481 static ETL_CONSTANT
bool using_cpp23 = (ETL_USING_CPP23 == 1);
482 static ETL_CONSTANT
bool using_gcc_compiler = (ETL_USING_GCC_COMPILER == 1);
483 static ETL_CONSTANT
bool using_microsoft_compiler = (ETL_USING_MICROSOFT_COMPILER == 1);
484 static ETL_CONSTANT
bool using_arm5_compiler = (ETL_USING_ARM5_COMPILER == 1);
485 static ETL_CONSTANT
bool using_arm6_compiler = (ETL_USING_ARM6_COMPILER == 1);
486 static ETL_CONSTANT
bool using_arm7_compiler = (ETL_USING_ARM7_COMPILER == 1);
487 static ETL_CONSTANT
bool using_clang_compiler = (ETL_USING_CLANG_COMPILER == 1);
488 static ETL_CONSTANT
bool using_green_hills_compiler = (ETL_USING_GREEN_HILLS_COMPILER == 1);
489 static ETL_CONSTANT
bool using_iar_compiler = (ETL_USING_IAR_COMPILER == 1);
490 static ETL_CONSTANT
bool using_intel_compiler = (ETL_USING_INTEL_COMPILER == 1);
491 static ETL_CONSTANT
bool using_texas_instruments_compiler = (ETL_USING_TEXAS_INSTRUMENTS_COMPILER == 1);
492 static ETL_CONSTANT
bool using_generic_compiler = (ETL_USING_GENERIC_COMPILER == 1);
493 static ETL_CONSTANT
bool using_legacy_bitset = (ETL_USING_LEGACY_BITSET == 1);
494 static ETL_CONSTANT
bool using_exceptions = (ETL_USING_EXCEPTIONS == 1);
497 static ETL_CONSTANT
bool has_initializer_list = (ETL_HAS_INITIALIZER_LIST == 1);
498 static ETL_CONSTANT
bool has_8bit_types = (ETL_USING_8BIT_TYPES == 1);
499 static ETL_CONSTANT
bool has_64bit_types = (ETL_USING_64BIT_TYPES == 1);
500 static ETL_CONSTANT
bool has_atomic = (ETL_HAS_ATOMIC == 1);
501 static ETL_CONSTANT
bool has_nullptr = (ETL_HAS_NULLPTR == 1);
502 static ETL_CONSTANT
bool has_char8_t = (ETL_HAS_CHAR8_T == 1);
503 static ETL_CONSTANT
bool has_native_char8_t = (ETL_HAS_NATIVE_CHAR8_T == 1);
504 static ETL_CONSTANT
bool has_native_char16_t = (ETL_HAS_NATIVE_CHAR16_T == 1);
505 static ETL_CONSTANT
bool has_native_char32_t = (ETL_HAS_NATIVE_CHAR32_T == 1);
506 static ETL_CONSTANT
bool has_string_truncation_checks = (ETL_HAS_STRING_TRUNCATION_CHECKS == 1);
507 static ETL_CONSTANT
bool has_error_on_string_truncation = (ETL_HAS_ERROR_ON_STRING_TRUNCATION == 1);
508 static ETL_CONSTANT
bool has_string_clear_after_use = (ETL_HAS_STRING_CLEAR_AFTER_USE == 1);
509 static ETL_CONSTANT
bool has_istring_repair = (ETL_HAS_ISTRING_REPAIR == 1);
510 static ETL_CONSTANT
bool has_ivector_repair = (ETL_HAS_IVECTOR_REPAIR == 1);
511 static ETL_CONSTANT
bool has_icircular_buffer_repair = (ETL_HAS_ICIRCULAR_BUFFER_REPAIR == 1);
512 static ETL_CONSTANT
bool has_mutable_array_view = (ETL_HAS_MUTABLE_ARRAY_VIEW == 1);
513 static ETL_CONSTANT
bool has_ideque_repair = (ETL_HAS_IDEQUE_REPAIR == 1);
514 static ETL_CONSTANT
bool has_virtual_messages = (ETL_HAS_VIRTUAL_MESSAGES == 1);
517 static ETL_CONSTANT
bool is_debug_build = (ETL_IS_DEBUG_BUILD == 1);
bitset_ext
Definition absolute.h:38