mirror of
https://github.com/ETLCPP/etl.git
synced 2026-10-28 18:07:10 +08:00
Merge branch 'hotfix/issue-303-etl-not-compatible-with-arduino-ide' into development
# Conflicts: # support/Release notes.txt # test/vs2019/etl.vcxproj.filters
This commit is contained in:
commit
4d1f56bf9e
@ -30,7 +30,6 @@ SOFTWARE.
|
||||
#define ETL_CALLBACK_TIMER_INCLUDED
|
||||
|
||||
#include <stdint.h>
|
||||
#include <new>
|
||||
|
||||
#include "platform.h"
|
||||
#include "algorithm.h"
|
||||
@ -40,6 +39,7 @@ SOFTWARE.
|
||||
#include "timer.h"
|
||||
#include "atomic.h"
|
||||
#include "error_handler.h"
|
||||
#include "placement_new.h"
|
||||
|
||||
#if ETL_CPP11_SUPPORTED
|
||||
#include "delegate.h"
|
||||
|
||||
@ -34,14 +34,10 @@ SOFTWARE.
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <new>
|
||||
|
||||
#include "platform.h"
|
||||
|
||||
#include "algorithm.h"
|
||||
#include "iterator.h"
|
||||
#include "utility.h"
|
||||
|
||||
#include "container.h"
|
||||
#include "memory.h"
|
||||
#include "exception.h"
|
||||
@ -50,6 +46,7 @@ SOFTWARE.
|
||||
#include "algorithm.h"
|
||||
#include "type_traits.h"
|
||||
#include "iterator.h"
|
||||
#include "placement_new.h"
|
||||
|
||||
#if ETL_CPP11_SUPPORTED && ETL_NOT_USING_STLPORT && ETL_USING_STL
|
||||
#include <initializer_list>
|
||||
|
||||
@ -33,7 +33,7 @@ SOFTWARE.
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <new>
|
||||
#include "private/new.h"
|
||||
|
||||
#include "platform.h"
|
||||
#include "utility.h"
|
||||
|
||||
@ -31,11 +31,10 @@ SOFTWARE.
|
||||
#ifndef ETL_FLAT_MAP_INCLUDED
|
||||
#define ETL_FLAT_MAP_INCLUDED
|
||||
|
||||
#include <new>
|
||||
|
||||
#include "platform.h"
|
||||
#include "reference_flat_map.h"
|
||||
#include "pool.h"
|
||||
#include "placement_new.h"
|
||||
|
||||
#if ETL_CPP11_SUPPORTED && ETL_NOT_USING_STLPORT && ETL_USING_STL
|
||||
#include <initializer_list>
|
||||
|
||||
@ -31,12 +31,11 @@ SOFTWARE.
|
||||
#ifndef ETL_FLAT_MULTMAP_INCLUDED
|
||||
#define ETL_FLAT_MULTMAP_INCLUDED
|
||||
|
||||
#include <new>
|
||||
|
||||
#include "platform.h"
|
||||
#include "reference_flat_multimap.h"
|
||||
#include "pool.h"
|
||||
#include "utility.h"
|
||||
#include "placement_new.h"
|
||||
|
||||
#if ETL_CPP11_SUPPORTED && ETL_NOT_USING_STLPORT && ETL_USING_STL
|
||||
#include <initializer_list>
|
||||
|
||||
@ -34,6 +34,7 @@ SOFTWARE.
|
||||
#include "platform.h"
|
||||
#include "reference_flat_multiset.h"
|
||||
#include "pool.h"
|
||||
#include "placement_new.h"
|
||||
|
||||
#if ETL_CPP11_SUPPORTED && ETL_NOT_USING_STLPORT && ETL_USING_STL
|
||||
#include <initializer_list>
|
||||
|
||||
@ -31,11 +31,10 @@ SOFTWARE.
|
||||
#ifndef ETL_FLAT_SET_INCLUDED
|
||||
#define ETL_FLAT_SET_INCLUDED
|
||||
|
||||
#include <new>
|
||||
|
||||
#include "platform.h"
|
||||
#include "reference_flat_set.h"
|
||||
#include "pool.h"
|
||||
#include "placement_new.h"
|
||||
|
||||
#if ETL_CPP11_SUPPORTED && ETL_NOT_USING_STLPORT && ETL_USING_STL
|
||||
#include <initializer_list>
|
||||
|
||||
@ -33,15 +33,11 @@ SOFTWARE.
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#include <new>
|
||||
|
||||
#include "platform.h"
|
||||
|
||||
#include "algorithm.h"
|
||||
#include "iterator.h"
|
||||
#include "functional.h"
|
||||
#include "utility.h"
|
||||
|
||||
#include "pool.h"
|
||||
#include "container.h"
|
||||
#include "exception.h"
|
||||
@ -52,6 +48,7 @@ SOFTWARE.
|
||||
#include "memory.h"
|
||||
#include "iterator.h"
|
||||
#include "static_assert.h"
|
||||
#include "placement_new.h"
|
||||
|
||||
#if ETL_CPP11_SUPPORTED && ETL_NOT_USING_STLPORT && ETL_USING_STL
|
||||
#include <initializer_list>
|
||||
|
||||
@ -235,7 +235,7 @@ namespace etl
|
||||
template <typename TSize>
|
||||
void set_states(etl::ifsm_state** p_states, TSize size)
|
||||
{
|
||||
state_list = p_states;
|
||||
state_list = p_states;
|
||||
number_of_states = etl::fsm_state_id_t(size);
|
||||
|
||||
ETL_ASSERT(number_of_states > 0, ETL_ERROR(etl::fsm_state_list_exception));
|
||||
@ -281,7 +281,7 @@ namespace etl
|
||||
//*******************************************
|
||||
/// Top level message handler for the FSM.
|
||||
//*******************************************
|
||||
void receive(const etl::imessage& message)
|
||||
void receive(const etl::imessage& message) ETL_OVERRIDE
|
||||
{
|
||||
static etl::null_message_router nmr;
|
||||
receive(nmr, message);
|
||||
@ -290,7 +290,7 @@ namespace etl
|
||||
//*******************************************
|
||||
/// Top level message handler for the FSM.
|
||||
//*******************************************
|
||||
void receive(imessage_router& source, etl::message_router_id_t destination_router_id, const etl::imessage& message)
|
||||
void receive(imessage_router& source, etl::message_router_id_t destination_router_id, const etl::imessage& message) ETL_OVERRIDE
|
||||
{
|
||||
if ((destination_router_id == get_message_router_id()) || (destination_router_id == imessage_router::ALL_MESSAGE_ROUTERS))
|
||||
{
|
||||
@ -301,7 +301,7 @@ namespace etl
|
||||
//*******************************************
|
||||
/// Top level message handler for the FSM.
|
||||
//*******************************************
|
||||
void receive(etl::imessage_router& source, const etl::imessage& message)
|
||||
void receive(etl::imessage_router& source, const etl::imessage& message) ETL_OVERRIDE
|
||||
{
|
||||
etl::fsm_state_id_t next_state_id = p_state->process_event(source, message);
|
||||
ETL_ASSERT(next_state_id < number_of_states, ETL_ERROR(etl::fsm_state_id_exception));
|
||||
@ -331,7 +331,7 @@ namespace etl
|
||||
/// Does this FSM accept the message id?
|
||||
/// Yes, it accepts everything!
|
||||
//*******************************************
|
||||
bool accepts(etl::message_id_t) const
|
||||
bool accepts(etl::message_id_t) const ETL_OVERRIDE
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -293,7 +293,7 @@ namespace etl
|
||||
//*******************************************
|
||||
/// Top level message handler for the FSM.
|
||||
//*******************************************
|
||||
void receive(const etl::imessage& message)
|
||||
void receive(const etl::imessage& message) ETL_OVERRIDE
|
||||
{
|
||||
static etl::null_message_router nmr;
|
||||
receive(nmr, message);
|
||||
@ -302,7 +302,7 @@ namespace etl
|
||||
//*******************************************
|
||||
/// Top level message handler for the FSM.
|
||||
//*******************************************
|
||||
void receive(imessage_router& source, etl::message_router_id_t destination_router_id, const etl::imessage& message)
|
||||
void receive(imessage_router& source, etl::message_router_id_t destination_router_id, const etl::imessage& message) ETL_OVERRIDE
|
||||
{
|
||||
if ((destination_router_id == get_message_router_id()) || (destination_router_id == imessage_router::ALL_MESSAGE_ROUTERS))
|
||||
{
|
||||
@ -313,7 +313,7 @@ namespace etl
|
||||
//*******************************************
|
||||
/// Top level message handler for the FSM.
|
||||
//*******************************************
|
||||
void receive(etl::imessage_router& source, const etl::imessage& message)
|
||||
void receive(etl::imessage_router& source, const etl::imessage& message) ETL_OVERRIDE
|
||||
{
|
||||
etl::fsm_state_id_t next_state_id = p_state->process_event(source, message);
|
||||
ETL_ASSERT(next_state_id < number_of_states, ETL_ERROR(etl::fsm_state_id_exception));
|
||||
@ -343,7 +343,7 @@ namespace etl
|
||||
/// Does this FSM accept the message id?
|
||||
/// Yes, it accepts everything!
|
||||
//*******************************************
|
||||
bool accepts(etl::message_id_t) const
|
||||
bool accepts(etl::message_id_t) const ETL_OVERRIDE
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -121,6 +121,17 @@ namespace etl
|
||||
size = etl::size_of<type>::value
|
||||
};
|
||||
};
|
||||
|
||||
#if ETL_CPP14_SUPPORTED
|
||||
template <typename... T>
|
||||
using largest_type_t = typename largest_type<T...>::type;
|
||||
#endif
|
||||
|
||||
#if ETL_CPP17_SUPPORTED
|
||||
template <typename... T>
|
||||
constexpr size_t largest_type_v = largest_type<T...>::size;
|
||||
#endif
|
||||
|
||||
#else
|
||||
/*[[[cog
|
||||
import cog
|
||||
@ -225,6 +236,12 @@ namespace etl
|
||||
value = etl::alignment_of<type>::value
|
||||
};
|
||||
};
|
||||
|
||||
#if ETL_CPP17_SUPPORTED
|
||||
template <typename... T>
|
||||
inline constexpr size_t largest_alignment_v = largest_alignment<T...>::value;
|
||||
#endif
|
||||
|
||||
#else
|
||||
/*[[[cog
|
||||
import cog
|
||||
@ -302,6 +319,11 @@ namespace etl
|
||||
typedef typename etl::smallest_int_for_bits<etl::integral_limits<typename etl::make_signed<T>::type>::bits + 1>::type type;
|
||||
};
|
||||
|
||||
#if ETL_CPP14_SUPPORTED
|
||||
template <typename T>
|
||||
using larger_int_type_t = typename larger_int_type<T>::type;
|
||||
#endif
|
||||
|
||||
//***************************************************************************
|
||||
/// Defines a type that is as larger or larger than the specified type.
|
||||
/// Will return the specified type is there is not a larger type.
|
||||
@ -315,6 +337,11 @@ namespace etl
|
||||
typedef typename etl::smallest_uint_for_bits<etl::integral_limits<typename etl::make_unsigned<T>::type>::bits + 1>::type type;
|
||||
};
|
||||
|
||||
#if ETL_CPP14_SUPPORTED
|
||||
template <typename T>
|
||||
using larger_uint_type_t = typename larger_uint_type<T>::type;
|
||||
#endif
|
||||
|
||||
//***************************************************************************
|
||||
/// Defines a type that is as larger or larger than the specified type.
|
||||
/// Will return the specified type is there is not a larger type.
|
||||
@ -340,6 +367,11 @@ namespace etl
|
||||
typedef typename etl::smallest_int_for_bits<etl::integral_limits<T>::bits + 1>::type type;
|
||||
};
|
||||
|
||||
#if ETL_CPP14_SUPPORTED
|
||||
template <typename T>
|
||||
using larger_type_t = typename larger_type<T>::type;
|
||||
#endif
|
||||
|
||||
#if ETL_CPP11_SUPPORTED && !defined(ETL_LARGEST_FORCE_CPP03)
|
||||
//***************************************************************************
|
||||
/// Template to determine the largest type, size and alignment.
|
||||
@ -357,6 +389,12 @@ namespace etl
|
||||
alignment = etl::largest_alignment<T...>::value
|
||||
};
|
||||
};
|
||||
|
||||
#if ETL_CPP14_SUPPORTED
|
||||
template <typename... T>
|
||||
using largest_t = typename largest<T...>::type;
|
||||
#endif
|
||||
|
||||
#else
|
||||
/*[[[cog
|
||||
import cog
|
||||
|
||||
@ -64,7 +64,6 @@ cog.outl("//********************************************************************
|
||||
#define ETL_MESSAGE_ROUTER_INCLUDED
|
||||
|
||||
#include <stdint.h>
|
||||
#include <new>
|
||||
|
||||
#include "platform.h"
|
||||
#include "message.h"
|
||||
@ -75,6 +74,7 @@ cog.outl("//********************************************************************
|
||||
#include "exception.h"
|
||||
#include "largest.h"
|
||||
#include "nullptr.h"
|
||||
#include "placement_new.h"
|
||||
|
||||
#undef ETL_FILE
|
||||
#define ETL_FILE "35"
|
||||
|
||||
@ -121,6 +121,17 @@ namespace etl
|
||||
size = etl::size_of<type>::value
|
||||
};
|
||||
};
|
||||
|
||||
#if ETL_CPP14_SUPPORTED
|
||||
template <typename... T>
|
||||
using smallest_type_t = typename smallest_type<T...>::type;
|
||||
#endif
|
||||
|
||||
#if ETL_CPP17_SUPPORTED
|
||||
template <typename... T>
|
||||
constexpr size_t smallest_type_v = smallest_type<T...>::size;
|
||||
#endif
|
||||
|
||||
#else
|
||||
/*[[[cog
|
||||
import cog
|
||||
@ -303,7 +314,7 @@ namespace etl
|
||||
/// Defines 'type' which is the type of the smallest unsigned integer.
|
||||
///\ingroup smallest
|
||||
//***************************************************************************
|
||||
template <const size_t NBITS>
|
||||
template <size_t NBITS>
|
||||
struct smallest_uint_for_bits
|
||||
{
|
||||
private:
|
||||
@ -318,13 +329,18 @@ namespace etl
|
||||
typedef typename private_smallest::best_fit_uint_type<TYPE_INDEX>::type type;
|
||||
};
|
||||
|
||||
#if ETL_CPP14_SUPPORTED
|
||||
template <size_t NBITS>
|
||||
using smallest_uint_for_bits_t = typename smallest_uint_for_bits<NBITS>::type;
|
||||
#endif
|
||||
|
||||
//***************************************************************************
|
||||
/// Template to determine the smallest signed int type that can contain a
|
||||
/// value with the specified number of bits.
|
||||
/// Defines 'type' which is the type of the smallest signed integer.
|
||||
///\ingroup smallest
|
||||
//***************************************************************************
|
||||
template <const size_t NBITS>
|
||||
template <size_t NBITS>
|
||||
struct smallest_int_for_bits
|
||||
{
|
||||
private:
|
||||
@ -339,13 +355,18 @@ namespace etl
|
||||
typedef typename private_smallest::best_fit_int_type<TYPE_INDEX>::type type;
|
||||
};
|
||||
|
||||
#if ETL_CPP14_SUPPORTED
|
||||
template <size_t NBITS>
|
||||
using smallest_int_for_bits_t = typename smallest_int_for_bits<NBITS>::type;
|
||||
#endif
|
||||
|
||||
//***************************************************************************
|
||||
/// Template to determine the smallest unsigned int type that can contain the
|
||||
/// specified unsigned value.
|
||||
/// Defines 'type' which is the type of the smallest unsigned integer.
|
||||
///\ingroup smallest
|
||||
//***************************************************************************
|
||||
template <const uintmax_t VALUE>
|
||||
template <uintmax_t VALUE>
|
||||
struct smallest_uint_for_value
|
||||
{
|
||||
private:
|
||||
@ -360,6 +381,11 @@ namespace etl
|
||||
typedef typename private_smallest::best_fit_uint_type<TYPE_INDEX>::type type;
|
||||
};
|
||||
|
||||
#if ETL_CPP14_SUPPORTED
|
||||
template <uintmax_t VALUE>
|
||||
using smallest_uint_for_value_t = typename smallest_uint_for_value<VALUE>::type;
|
||||
#endif
|
||||
|
||||
//***************************************************************************
|
||||
/// Template to determine the smallest int type that can contain the
|
||||
/// specified signed value.
|
||||
@ -372,14 +398,19 @@ namespace etl
|
||||
private:
|
||||
|
||||
// Determines the index of the best signed type for the required value.
|
||||
static const int TYPE_INDEX = (((VALUE > INT_LEAST8_MAX) || (VALUE < INT_LEAST8_MIN)) ? 1 : 0) +
|
||||
(((VALUE > INT16_MAX) || (VALUE < INT16_MIN)) ? 1 : 0) +
|
||||
(((VALUE > INT32_MAX) || (VALUE < INT32_MIN)) ? 1 : 0);
|
||||
static const int TYPE_INDEX = (((VALUE > intmax_t(INT_LEAST8_MAX)) || (VALUE < intmax_t(INT_LEAST8_MIN))) ? 1 : 0) +
|
||||
(((VALUE > intmax_t(INT16_MAX)) || (VALUE < intmax_t(INT16_MIN))) ? 1 : 0) +
|
||||
(((VALUE > intmax_t(INT32_MAX)) || (VALUE < intmax_t(INT32_MIN))) ? 1 : 0);
|
||||
|
||||
public:
|
||||
|
||||
typedef typename private_smallest::best_fit_int_type<TYPE_INDEX>::type type;
|
||||
};
|
||||
|
||||
#if ETL_CPP14_SUPPORTED
|
||||
template <intmax_t VALUE>
|
||||
using smallest_int_for_value_t = typename smallest_int_for_value<VALUE>::type;
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@ -129,8 +129,10 @@ namespace etl
|
||||
static_assert(!(etl::is_same<nulltype, type>::value), "Invalid id");
|
||||
};
|
||||
|
||||
#if ETL_CPP14_SUPPORTED
|
||||
template <int ID>
|
||||
using type_from_id_t = typename type_from_id<ID>::type;
|
||||
#endif
|
||||
|
||||
private:
|
||||
|
||||
@ -165,7 +167,7 @@ namespace etl
|
||||
|
||||
#if ETL_CPP17_SUPPORTED
|
||||
template <typename T>
|
||||
static constexpr size_t id_from_type_v = id_from_type<T, TTypes...>::value;
|
||||
static constexpr size_t id_from_type_v = id_from_type<T>::value;
|
||||
#endif
|
||||
|
||||
//************************************
|
||||
@ -223,9 +225,11 @@ namespace etl
|
||||
static_assert(!etl::is_same<type, nulltype>::value, "Type match not found");
|
||||
};
|
||||
|
||||
#if ETL_CPP14_SUPPORTED
|
||||
// Template alias.
|
||||
template <typename T>
|
||||
using TypeFromType_t = typename type_from_type<T>::type;
|
||||
using type_from_type_t = typename type_from_type<T>::type;
|
||||
#endif
|
||||
};
|
||||
|
||||
#else
|
||||
|
||||
@ -73,8 +73,8 @@ namespace etl
|
||||
struct type_select_helper
|
||||
{
|
||||
using type = typename etl::conditional<ID == N,
|
||||
T1,
|
||||
typename type_select_helper<ID, N + 1, TRest...>::type>::type;
|
||||
T1,
|
||||
typename type_select_helper<ID, N + 1, TRest...>::type>::type;
|
||||
};
|
||||
|
||||
//***********************************
|
||||
@ -94,8 +94,10 @@ namespace etl
|
||||
using type = typename type_select_helper<ID, 0, TTypes...>::type;
|
||||
};
|
||||
|
||||
#if ETL_CPP14_SUPPORTED
|
||||
template <size_t ID>
|
||||
using select_t = typename select<ID>::type;
|
||||
#endif
|
||||
};
|
||||
|
||||
#else
|
||||
|
||||
@ -1088,7 +1088,13 @@ namespace etl
|
||||
inline constexpr bool is_pod_v = std::is_standard_layout_v<T> && std::is_trivial_v<T>;
|
||||
#endif
|
||||
|
||||
#if !defined(ARDUINO) && ETL_NOT_USING_STLPORT && !(defined(ETL_COMPILER_GCC) && ETL_COMPILER_VERSION < 5)
|
||||
#if defined(ETL_COMPILER_GCC)
|
||||
#if ETL_COMPILER_VERSION >= 5
|
||||
#define ETL_GCC_V5_TYPE_TRAITS_SUPPORTED
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if !defined(ARDUINO) && ETL_NOT_USING_STLPORT && defined(ETL_GCC_V5_TYPE_TRAITS_SUPPORTED)
|
||||
//***************************************************************************
|
||||
/// is_trivially_constructible
|
||||
///\ingroup type_traits
|
||||
|
||||
@ -33,14 +33,10 @@ SOFTWARE.
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#include <new>
|
||||
|
||||
#include "platform.h"
|
||||
|
||||
#include "algorithm.h"
|
||||
#include "iterator.h"
|
||||
#include "functional.h"
|
||||
|
||||
#include "container.h"
|
||||
#include "pool.h"
|
||||
#include "exception.h"
|
||||
@ -52,6 +48,7 @@ SOFTWARE.
|
||||
#include "memory.h"
|
||||
#include "iterator.h"
|
||||
#include "static_assert.h"
|
||||
#include "placement_new.h"
|
||||
|
||||
#if ETL_CPP11_SUPPORTED && ETL_NOT_USING_STLPORT && ETL_USING_STL
|
||||
#include <initializer_list>
|
||||
|
||||
@ -33,14 +33,10 @@ SOFTWARE.
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#include <new>
|
||||
|
||||
#include "platform.h"
|
||||
|
||||
#include "algorithm.h"
|
||||
#include "iterator.h"
|
||||
#include "functional.h"
|
||||
|
||||
#include "container.h"
|
||||
#include "pool.h"
|
||||
#include "exception.h"
|
||||
@ -51,6 +47,7 @@ SOFTWARE.
|
||||
#include "parameter_type.h"
|
||||
#include "iterator.h"
|
||||
#include "utility.h"
|
||||
#include "placement_new.h"
|
||||
|
||||
#if ETL_CPP11_SUPPORTED && ETL_NOT_USING_STLPORT && ETL_USING_STL
|
||||
#include <initializer_list>
|
||||
|
||||
@ -38,13 +38,11 @@ SOFTWARE.
|
||||
#include "utility.h"
|
||||
#include "nullptr.h"
|
||||
#include "alignment.h"
|
||||
#include "placement_new.h"
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <new>
|
||||
|
||||
#if ETL_USING_STL
|
||||
#include <memory>
|
||||
#endif
|
||||
|
||||
@ -52,7 +52,6 @@ SOFTWARE.
|
||||
#define ETL_MESSAGE_ROUTER_INCLUDED
|
||||
|
||||
#include <stdint.h>
|
||||
#include <new>
|
||||
|
||||
#include "platform.h"
|
||||
#include "message.h"
|
||||
@ -63,6 +62,7 @@ SOFTWARE.
|
||||
#include "exception.h"
|
||||
#include "largest.h"
|
||||
#include "nullptr.h"
|
||||
#include "placement_new.h"
|
||||
|
||||
#undef ETL_FILE
|
||||
#define ETL_FILE "35"
|
||||
|
||||
@ -33,14 +33,10 @@ SOFTWARE.
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#include <new>
|
||||
|
||||
#include "platform.h"
|
||||
|
||||
#include "algorithm.h"
|
||||
#include "iterator.h"
|
||||
#include "functional.h"
|
||||
|
||||
#include "container.h"
|
||||
#include "pool.h"
|
||||
#include "exception.h"
|
||||
@ -51,6 +47,7 @@ SOFTWARE.
|
||||
#include "parameter_type.h"
|
||||
#include "iterator.h"
|
||||
#include "utility.h"
|
||||
#include "placement_new.h"
|
||||
|
||||
#if ETL_CPP11_SUPPORTED && ETL_NOT_USING_STLPORT && ETL_USING_STL
|
||||
#include <initializer_list>
|
||||
|
||||
@ -33,14 +33,10 @@ SOFTWARE.
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#include <new>
|
||||
|
||||
#include "platform.h"
|
||||
|
||||
#include "algorithm.h"
|
||||
#include "iterator.h"
|
||||
#include "functional.h"
|
||||
|
||||
#include "parameter_type.h"
|
||||
#include "container.h"
|
||||
#include "pool.h"
|
||||
@ -50,6 +46,7 @@ SOFTWARE.
|
||||
#include "nullptr.h"
|
||||
#include "type_traits.h"
|
||||
#include "utility.h"
|
||||
#include "placement_new.h"
|
||||
|
||||
#if ETL_CPP11_SUPPORTED && ETL_NOT_USING_STLPORT && ETL_USING_STL
|
||||
#include <initializer_list>
|
||||
|
||||
@ -31,15 +31,13 @@ SOFTWARE.
|
||||
#ifndef ETL_OPTIONAL_INCLUDED
|
||||
#define ETL_OPTIONAL_INCLUDED
|
||||
|
||||
#include <new>
|
||||
|
||||
#include "platform.h"
|
||||
#include "alignment.h"
|
||||
#include "type_traits.h"
|
||||
#include "exception.h"
|
||||
#include "error_handler.h"
|
||||
|
||||
#include "utility.h"
|
||||
#include "placement_new.h"
|
||||
|
||||
namespace etl
|
||||
{
|
||||
|
||||
@ -31,12 +31,11 @@ SOFTWARE.
|
||||
#ifndef ETL_PACKET_INCLUDED
|
||||
#define ETL_PACKET_INCLUDED
|
||||
|
||||
#include <new>
|
||||
|
||||
#include "platform.h"
|
||||
#include "static_assert.h"
|
||||
#include "alignment.h"
|
||||
#include "utility.h"
|
||||
#include "placement_new.h"
|
||||
|
||||
#undef ETL_FILE
|
||||
#define ETL_FILE "38"
|
||||
|
||||
48
include/etl/placement_new.h
Normal file
48
include/etl/placement_new.h
Normal file
@ -0,0 +1,48 @@
|
||||
///\file
|
||||
|
||||
/******************************************************************************
|
||||
The MIT License(MIT)
|
||||
|
||||
Embedded Template Library.
|
||||
https://github.com/ETLCPP/etl
|
||||
https://www.etlcpp.com
|
||||
|
||||
Copyright(c) 2019 jwellbelove
|
||||
|
||||
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_NEW_INCLUDED
|
||||
#define ETL_NEW_INCLUDED
|
||||
///\ingroup private
|
||||
|
||||
#include "platform.h"
|
||||
|
||||
#if ETL_USING_STD_NEW
|
||||
#include <new>
|
||||
#else
|
||||
// Define placement new if no new header is available
|
||||
inline void* operator new(size_t, void* p) { return p; }
|
||||
inline void* operator new[](size_t, void* p) { return p; }
|
||||
|
||||
inline void operator delete(void*, void*) ETL_NOEXCEPT {}
|
||||
inline void operator delete[](void*, void*) ETL_NOEXCEPT {}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@ -102,6 +102,17 @@ SOFTWARE.
|
||||
// See if we can determine the OS we're compiling on, if haven't already done so in etl_profile.h
|
||||
#include "profiles/determine_development_os.h"
|
||||
|
||||
// Figure out if we can use the standard library <new> header, if haven't already done so in etl_profile.h
|
||||
#if !defined(ETL_USING_STD_NEW)
|
||||
#if defined(__has_include)
|
||||
#define ETL_USING_STD_NEW __has_include(<new>)
|
||||
#elif ETL_NOT_USING_STL || (defined(ARDUINO) && defined(__AVR__))
|
||||
#define ETL_USING_STD_NEW 0
|
||||
#else
|
||||
#define ETL_USING_STD_NEW 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Option to force string construction from a character pointer to be explicit.
|
||||
#if defined(ETL_FORCE_EXPLICIT_STRING_CONVERSION_FROM_CHAR)
|
||||
#define ETL_EXPLICIT_STRING_FROM_CHAR explicit
|
||||
|
||||
@ -32,9 +32,6 @@ SOFTWARE.
|
||||
#define ETL_POOL_INCLUDED
|
||||
|
||||
#include "platform.h"
|
||||
|
||||
#include <new>
|
||||
|
||||
#include "algorithm.h"
|
||||
#include "iterator.h"
|
||||
#include "utility.h"
|
||||
@ -47,6 +44,7 @@ SOFTWARE.
|
||||
#include "alignment.h"
|
||||
#include "static_assert.h"
|
||||
#include "algorithm.h"
|
||||
#include "placement_new.h"
|
||||
|
||||
#undef ETL_FILE
|
||||
#define ETL_FILE "11"
|
||||
|
||||
@ -34,8 +34,6 @@ SOFTWARE.
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <new>
|
||||
|
||||
#include "platform.h"
|
||||
#include "container.h"
|
||||
#include "alignment.h"
|
||||
@ -48,6 +46,7 @@ SOFTWARE.
|
||||
#include "memory_model.h"
|
||||
#include "integral_limits.h"
|
||||
#include "utility.h"
|
||||
#include "placement_new.h"
|
||||
|
||||
#undef ETL_FILE
|
||||
#define ETL_FILE "13"
|
||||
|
||||
@ -34,8 +34,6 @@ SOFTWARE.
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <new>
|
||||
|
||||
#include "platform.h"
|
||||
#include "mutex.h"
|
||||
|
||||
@ -46,6 +44,7 @@ SOFTWARE.
|
||||
#include "memory_model.h"
|
||||
#include "integral_limits.h"
|
||||
#include "utility.h"
|
||||
#include "placement_new.h"
|
||||
|
||||
#undef ETL_FILE
|
||||
#define ETL_FILE "48"
|
||||
|
||||
@ -34,8 +34,6 @@ SOFTWARE.
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <new>
|
||||
|
||||
#include "platform.h"
|
||||
#include "alignment.h"
|
||||
#include "parameter_type.h"
|
||||
@ -43,6 +41,7 @@ SOFTWARE.
|
||||
#include "memory_model.h"
|
||||
#include "integral_limits.h"
|
||||
#include "utility.h"
|
||||
#include "placement_new.h"
|
||||
|
||||
#undef ETL_FILE
|
||||
#define ETL_FILE "47"
|
||||
|
||||
@ -34,14 +34,13 @@ SOFTWARE.
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <new>
|
||||
|
||||
#include "platform.h"
|
||||
#include "alignment.h"
|
||||
#include "parameter_type.h"
|
||||
#include "memory_model.h"
|
||||
#include "integral_limits.h"
|
||||
#include "utility.h"
|
||||
#include "placement_new.h"
|
||||
|
||||
#undef ETL_FILE
|
||||
#define ETL_FILE "46"
|
||||
|
||||
@ -34,8 +34,6 @@ SOFTWARE.
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <new>
|
||||
|
||||
#include "platform.h"
|
||||
#include "alignment.h"
|
||||
#include "parameter_type.h"
|
||||
@ -43,6 +41,7 @@ SOFTWARE.
|
||||
#include "integral_limits.h"
|
||||
#include "function.h"
|
||||
#include "utility.h"
|
||||
#include "placement_new.h"
|
||||
|
||||
#undef ETL_FILE
|
||||
#define ETL_FILE "54"
|
||||
|
||||
@ -33,8 +33,6 @@ SOFTWARE.
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#include <new>
|
||||
|
||||
#include "platform.h"
|
||||
#include "container.h"
|
||||
#include "pool.h"
|
||||
@ -46,10 +44,10 @@ SOFTWARE.
|
||||
#include "parameter_type.h"
|
||||
#include "iterator.h"
|
||||
#include "utility.h"
|
||||
|
||||
#include "algorithm.h"
|
||||
#include "iterator.h"
|
||||
#include "functional.h"
|
||||
#include "placement_new.h"
|
||||
|
||||
#if ETL_CPP11_SUPPORTED && ETL_NOT_USING_STLPORT && ETL_USING_STL
|
||||
#include <initializer_list>
|
||||
|
||||
@ -368,9 +368,9 @@ namespace etl
|
||||
private:
|
||||
|
||||
// Determines the index of the best signed type for the required value.
|
||||
static const int TYPE_INDEX = (((VALUE > intmax_t(INT_LEAST8_MAX)) || (VALUE < intmax_t(INT_LEAST8_MIN))) ? 1 : 0) +
|
||||
(((VALUE > intmax_t(INT16_MAX)) || (VALUE < intmax_t(INT16_MIN))) ? 1 : 0) +
|
||||
(((VALUE > intmax_t(INT32_MAX)) || (VALUE < intmax_t(INT32_MIN))) ? 1 : 0);
|
||||
static const int TYPE_INDEX = (((VALUE > intmax_t(INT_LEAST8_MAX)) || (VALUE < intmax_t(INT_LEAST8_MIN))) ? 1 : 0) +
|
||||
(((VALUE > intmax_t(INT16_MAX)) || (VALUE < intmax_t(INT16_MIN))) ? 1 : 0) +
|
||||
(((VALUE > intmax_t(INT32_MAX)) || (VALUE < intmax_t(INT32_MIN))) ? 1 : 0);
|
||||
|
||||
public:
|
||||
|
||||
|
||||
@ -34,8 +34,6 @@ SOFTWARE.
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <new>
|
||||
|
||||
#include "platform.h"
|
||||
#include "algorithm.h"
|
||||
#include "utility.h"
|
||||
@ -46,6 +44,7 @@ SOFTWARE.
|
||||
#include "error_handler.h"
|
||||
#include "debug_count.h"
|
||||
#include "type_traits.h"
|
||||
#include "placement_new.h"
|
||||
|
||||
#undef ETL_FILE
|
||||
#define ETL_FILE "15"
|
||||
|
||||
@ -758,7 +758,7 @@ namespace etl
|
||||
/// These require compiler specific intrinsics.
|
||||
#if ETL_CPP11_SUPPORTED && !defined(ETL_COMPILER_ARM5)
|
||||
template <typename T> struct alignment_of : integral_constant<size_t, alignof(T)> { };
|
||||
#elif ETL_COMPILER_MICROSOFT
|
||||
#elif defined(ETL_COMPILER_MICROSOFT)
|
||||
template <typename T> struct alignment_of : integral_constant<size_t, size_t(__alignof(T))> {};
|
||||
#elif defined(ETL_COMPILER_IAR) || defined(ETL_COMPILER_TI)
|
||||
template <typename T> struct alignment_of : integral_constant<size_t, size_t(__ALIGNOF__(T))> {};
|
||||
|
||||
@ -33,8 +33,6 @@ SOFTWARE.
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#include <new>
|
||||
|
||||
#include "platform.h"
|
||||
#include "algorithm.h"
|
||||
#include "iterator.h"
|
||||
@ -53,6 +51,7 @@ SOFTWARE.
|
||||
#include "exception.h"
|
||||
#include "debug_count.h"
|
||||
#include "iterator.h"
|
||||
#include "placement_new.h"
|
||||
|
||||
#if ETL_CPP11_SUPPORTED && ETL_NOT_USING_STLPORT && ETL_USING_STL
|
||||
#include <initializer_list>
|
||||
|
||||
@ -33,8 +33,6 @@ SOFTWARE.
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#include <new>
|
||||
|
||||
#include "platform.h"
|
||||
#include "algorithm.h"
|
||||
#include "iterator.h"
|
||||
@ -53,6 +51,7 @@ SOFTWARE.
|
||||
#include "exception.h"
|
||||
#include "debug_count.h"
|
||||
#include "iterator.h"
|
||||
#include "placement_new.h"
|
||||
|
||||
#if ETL_CPP11_SUPPORTED && ETL_NOT_USING_STLPORT && ETL_USING_STL
|
||||
#include <initializer_list>
|
||||
|
||||
@ -33,15 +33,11 @@ SOFTWARE.
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#include <new>
|
||||
|
||||
#include "platform.h"
|
||||
|
||||
#include "algorithm.h"
|
||||
#include "iterator.h"
|
||||
#include "functional.h"
|
||||
#include "utility.h"
|
||||
|
||||
#include "container.h"
|
||||
#include "pool.h"
|
||||
#include "vector.h"
|
||||
@ -54,6 +50,7 @@ SOFTWARE.
|
||||
#include "exception.h"
|
||||
#include "debug_count.h"
|
||||
#include "iterator.h"
|
||||
#include "placement_new.h"
|
||||
|
||||
#if ETL_CPP11_SUPPORTED && ETL_NOT_USING_STLPORT && ETL_USING_STL
|
||||
#include <initializer_list>
|
||||
|
||||
@ -33,8 +33,6 @@ SOFTWARE.
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#include <new>
|
||||
|
||||
#include "platform.h"
|
||||
#include "algorithm.h"
|
||||
#include "iterator.h"
|
||||
@ -53,6 +51,7 @@ SOFTWARE.
|
||||
#include "error_handler.h"
|
||||
#include "debug_count.h"
|
||||
#include "iterator.h"
|
||||
#include "placement_new.h"
|
||||
|
||||
#if ETL_CPP11_SUPPORTED && ETL_NOT_USING_STLPORT && ETL_USING_STL
|
||||
#include <initializer_list>
|
||||
|
||||
@ -33,8 +33,6 @@ SOFTWARE.
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <new>
|
||||
|
||||
#include "platform.h"
|
||||
#include "utility.h"
|
||||
#include "array.h"
|
||||
@ -46,6 +44,7 @@ SOFTWARE.
|
||||
#include "alignment.h"
|
||||
#include "error_handler.h"
|
||||
#include "null_type.h"
|
||||
#include "placement_new.h"
|
||||
|
||||
#if defined(ETL_COMPILER_KEIL)
|
||||
#pragma diag_suppress 940
|
||||
|
||||
@ -37,8 +37,6 @@ SOFTWARE.
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include <new>
|
||||
|
||||
#include "platform.h"
|
||||
#include "algorithm.h"
|
||||
#include "type_traits.h"
|
||||
@ -53,6 +51,7 @@ SOFTWARE.
|
||||
#include "iterator.h"
|
||||
#include "functional.h"
|
||||
#include "static_assert.h"
|
||||
#include "placement_new.h"
|
||||
|
||||
#if ETL_CPP11_SUPPORTED && ETL_NOT_USING_STLPORT && ETL_USING_STL
|
||||
#include <initializer_list>
|
||||
|
||||
@ -1,3 +1,8 @@
|
||||
===============================================================================
|
||||
19.3.3
|
||||
Added check for existance of <new> in platform.h
|
||||
Added placement_new.h which selects between <new> and ETL definitions.
|
||||
|
||||
===============================================================================
|
||||
19.3.2
|
||||
Added No-STL clang mutex that uses GCC implementation.
|
||||
|
||||
@ -5,23 +5,23 @@ echo "********** GCC **********" >> etl_test_log.txt
|
||||
gcc --version | grep gcc >> etl_test_log.txt
|
||||
cmake --cmake-clean-cache -DNO_STL=OFF ..
|
||||
make
|
||||
./etl_tests >> etl_test_log.txt
|
||||
./etl_tests | tee etl_test_log.txt
|
||||
echo "********** GCC - No STL **********" >> etl_test_log.txt
|
||||
gcc --version | grep gcc >> etl_test_log.txt
|
||||
cmake --cmake-clean-cache -DNO_STL=ON ..
|
||||
make
|
||||
./etl_tests >> etl_test_log.txt
|
||||
./etl_tests | tee etl_test_log.txt
|
||||
echo "********** Clang **********" >> etl_test_log.txt
|
||||
clang --version | grep clang >> etl_test_log.txt
|
||||
export CC=clang
|
||||
export CXX=clang++
|
||||
cmake --cmake-clean-cache -DNO_STL=OFF ..
|
||||
make
|
||||
./etl_tests >> etl_test_log.txt
|
||||
./etl_tests | tee etl_test_log.txt
|
||||
echo "********** Clang - No STL **********" >> etl_test_log.txt
|
||||
clang --version | grep clang >> etl_test_log.txt
|
||||
export CC=clang
|
||||
export CXX=clang++
|
||||
cmake --cmake-clean-cache -DNO_STL=ON ..
|
||||
make
|
||||
./etl_tests >> etl_test_log.txt
|
||||
./etl_tests | tee etl_test_log.txt
|
||||
|
||||
@ -1294,6 +1294,7 @@
|
||||
<ClInclude Include="..\..\include\etl\mutex\mutex_clang_sync.h" />
|
||||
<ClInclude Include="..\..\include\etl\mutex\mutex_freertos.h" />
|
||||
<ClInclude Include="..\..\include\etl\negative.h" />
|
||||
<ClInclude Include="..\..\include\etl\placement_new.h" />
|
||||
<ClInclude Include="..\..\include\etl\null_type.h" />
|
||||
<ClInclude Include="..\..\include\etl\parameter_pack.h" />
|
||||
<ClInclude Include="..\..\include\etl\private\choose_namespace.h" />
|
||||
|
||||
@ -894,6 +894,9 @@
|
||||
<ClInclude Include="..\..\include\etl\buffer_descriptors.h">
|
||||
<Filter>ETL\Containers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\include\etl\placement_new.h">
|
||||
<Filter>ETL\Utilities</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\include\etl\mutex\mutex_clang_sync.h">
|
||||
<Filter>ETL\Utilities\Mutex</Filter>
|
||||
</ClInclude>
|
||||
@ -1545,4 +1548,4 @@
|
||||
<Filter>Resource Files\Images</Filter>
|
||||
</Image>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
</Project>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user