Loading...
Searching...
No Matches
determine_builtin_support.h
Go to the documentation of this file.
/******************************************************************************
The MIT License(MIT)
Embedded Template Library.
https://github.com/ETLCPP/etl
https://www.etlcpp.com
Copyright(c) 2021 John Wellbelove
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files(the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions :
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
******************************************************************************/
#ifndef ETL_DETERMINE_BUILTIN_SUPPORT_H_INCLUDED
#define ETL_DETERMINE_BUILTIN_SUPPORT_H_INCLUDED
#if defined(ETL_USE_TYPE_TRAITS_BUILTINS) // Set all of them to be true if not
// already defined
#if !defined(ETL_USING_BUILTIN_IS_ASSIGNABLE)
#define ETL_USING_BUILTIN_IS_ASSIGNABLE 1
#endif
#if !defined(ETL_USING_BUILTIN_IS_CONSTRUCTIBLE)
#define ETL_USING_BUILTIN_IS_CONSTRUCTIBLE 1
#endif
#if !defined(ETL_USING_BUILTIN_IS_NOTHROW_CONSTRUCTIBLE)
#define ETL_USING_BUILTIN_IS_NOTHROW_CONSTRUCTIBLE 1
#endif
#if !defined(ETL_USING_BUILTIN_IS_NOTHROW_ASSIGNABLE)
#define ETL_USING_BUILTIN_IS_NOTHROW_ASSIGNABLE 1
#endif
#if !defined(ETL_USING_BUILTIN_IS_TRIVIALLY_CONSTRUCTIBLE)
#define ETL_USING_BUILTIN_IS_TRIVIALLY_CONSTRUCTIBLE 1
#endif
#if !defined(ETL_USING_BUILTIN_IS_TRIVIALLY_DESTRUCTIBLE)
#define ETL_USING_BUILTIN_IS_TRIVIALLY_DESTRUCTIBLE 1
#endif
#if !defined(ETL_USING_BUILTIN_IS_TRIVIALLY_COPYABLE)
#define ETL_USING_BUILTIN_IS_TRIVIALLY_COPYABLE 1
#endif
#if !defined(ETL_USING_BUILTIN_UNDERLYING_TYPE)
#define ETL_USING_BUILTIN_UNDERLYING_TYPE 1
#endif
#if !defined(ETL_USING_BUILTIN_IS_CONSTANT_EVALUATED)
#define ETL_USING_BUILTIN_IS_CONSTANT_EVALUATED 1
#endif
#endif
#if defined(ETL_USE_BUILTIN_MEM_FUNCTIONS) // Set all of them to be true if not
// already defined
#if !defined(ETL_USING_BUILTIN_MEMCPY)
#define ETL_USING_BUILTIN_MEMCPY 1
#endif
#if !defined(ETL_USING_BUILTIN_MEMMOVE)
#define ETL_USING_BUILTIN_MEMMOVE 1
#endif
#if !defined(ETL_USING_BUILTIN_MEMSET)
#define ETL_USING_BUILTIN_MEMSET 1
#endif
#if !defined(ETL_USING_BUILTIN_MEMCMP)
#define ETL_USING_BUILTIN_MEMCMP 1
#endif
#if !defined(ETL_USING_BUILTIN_MEMCHR)
#define ETL_USING_BUILTIN_MEMCHR 1
#endif
#endif
#if defined(__has_builtin) && !defined(ETL_COMPILER_MICROSOFT) // Use __has_builtin to check for
// existence of builtin functions?
// Fix VS2022 intellisense issue.
#if !defined(ETL_USING_BUILTIN_IS_ASSIGNABLE)
#define ETL_USING_BUILTIN_IS_ASSIGNABLE __has_builtin(__is_assignable)
#endif
#if !defined(ETL_USING_BUILTIN_IS_CONSTRUCTIBLE)
#define ETL_USING_BUILTIN_IS_CONSTRUCTIBLE __has_builtin(__is_constructible)
#endif
#if !defined(ETL_USING_BUILTIN_IS_NOTHROW_CONSTRUCTIBLE)
#define ETL_USING_BUILTIN_IS_NOTHROW_CONSTRUCTIBLE __has_builtin(__is_nothrow_constructible)
#endif
#if !defined(ETL_USING_BUILTIN_IS_NOTHROW_ASSIGNABLE)
#define ETL_USING_BUILTIN_IS_NOTHROW_ASSIGNABLE __has_builtin(__is_nothrow_assignable)
#endif
#if !defined(ETL_USING_BUILTIN_IS_TRIVIALLY_CONSTRUCTIBLE)
#define ETL_USING_BUILTIN_IS_TRIVIALLY_CONSTRUCTIBLE (__has_builtin(__has_trivial_constructor) || __has_builtin(__is_trivially_constructible))
#endif
#if !defined(ETL_USING_BUILTIN_IS_TRIVIALLY_DESTRUCTIBLE)
#define ETL_USING_BUILTIN_IS_TRIVIALLY_DESTRUCTIBLE (__has_builtin(__has_trivial_destructor) || __has_builtin(__is_trivially_destructible))
#endif
#if !defined(ETL_USING_BUILTIN_IS_TRIVIALLY_COPYABLE)
#define ETL_USING_BUILTIN_IS_TRIVIALLY_COPYABLE (__has_builtin(__has_trivial_copy) || __has_builtin(__is_trivially_copyable))
#endif
#if !defined(ETL_USING_BUILTIN_UNDERLYING_TYPE)
#define ETL_USING_BUILTIN_UNDERLYING_TYPE __has_builtin(__underlying_type)
#endif
#if !defined(ETL_USING_BUILTIN_IS_CONSTANT_EVALUATED)
#define ETL_USING_BUILTIN_IS_CONSTANT_EVALUATED __has_builtin(__builtin_is_constant_evaluated)
#endif
#if !defined(ETL_USING_BUILTIN_MEMCPY)
#define ETL_USING_BUILTIN_MEMCPY __has_builtin(__builtin_memcpy)
#endif
#if !defined(ETL_USING_BUILTIN_MEMMOVE)
#define ETL_USING_BUILTIN_MEMMOVE __has_builtin(__builtin_memmove)
#endif
#if !defined(ETL_USING_BUILTIN_MEMSET)
#define ETL_USING_BUILTIN_MEMSET __has_builtin(__builtin_memset)
#endif
#if !defined(ETL_USING_BUILTIN_MEMCMP)
#define ETL_USING_BUILTIN_MEMCMP __has_builtin(__builtin_memcmp)
#endif
#if !defined(ETL_USING_BUILTIN_MEMCHR)
#define ETL_USING_BUILTIN_MEMCHR __has_builtin(__builtin_memchr)
#endif
#if !defined(ETL_USING_BUILTIN_IS_VIRTUAL_BASE_OF)
#define ETL_USING_BUILTIN_IS_VIRTUAL_BASE_OF __has_builtin(__is_virtual_base_of)
#endif
#if !defined(ETL_USING_BUILTIN_IS_TRIVIALLY_RELOCATABLE)
#define ETL_USING_BUILTIN_IS_TRIVIALLY_RELOCATABLE __has_builtin(__is_trivially_relocatable)
#endif
// __builtin_is_cpp_trivially_relocatable replaces __is_trivially_relocatable by an
// effort of standardization for newer C++ standards
#if !defined(ETL_USING_BUILTIN_BUILTIN_IS_CPP_TRIVIALLY_RELOCATABLE)
#define ETL_USING_BUILTIN_BUILTIN_IS_CPP_TRIVIALLY_RELOCATABLE __has_builtin(__builtin_is_cpp_trivially_relocatable)
#endif
#endif
#if defined(ETL_COMPILER_MICROSOFT) // The Microsoft compiler supports the __is_trivially_copyable
// intrinsic directly. __has_builtin is not used for Microsoft
// (see above) to avoid a VS2022 intellisense issue, so the
// intrinsic is enabled here for the no-STL configuration.
#if !defined(ETL_USING_BUILTIN_IS_TRIVIALLY_COPYABLE)
#define ETL_USING_BUILTIN_IS_TRIVIALLY_COPYABLE 1
#endif
#endif
// The default. Set to 0, if not already set.
#if !defined(ETL_USING_BUILTIN_IS_ASSIGNABLE)
#define ETL_USING_BUILTIN_IS_ASSIGNABLE 0
#endif
#if !defined(ETL_USING_BUILTIN_IS_CONSTRUCTIBLE)
#define ETL_USING_BUILTIN_IS_CONSTRUCTIBLE 0
#endif
#if !defined(ETL_USING_BUILTIN_IS_NOTHROW_CONSTRUCTIBLE)
#define ETL_USING_BUILTIN_IS_NOTHROW_CONSTRUCTIBLE 0
#endif
#if !defined(ETL_USING_BUILTIN_IS_NOTHROW_ASSIGNABLE)
#define ETL_USING_BUILTIN_IS_NOTHROW_ASSIGNABLE 0
#endif
#if !defined(ETL_USING_BUILTIN_IS_TRIVIALLY_CONSTRUCTIBLE)
#define ETL_USING_BUILTIN_IS_TRIVIALLY_CONSTRUCTIBLE 0
#endif
#if !defined(ETL_USING_BUILTIN_IS_TRIVIALLY_DESTRUCTIBLE)
#define ETL_USING_BUILTIN_IS_TRIVIALLY_DESTRUCTIBLE 0
#endif
#if !defined(ETL_USING_BUILTIN_IS_TRIVIALLY_COPYABLE)
#define ETL_USING_BUILTIN_IS_TRIVIALLY_COPYABLE 0
#endif
#if !defined(ETL_USING_BUILTIN_UNDERLYING_TYPE)
#define ETL_USING_BUILTIN_UNDERLYING_TYPE 0
#endif
#if !defined(ETL_USING_BUILTIN_IS_CONSTANT_EVALUATED)
#define ETL_USING_BUILTIN_IS_CONSTANT_EVALUATED 0
#endif
#if !defined(ETL_USING_BUILTIN_MEMCPY)
#define ETL_USING_BUILTIN_MEMCPY 0
#endif
#if !defined(ETL_USING_BUILTIN_MEMMOVE)
#define ETL_USING_BUILTIN_MEMMOVE 0
#endif
#if !defined(ETL_USING_BUILTIN_MEMSET)
#define ETL_USING_BUILTIN_MEMSET 0
#endif
#if !defined(ETL_USING_BUILTIN_MEMCMP)
#define ETL_USING_BUILTIN_MEMCMP 0
#endif
#if !defined(ETL_USING_BUILTIN_MEMCHR)
#define ETL_USING_BUILTIN_MEMCHR 0
#endif
#if !defined(ETL_USING_BUILTIN_IS_VIRTUAL_BASE_OF)
#define ETL_USING_BUILTIN_IS_VIRTUAL_BASE_OF 0
#endif
#if !defined(ETL_USING_BUILTIN_IS_TRIVIALLY_RELOCATABLE)
#define ETL_USING_BUILTIN_IS_TRIVIALLY_RELOCATABLE 0
#endif
#if !defined(ETL_USING_BUILTIN_BUILTIN_IS_CPP_TRIVIALLY_RELOCATABLE)
#define ETL_USING_BUILTIN_BUILTIN_IS_CPP_TRIVIALLY_RELOCATABLE 0
#endif
namespace etl
{
namespace traits
{
// Documentation: https://www.etlcpp.com/etl_traits.html
static ETL_CONSTANT bool using_builtin_is_assignable = (ETL_USING_BUILTIN_IS_ASSIGNABLE == 1);
static ETL_CONSTANT bool using_builtin_is_constructible = (ETL_USING_BUILTIN_IS_CONSTRUCTIBLE == 1);
static ETL_CONSTANT bool using_builtin_is_nothrow_constructible = (ETL_USING_BUILTIN_IS_NOTHROW_CONSTRUCTIBLE == 1);
static ETL_CONSTANT bool using_builtin_is_nothrow_assignable = (ETL_USING_BUILTIN_IS_NOTHROW_ASSIGNABLE == 1);
static ETL_CONSTANT bool using_builtin_is_trivially_constructible = (ETL_USING_BUILTIN_IS_TRIVIALLY_CONSTRUCTIBLE == 1);
static ETL_CONSTANT bool using_builtin_is_trivially_destructible = (ETL_USING_BUILTIN_IS_TRIVIALLY_DESTRUCTIBLE == 1);
static ETL_CONSTANT bool using_builtin_is_trivially_copyable = (ETL_USING_BUILTIN_IS_TRIVIALLY_COPYABLE == 1);
static ETL_CONSTANT bool using_builtin_underlying_type = (ETL_USING_BUILTIN_UNDERLYING_TYPE == 1);
static ETL_CONSTANT bool using_builtin_is_constant_evaluated = (ETL_USING_BUILTIN_IS_CONSTANT_EVALUATED == 1);
static ETL_CONSTANT bool using_builtin_memcpy = (ETL_USING_BUILTIN_MEMCPY == 1);
static ETL_CONSTANT bool using_builtin_memmove = (ETL_USING_BUILTIN_MEMMOVE == 1);
static ETL_CONSTANT bool using_builtin_memset = (ETL_USING_BUILTIN_MEMSET == 1);
static ETL_CONSTANT bool using_builtin_memcmp = (ETL_USING_BUILTIN_MEMCMP == 1);
static ETL_CONSTANT bool using_builtin_memchr = (ETL_USING_BUILTIN_MEMCHR == 1);
static ETL_CONSTANT bool using_builtin_is_virtual_base_of = (ETL_USING_BUILTIN_IS_VIRTUAL_BASE_OF == 1);
static ETL_CONSTANT bool using_builtin_is_trivially_relocatable = (ETL_USING_BUILTIN_IS_TRIVIALLY_RELOCATABLE == 1);
static ETL_CONSTANT bool using_builtin_builtin_is_cpp_trivially_relocatable = (ETL_USING_BUILTIN_BUILTIN_IS_CPP_TRIVIALLY_RELOCATABLE == 1);
} // namespace traits
} // namespace etl
#endif
etl
Definition absolute.h:40