diff --git a/include/etl/callback_timer.h b/include/etl/callback_timer.h index 7771e880..0e2c43a0 100644 --- a/include/etl/callback_timer.h +++ b/include/etl/callback_timer.h @@ -30,7 +30,6 @@ SOFTWARE. #define ETL_CALLBACK_TIMER_INCLUDED #include -#include #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" diff --git a/include/etl/deque.h b/include/etl/deque.h index 75f8d4af..72bf84ef 100644 --- a/include/etl/deque.h +++ b/include/etl/deque.h @@ -34,14 +34,10 @@ SOFTWARE. #include #include -#include - #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 diff --git a/include/etl/experimental/variant_new.h b/include/etl/experimental/variant_new.h index 503aa98d..160969ac 100644 --- a/include/etl/experimental/variant_new.h +++ b/include/etl/experimental/variant_new.h @@ -33,7 +33,7 @@ SOFTWARE. #include -#include +#include "private/new.h" #include "platform.h" #include "utility.h" diff --git a/include/etl/flat_map.h b/include/etl/flat_map.h index b5960133..b6168d89 100644 --- a/include/etl/flat_map.h +++ b/include/etl/flat_map.h @@ -31,11 +31,10 @@ SOFTWARE. #ifndef ETL_FLAT_MAP_INCLUDED #define ETL_FLAT_MAP_INCLUDED -#include - #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 diff --git a/include/etl/flat_multimap.h b/include/etl/flat_multimap.h index e163ec67..6df8143b 100644 --- a/include/etl/flat_multimap.h +++ b/include/etl/flat_multimap.h @@ -31,12 +31,11 @@ SOFTWARE. #ifndef ETL_FLAT_MULTMAP_INCLUDED #define ETL_FLAT_MULTMAP_INCLUDED -#include - #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 diff --git a/include/etl/flat_multiset.h b/include/etl/flat_multiset.h index 2e3ce7ae..496cf843 100644 --- a/include/etl/flat_multiset.h +++ b/include/etl/flat_multiset.h @@ -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 diff --git a/include/etl/flat_set.h b/include/etl/flat_set.h index baa19791..c4d5c7c9 100644 --- a/include/etl/flat_set.h +++ b/include/etl/flat_set.h @@ -31,11 +31,10 @@ SOFTWARE. #ifndef ETL_FLAT_SET_INCLUDED #define ETL_FLAT_SET_INCLUDED -#include - #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 diff --git a/include/etl/forward_list.h b/include/etl/forward_list.h index f1f25eb4..a870aba6 100644 --- a/include/etl/forward_list.h +++ b/include/etl/forward_list.h @@ -33,15 +33,11 @@ SOFTWARE. #include -#include - #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 diff --git a/include/etl/fsm.h b/include/etl/fsm.h index e97f541a..15bb636e 100644 --- a/include/etl/fsm.h +++ b/include/etl/fsm.h @@ -235,7 +235,7 @@ namespace etl template 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; } diff --git a/include/etl/generators/fsm_generator.h b/include/etl/generators/fsm_generator.h index 8e5eeff8..7aa987b9 100644 --- a/include/etl/generators/fsm_generator.h +++ b/include/etl/generators/fsm_generator.h @@ -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; } diff --git a/include/etl/generators/largest_generator.h b/include/etl/generators/largest_generator.h index dfd05dd7..c95a7d5e 100644 --- a/include/etl/generators/largest_generator.h +++ b/include/etl/generators/largest_generator.h @@ -121,6 +121,17 @@ namespace etl size = etl::size_of::value }; }; + +#if ETL_CPP14_SUPPORTED + template + using largest_type_t = typename largest_type::type; +#endif + +#if ETL_CPP17_SUPPORTED + template + constexpr size_t largest_type_v = largest_type::size; +#endif + #else /*[[[cog import cog @@ -225,6 +236,12 @@ namespace etl value = etl::alignment_of::value }; }; + +#if ETL_CPP17_SUPPORTED + template + inline constexpr size_t largest_alignment_v = largest_alignment::value; +#endif + #else /*[[[cog import cog @@ -302,6 +319,11 @@ namespace etl typedef typename etl::smallest_int_for_bits::type>::bits + 1>::type type; }; +#if ETL_CPP14_SUPPORTED + template + using larger_int_type_t = typename larger_int_type::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::type>::bits + 1>::type type; }; +#if ETL_CPP14_SUPPORTED + template + using larger_uint_type_t = typename larger_uint_type::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::bits + 1>::type type; }; +#if ETL_CPP14_SUPPORTED + template + using larger_type_t = typename larger_type::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::value }; }; + +#if ETL_CPP14_SUPPORTED + template + using largest_t = typename largest::type; +#endif + #else /*[[[cog import cog diff --git a/include/etl/generators/message_router_generator.h b/include/etl/generators/message_router_generator.h index 23eac2b2..aa4b208b 100644 --- a/include/etl/generators/message_router_generator.h +++ b/include/etl/generators/message_router_generator.h @@ -64,7 +64,6 @@ cog.outl("//******************************************************************** #define ETL_MESSAGE_ROUTER_INCLUDED #include -#include #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" diff --git a/include/etl/generators/smallest_generator.h b/include/etl/generators/smallest_generator.h index 6290b65d..71b62846 100644 --- a/include/etl/generators/smallest_generator.h +++ b/include/etl/generators/smallest_generator.h @@ -121,6 +121,17 @@ namespace etl size = etl::size_of::value }; }; + +#if ETL_CPP14_SUPPORTED + template + using smallest_type_t = typename smallest_type::type; +#endif + +#if ETL_CPP17_SUPPORTED + template + constexpr size_t smallest_type_v = smallest_type::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 + template struct smallest_uint_for_bits { private: @@ -318,13 +329,18 @@ namespace etl typedef typename private_smallest::best_fit_uint_type::type type; }; +#if ETL_CPP14_SUPPORTED + template + using smallest_uint_for_bits_t = typename smallest_uint_for_bits::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 + template struct smallest_int_for_bits { private: @@ -339,13 +355,18 @@ namespace etl typedef typename private_smallest::best_fit_int_type::type type; }; +#if ETL_CPP14_SUPPORTED + template + using smallest_int_for_bits_t = typename smallest_int_for_bits::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 + template struct smallest_uint_for_value { private: @@ -360,6 +381,11 @@ namespace etl typedef typename private_smallest::best_fit_uint_type::type type; }; +#if ETL_CPP14_SUPPORTED + template + using smallest_uint_for_value_t = typename smallest_uint_for_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 type; }; + +#if ETL_CPP14_SUPPORTED + template + using smallest_int_for_value_t = typename smallest_int_for_value::type; +#endif } #endif diff --git a/include/etl/generators/type_lookup_generator.h b/include/etl/generators/type_lookup_generator.h index 845d2816..a16564d3 100644 --- a/include/etl/generators/type_lookup_generator.h +++ b/include/etl/generators/type_lookup_generator.h @@ -129,8 +129,10 @@ namespace etl static_assert(!(etl::is_same::value), "Invalid id"); }; +#if ETL_CPP14_SUPPORTED template using type_from_id_t = typename type_from_id::type; +#endif private: @@ -165,7 +167,7 @@ namespace etl #if ETL_CPP17_SUPPORTED template - static constexpr size_t id_from_type_v = id_from_type::value; + static constexpr size_t id_from_type_v = id_from_type::value; #endif //************************************ @@ -223,9 +225,11 @@ namespace etl static_assert(!etl::is_same::value, "Type match not found"); }; +#if ETL_CPP14_SUPPORTED // Template alias. template - using TypeFromType_t = typename type_from_type::type; + using type_from_type_t = typename type_from_type::type; +#endif }; #else diff --git a/include/etl/generators/type_select_generator.h b/include/etl/generators/type_select_generator.h index 17dd4a00..4add070c 100644 --- a/include/etl/generators/type_select_generator.h +++ b/include/etl/generators/type_select_generator.h @@ -73,8 +73,8 @@ namespace etl struct type_select_helper { using type = typename etl::conditional::type>::type; + T1, + typename type_select_helper::type>::type; }; //*********************************** @@ -94,8 +94,10 @@ namespace etl using type = typename type_select_helper::type; }; +#if ETL_CPP14_SUPPORTED template using select_t = typename select::type; +#endif }; #else diff --git a/include/etl/generators/type_traits_generator.h b/include/etl/generators/type_traits_generator.h index 200e267a..6377889a 100644 --- a/include/etl/generators/type_traits_generator.h +++ b/include/etl/generators/type_traits_generator.h @@ -1088,7 +1088,13 @@ namespace etl inline constexpr bool is_pod_v = std::is_standard_layout_v && std::is_trivial_v; #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 diff --git a/include/etl/list.h b/include/etl/list.h index d8cb152e..7c472738 100644 --- a/include/etl/list.h +++ b/include/etl/list.h @@ -33,14 +33,10 @@ SOFTWARE. #include -#include - #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 diff --git a/include/etl/map.h b/include/etl/map.h index 0efc2ef6..49663818 100755 --- a/include/etl/map.h +++ b/include/etl/map.h @@ -33,14 +33,10 @@ SOFTWARE. #include -#include - #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 diff --git a/include/etl/memory.h b/include/etl/memory.h index 3c9f576c..474cd449 100644 --- a/include/etl/memory.h +++ b/include/etl/memory.h @@ -38,13 +38,11 @@ SOFTWARE. #include "utility.h" #include "nullptr.h" #include "alignment.h" +#include "placement_new.h" #include - #include -#include - #if ETL_USING_STL #include #endif diff --git a/include/etl/message_router.h b/include/etl/message_router.h index 1f981d0e..c5b7ec1e 100644 --- a/include/etl/message_router.h +++ b/include/etl/message_router.h @@ -52,7 +52,6 @@ SOFTWARE. #define ETL_MESSAGE_ROUTER_INCLUDED #include -#include #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" diff --git a/include/etl/multimap.h b/include/etl/multimap.h index 1cde7318..81e323db 100644 --- a/include/etl/multimap.h +++ b/include/etl/multimap.h @@ -33,14 +33,10 @@ SOFTWARE. #include -#include - #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 diff --git a/include/etl/multiset.h b/include/etl/multiset.h index dd950be1..16b9d7cc 100644 --- a/include/etl/multiset.h +++ b/include/etl/multiset.h @@ -33,14 +33,10 @@ SOFTWARE. #include -#include - #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 diff --git a/include/etl/optional.h b/include/etl/optional.h index 25b4af0a..5ea0cd7b 100644 --- a/include/etl/optional.h +++ b/include/etl/optional.h @@ -31,15 +31,13 @@ SOFTWARE. #ifndef ETL_OPTIONAL_INCLUDED #define ETL_OPTIONAL_INCLUDED -#include - #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 { diff --git a/include/etl/packet.h b/include/etl/packet.h index fbaf046b..5802ec35 100644 --- a/include/etl/packet.h +++ b/include/etl/packet.h @@ -31,12 +31,11 @@ SOFTWARE. #ifndef ETL_PACKET_INCLUDED #define ETL_PACKET_INCLUDED -#include - #include "platform.h" #include "static_assert.h" #include "alignment.h" #include "utility.h" +#include "placement_new.h" #undef ETL_FILE #define ETL_FILE "38" diff --git a/include/etl/placement_new.h b/include/etl/placement_new.h new file mode 100644 index 00000000..15f5533f --- /dev/null +++ b/include/etl/placement_new.h @@ -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 +#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 diff --git a/include/etl/platform.h b/include/etl/platform.h index ac20d4a8..3912aa68 100644 --- a/include/etl/platform.h +++ b/include/etl/platform.h @@ -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 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() + #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 diff --git a/include/etl/pool.h b/include/etl/pool.h index bb17bccb..5c7b83c1 100644 --- a/include/etl/pool.h +++ b/include/etl/pool.h @@ -32,9 +32,6 @@ SOFTWARE. #define ETL_POOL_INCLUDED #include "platform.h" - -#include - #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" diff --git a/include/etl/queue.h b/include/etl/queue.h index 64f8eaff..e2760418 100644 --- a/include/etl/queue.h +++ b/include/etl/queue.h @@ -34,8 +34,6 @@ SOFTWARE. #include #include -#include - #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" diff --git a/include/etl/queue_mpmc_mutex.h b/include/etl/queue_mpmc_mutex.h index 0270e716..5b422351 100644 --- a/include/etl/queue_mpmc_mutex.h +++ b/include/etl/queue_mpmc_mutex.h @@ -34,8 +34,6 @@ SOFTWARE. #include #include -#include - #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" diff --git a/include/etl/queue_spsc_atomic.h b/include/etl/queue_spsc_atomic.h index 1aee3f28..7acbfa47 100644 --- a/include/etl/queue_spsc_atomic.h +++ b/include/etl/queue_spsc_atomic.h @@ -34,8 +34,6 @@ SOFTWARE. #include #include -#include - #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" diff --git a/include/etl/queue_spsc_isr.h b/include/etl/queue_spsc_isr.h index 0679d433..6da073d5 100644 --- a/include/etl/queue_spsc_isr.h +++ b/include/etl/queue_spsc_isr.h @@ -34,14 +34,13 @@ SOFTWARE. #include #include -#include - #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" diff --git a/include/etl/queue_spsc_locked.h b/include/etl/queue_spsc_locked.h index 43b48138..e4e4bdb1 100644 --- a/include/etl/queue_spsc_locked.h +++ b/include/etl/queue_spsc_locked.h @@ -34,8 +34,6 @@ SOFTWARE. #include #include -#include - #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" diff --git a/include/etl/set.h b/include/etl/set.h index 63d3debc..f6e1699c 100755 --- a/include/etl/set.h +++ b/include/etl/set.h @@ -33,8 +33,6 @@ SOFTWARE. #include -#include - #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 diff --git a/include/etl/smallest.h b/include/etl/smallest.h index 540765e7..d6e23c2d 100644 --- a/include/etl/smallest.h +++ b/include/etl/smallest.h @@ -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: diff --git a/include/etl/stack.h b/include/etl/stack.h index 8c57dbd5..cd80d921 100644 --- a/include/etl/stack.h +++ b/include/etl/stack.h @@ -34,8 +34,6 @@ SOFTWARE. #include #include -#include - #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" diff --git a/include/etl/type_traits.h b/include/etl/type_traits.h index 69c56577..3112b967 100644 --- a/include/etl/type_traits.h +++ b/include/etl/type_traits.h @@ -758,7 +758,7 @@ namespace etl /// These require compiler specific intrinsics. #if ETL_CPP11_SUPPORTED && !defined(ETL_COMPILER_ARM5) template struct alignment_of : integral_constant { }; -#elif ETL_COMPILER_MICROSOFT +#elif defined(ETL_COMPILER_MICROSOFT) template struct alignment_of : integral_constant {}; #elif defined(ETL_COMPILER_IAR) || defined(ETL_COMPILER_TI) template struct alignment_of : integral_constant {}; diff --git a/include/etl/unordered_map.h b/include/etl/unordered_map.h index 3d72a0ea..ad4ef776 100644 --- a/include/etl/unordered_map.h +++ b/include/etl/unordered_map.h @@ -33,8 +33,6 @@ SOFTWARE. #include -#include - #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 diff --git a/include/etl/unordered_multimap.h b/include/etl/unordered_multimap.h index e029593e..c7b5d63a 100644 --- a/include/etl/unordered_multimap.h +++ b/include/etl/unordered_multimap.h @@ -33,8 +33,6 @@ SOFTWARE. #include -#include - #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 diff --git a/include/etl/unordered_multiset.h b/include/etl/unordered_multiset.h index df7e5671..a36ed6bc 100644 --- a/include/etl/unordered_multiset.h +++ b/include/etl/unordered_multiset.h @@ -33,15 +33,11 @@ SOFTWARE. #include -#include - #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 diff --git a/include/etl/unordered_set.h b/include/etl/unordered_set.h index fd5b034e..b69d801f 100644 --- a/include/etl/unordered_set.h +++ b/include/etl/unordered_set.h @@ -33,8 +33,6 @@ SOFTWARE. #include -#include - #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 diff --git a/include/etl/variant.h b/include/etl/variant.h index f0a20158..7bfea8eb 100644 --- a/include/etl/variant.h +++ b/include/etl/variant.h @@ -33,8 +33,6 @@ SOFTWARE. #include -#include - #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 diff --git a/include/etl/vector.h b/include/etl/vector.h index 29f8fd5d..dd2caea1 100644 --- a/include/etl/vector.h +++ b/include/etl/vector.h @@ -37,8 +37,6 @@ SOFTWARE. #include #include -#include - #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 diff --git a/support/Release notes.txt b/support/Release notes.txt index 7a9754d1..bcf7bb1f 100644 --- a/support/Release notes.txt +++ b/support/Release notes.txt @@ -1,3 +1,8 @@ +=============================================================================== +19.3.3 +Added check for existance of in platform.h +Added placement_new.h which selects between and ETL definitions. + =============================================================================== 19.3.2 Added No-STL clang mutex that uses GCC implementation. diff --git a/test/runtests.sh b/test/runtests.sh index a4a06e0b..6265495e 100644 --- a/test/runtests.sh +++ b/test/runtests.sh @@ -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 diff --git a/test/vs2019/etl.vcxproj b/test/vs2019/etl.vcxproj index a43557aa..4c5a0dbf 100644 --- a/test/vs2019/etl.vcxproj +++ b/test/vs2019/etl.vcxproj @@ -1294,6 +1294,7 @@ + diff --git a/test/vs2019/etl.vcxproj.filters b/test/vs2019/etl.vcxproj.filters index 9ab6eff0..1d896976 100644 --- a/test/vs2019/etl.vcxproj.filters +++ b/test/vs2019/etl.vcxproj.filters @@ -894,6 +894,9 @@ ETL\Containers + + ETL\Utilities + ETL\Utilities\Mutex @@ -1545,4 +1548,4 @@ Resource Files\Images - \ No newline at end of file +