Skip to content

Commit

Permalink
Merge branch 'hotfix/issue-303-etl-not-compatible-with-arduino-ide' i…
Browse files Browse the repository at this point in the history
…nto development

# Conflicts:
#	support/Release notes.txt
#	test/vs2019/etl.vcxproj.filters
  • Loading branch information
jwellbelove committed Dec 8, 2020
2 parents fbfd8ac + 41dbae7 commit 4d1f56b
Show file tree
Hide file tree
Showing 46 changed files with 209 additions and 103 deletions.
2 changes: 1 addition & 1 deletion include/etl/callback_timer.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ SOFTWARE.
#define ETL_CALLBACK_TIMER_INCLUDED

#include <stdint.h>
#include <new>

#include "platform.h"
#include "algorithm.h"
Expand All @@ -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"
Expand Down
5 changes: 1 addition & 4 deletions include/etl/deque.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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>
Expand Down
2 changes: 1 addition & 1 deletion include/etl/experimental/variant_new.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ SOFTWARE.

#include <stdint.h>

#include <new>
#include "private/new.h"

#include "platform.h"
#include "utility.h"
Expand Down
3 changes: 1 addition & 2 deletions include/etl/flat_map.h
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
3 changes: 1 addition & 2 deletions include/etl/flat_multimap.h
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
1 change: 1 addition & 0 deletions include/etl/flat_multiset.h
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
3 changes: 1 addition & 2 deletions include/etl/flat_set.h
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
5 changes: 1 addition & 4 deletions include/etl/forward_list.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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>
Expand Down
10 changes: 5 additions & 5 deletions include/etl/fsm.h
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down Expand Up @@ -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);
Expand All @@ -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))
{
Expand All @@ -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));
Expand Down Expand Up @@ -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;
}
Expand Down
8 changes: 4 additions & 4 deletions include/etl/generators/fsm_generator.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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))
{
Expand All @@ -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));
Expand Down Expand Up @@ -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;
}
Expand Down
38 changes: 38 additions & 0 deletions include/etl/generators/largest_generator.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand All @@ -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.
Expand All @@ -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.
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion include/etl/generators/message_router_generator.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ cog.outl("//********************************************************************
#define ETL_MESSAGE_ROUTER_INCLUDED

#include <stdint.h>
#include <new>

#include "platform.h"
#include "message.h"
Expand All @@ -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"
Expand Down
43 changes: 37 additions & 6 deletions include/etl/generators/smallest_generator.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand All @@ -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:
Expand All @@ -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:
Expand All @@ -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.
Expand All @@ -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
Loading

0 comments on commit 4d1f56b

Please sign in to comment.