Modified to use new ETL_ASSERTs

This commit is contained in:
John Wellbelove 2025-09-22 10:41:50 +01:00
parent 191d4fb0f0
commit e88a74362b
14 changed files with 172 additions and 253 deletions

1
.gitignore vendored
View File

@ -410,3 +410,4 @@ examples/UniquePtrWithPool/CMakeCache.txt
examples/UniquePtrWithPool/UniquePtrWithPool
test/vs2022/Debug Clang C++20 - Optimised -O2
include/etl/header_file_list.txt
temp

View File

@ -1757,9 +1757,8 @@ namespace etl
//*************************************************************************
void push_back(const_reference item)
{
#if defined(ETL_CHECK_PUSH_POP)
ETL_ASSERT(!full(), ETL_ERROR(deque_full));
#endif
ETL_ASSERT_CHECK_PUSH_POP_OR_RETURN(!full(), ETL_ERROR(deque_full));
create_element_back(item);
}
@ -1771,9 +1770,8 @@ namespace etl
//*************************************************************************
void push_back(rvalue_reference item)
{
#if defined(ETL_CHECK_PUSH_POP)
ETL_ASSERT(!full(), ETL_ERROR(deque_full));
#endif
ETL_ASSERT_CHECK_PUSH_POP_OR_RETURN(!full(), ETL_ERROR(deque_full));
create_element_back(etl::move(item));
}
#endif
@ -1786,9 +1784,7 @@ namespace etl
template <typename ... Args>
reference emplace_back(Args && ... args)
{
#if defined(ETL_CHECK_PUSH_POP)
ETL_ASSERT(!full(), ETL_ERROR(deque_full));
#endif
ETL_ASSERT_CHECK_PUSH_POP(!full(), ETL_ERROR(deque_full));
::new (&(*_end)) T(etl::forward<Args>(args)...);
++_end;
@ -1805,9 +1801,7 @@ namespace etl
//*************************************************************************
reference emplace_back()
{
#if defined(ETL_CHECK_PUSH_POP)
ETL_ASSERT(!full(), ETL_ERROR(deque_full));
#endif
ETL_ASSERT_CHECK_PUSH_POP(!full(), ETL_ERROR(deque_full));
::new (&(*_end)) T();
++_end;
@ -1823,9 +1817,7 @@ namespace etl
template <typename T1>
reference emplace_back(const T1& value1)
{
#if defined(ETL_CHECK_PUSH_POP)
ETL_ASSERT(!full(), ETL_ERROR(deque_full));
#endif
ETL_ASSERT_CHECK_PUSH_POP(!full(), ETL_ERROR(deque_full));
::new (&(*_end)) T(value1);
++_end;
@ -1841,9 +1833,7 @@ namespace etl
template <typename T1, typename T2>
reference emplace_back(const T1& value1, const T2& value2)
{
#if defined(ETL_CHECK_PUSH_POP)
ETL_ASSERT(!full(), ETL_ERROR(deque_full));
#endif
ETL_ASSERT_CHECK_PUSH_POP(!full(), ETL_ERROR(deque_full));
::new (&(*_end)) T(value1, value2);
++_end;
@ -1859,9 +1849,7 @@ namespace etl
template <typename T1, typename T2, typename T3>
reference emplace_back(const T1& value1, const T2& value2, const T3& value3)
{
#if defined(ETL_CHECK_PUSH_POP)
ETL_ASSERT(!full(), ETL_ERROR(deque_full));
#endif
ETL_ASSERT_CHECK_PUSH_POP(!full(), ETL_ERROR(deque_full));
::new (&(*_end)) T(value1, value2, value3);
++_end;
@ -1877,9 +1865,7 @@ namespace etl
template <typename T1, typename T2, typename T3, typename T4>
reference emplace_back(const T1& value1, const T2& value2, const T3& value3, const T4& value4)
{
#if defined(ETL_CHECK_PUSH_POP)
ETL_ASSERT(!full(), ETL_ERROR(deque_full));
#endif
ETL_ASSERT_CHECK_PUSH_POP(!full(), ETL_ERROR(deque_full));
::new (&(*_end)) T(value1, value2, value3, value4);
++_end;
@ -1894,9 +1880,8 @@ namespace etl
//*************************************************************************
void pop_back()
{
#if defined(ETL_CHECK_PUSH_POP)
ETL_ASSERT(!empty(), ETL_ERROR(deque_empty));
#endif
ETL_ASSERT_CHECK_PUSH_POP_OR_RETURN(!empty(), ETL_ERROR(deque_empty));
destroy_element_back();
}
@ -1907,9 +1892,8 @@ namespace etl
//*************************************************************************
void push_front(const_reference item)
{
#if defined(ETL_CHECK_PUSH_POP)
ETL_ASSERT(!full(), ETL_ERROR(deque_full));
#endif
ETL_ASSERT_CHECK_PUSH_POP_OR_RETURN(!full(), ETL_ERROR(deque_full));
create_element_front(item);
}
@ -1921,9 +1905,8 @@ namespace etl
//*************************************************************************
void push_front(rvalue_reference item)
{
#if defined(ETL_CHECK_PUSH_POP)
ETL_ASSERT(!full(), ETL_ERROR(deque_full));
#endif
ETL_ASSERT_CHECK_PUSH_POP_OR_RETURN(!full(), ETL_ERROR(deque_full));
create_element_front(etl::move(item));
}
#endif
@ -1936,9 +1919,7 @@ namespace etl
template <typename ... Args>
reference emplace_front(Args && ... args)
{
#if defined(ETL_CHECK_PUSH_POP)
ETL_ASSERT(!full(), ETL_ERROR(deque_full));
#endif
ETL_ASSERT_CHECK_PUSH_POP(!full(), ETL_ERROR(deque_full));
--_begin;
::new (&(*_begin)) T(etl::forward<Args>(args)...);
@ -1955,9 +1936,7 @@ namespace etl
//*************************************************************************
reference emplace_front()
{
#if defined(ETL_CHECK_PUSH_POP)
ETL_ASSERT(!full(), ETL_ERROR(deque_full));
#endif
ETL_ASSERT_CHECK_PUSH_POP(!full(), ETL_ERROR(deque_full));
--_begin;
::new (&(*_begin)) T();
@ -1973,9 +1952,7 @@ namespace etl
template <typename T1>
reference emplace_front(const T1& value1)
{
#if defined(ETL_CHECK_PUSH_POP)
ETL_ASSERT(!full(), ETL_ERROR(deque_full));
#endif
ETL_ASSERT_CHECK_PUSH_POP(!full(), ETL_ERROR(deque_full));
--_begin;
::new (&(*_begin)) T(value1);
@ -1991,9 +1968,7 @@ namespace etl
template <typename T1, typename T2>
reference emplace_front(const T1& value1, const T2& value2)
{
#if defined(ETL_CHECK_PUSH_POP)
ETL_ASSERT(!full(), ETL_ERROR(deque_full));
#endif
ETL_ASSERT_CHECK_PUSH_POP(!full(), ETL_ERROR(deque_full));
--_begin;
::new (&(*_begin)) T(value1, value2);
@ -2009,9 +1984,7 @@ namespace etl
template <typename T1, typename T2, typename T3>
reference emplace_front(const T1& value1, const T2& value2, const T3& value3)
{
#if defined(ETL_CHECK_PUSH_POP)
ETL_ASSERT(!full(), ETL_ERROR(deque_full));
#endif
ETL_ASSERT_CHECK_PUSH_POP(!full(), ETL_ERROR(deque_full));
--_begin;
::new (&(*_begin)) T(value1, value2, value3);
@ -2027,9 +2000,7 @@ namespace etl
template <typename T1, typename T2, typename T3, typename T4>
reference emplace_front(const T1& value1, const T2& value2, const T3& value3, const T4& value4)
{
#if defined(ETL_CHECK_PUSH_POP)
ETL_ASSERT(!full(), ETL_ERROR(deque_full));
#endif
ETL_ASSERT_CHECK_PUSH_POP(!full(), ETL_ERROR(deque_full));
--_begin;
::new (&(*_begin)) T(value1, value2, value3, value4);
@ -2044,9 +2015,8 @@ namespace etl
//*************************************************************************
void pop_front()
{
#if defined(ETL_CHECK_PUSH_POP)
ETL_ASSERT(!empty(), ETL_ERROR(deque_empty));
#endif
ETL_ASSERT_CHECK_PUSH_POP_OR_RETURN(!empty(), ETL_ERROR(deque_empty));
destroy_element_front();
}

View File

@ -420,18 +420,31 @@ namespace etl
#define ETL_DEBUG_ASSERT_FAIL_AND_RETURN_VALUE(e, v) {return(v);} // Returns a value.
#endif
//*************************************
#if defined(ETL_CHECK_PUSH_POP)
#define ETL_ASSERT_CHECK_PUSH_POP(b, e) ETL_ASSERT(b, e)
#define ETL_ASSERT_CHECK_PUSH_POP_OR_RETURN(b, e) ETL_ASSERT_OR_RETURN(b, e)
#else
#define ETL_ASSERT_CHECK_PUSH_POP(b, e)
#define ETL_ASSERT_CHECK_PUSH_POP_OR_RETURN(b, e)
#endif
//*************************************
#ifdef ETL_CHECK_INDEX_OPERATOR
#define ETL_ASSERT_CHECK_INDEX_OPERATOR(b, e) ETL_ASSERT(b,e)
#else
#define ETL_ASSERT_CHECK_INDEX_OPERATOR(b, e)
#endif
//*************************************
#if defined(ETL_VERBOSE_ERRORS)
#define ETL_ERROR(e) (e(__FILE__, __LINE__)) // Make an exception with the file name and line number.
#define ETL_ERROR_WITH_VALUE(e, v) (e(__FILE__, __LINE__, (v))) // Make an exception with the file name, line number and value.
#else
#define ETL_ERROR(e) (e("", __LINE__)) // Make an exception with the line number.
#define ETL_ERROR_WITH_VALUE(e, v) (e("", __LINE__, (v))) // Make an exception with the file name, line number and value.
#endif
#if defined(ETL_VERBOSE_ERRORS)
#define ETL_ERROR_TEXT(verbose_text, terse_text) (verbose_text) // Use the verbose text.
#else
#define ETL_ERROR_TEXT(verbose_text, terse_text) (terse_text) // Use the terse text.
#define ETL_ERROR(e) (e("", __LINE__)) // Make an exception with the line number.
#define ETL_ERROR_WITH_VALUE(e, v) (e("", __LINE__, (v))) // Make an exception with the file name, line number and value.
#define ETL_ERROR_TEXT(verbose_text, terse_text) (terse_text) // Use the terse text.
#endif
#endif

View File

@ -694,9 +694,7 @@ namespace etl
//*************************************************************************
void push_front(const T& value)
{
#if defined(ETL_CHECK_PUSH_POP)
ETL_ASSERT(!full(), ETL_ERROR(forward_list_full));
#endif
ETL_ASSERT_CHECK_PUSH_POP_OR_RETURN(!full(), ETL_ERROR(forward_list_full));
data_node_t& data_node = allocate_data_node(value);
insert_node_after(start_node, data_node);
@ -708,9 +706,7 @@ namespace etl
//*************************************************************************
void push_front(rvalue_reference value)
{
#if defined(ETL_CHECK_PUSH_POP)
ETL_ASSERT(!full(), ETL_ERROR(forward_list_full));
#endif
ETL_ASSERT_CHECK_PUSH_POP_OR_RETURN(!full(), ETL_ERROR(forward_list_full));
data_node_t& data_node = allocate_data_node(etl::move(value));
insert_node_after(start_node, data_node);
@ -724,9 +720,8 @@ namespace etl
template <typename ... Args>
reference emplace_front(Args && ... args)
{
#if defined(ETL_CHECK_PUSH_POP)
ETL_ASSERT(!full(), ETL_ERROR(forward_list_full));
#endif
ETL_ASSERT_CHECK_PUSH_POP(!full(), ETL_ERROR(forward_list_full));
data_node_t* p_data_node = allocate_data_node();
::new (&(p_data_node->value)) T(etl::forward<Args>(args)...);
ETL_INCREMENT_DEBUG_COUNT;
@ -739,9 +734,8 @@ namespace etl
//*************************************************************************
reference emplace_front()
{
#if defined(ETL_CHECK_PUSH_POP)
ETL_ASSERT(!full(), ETL_ERROR(forward_list_full));
#endif
ETL_ASSERT_CHECK_PUSH_POP(!full(), ETL_ERROR(forward_list_full));
data_node_t* p_data_node = allocate_data_node();
::new (&(p_data_node->value)) T();
ETL_INCREMENT_DEBUG_COUNT;
@ -755,9 +749,8 @@ namespace etl
template <typename T1>
reference emplace_front(const T1& value1)
{
#if defined(ETL_CHECK_PUSH_POP)
ETL_ASSERT(!full(), ETL_ERROR(forward_list_full));
#endif
ETL_ASSERT_CHECK_PUSH_POP(!full(), ETL_ERROR(forward_list_full));
data_node_t* p_data_node = allocate_data_node();
::new (&(p_data_node->value)) T(value1);
ETL_INCREMENT_DEBUG_COUNT;
@ -771,9 +764,8 @@ namespace etl
template <typename T1, typename T2>
reference emplace_front(const T1& value1, const T2& value2)
{
#if defined(ETL_CHECK_PUSH_POP)
ETL_ASSERT(!full(), ETL_ERROR(forward_list_full));
#endif
ETL_ASSERT_CHECK_PUSH_POP(!full(), ETL_ERROR(forward_list_full));
data_node_t* p_data_node = allocate_data_node();
::new (&(p_data_node->value)) T(value1, value2);
ETL_INCREMENT_DEBUG_COUNT;
@ -787,9 +779,8 @@ namespace etl
template <typename T1, typename T2, typename T3>
reference emplace_front(const T1& value1, const T2& value2, const T3& value3)
{
#if defined(ETL_CHECK_PUSH_POP)
ETL_ASSERT(!full(), ETL_ERROR(forward_list_full));
#endif
ETL_ASSERT_CHECK_PUSH_POP(!full(), ETL_ERROR(forward_list_full));
data_node_t* p_data_node = allocate_data_node();
::new (&(p_data_node->value)) T(value1, value2, value3);
ETL_INCREMENT_DEBUG_COUNT;
@ -803,9 +794,8 @@ namespace etl
template <typename T1, typename T2, typename T3, typename T4>
reference emplace_front(const T1& value1, const T2& value2, const T3& value3, const T4& value4)
{
#if defined(ETL_CHECK_PUSH_POP)
ETL_ASSERT(!full(), ETL_ERROR(forward_list_full));
#endif
ETL_ASSERT_CHECK_PUSH_POP(!full(), ETL_ERROR(forward_list_full));
data_node_t* p_data_node = allocate_data_node();
::new (&(p_data_node->value)) T(value1, value2, value3, value4);
ETL_INCREMENT_DEBUG_COUNT;
@ -819,9 +809,8 @@ namespace etl
//*************************************************************************
void pop_front()
{
#if defined(ETL_CHECK_PUSH_POP)
ETL_ASSERT(!empty(), ETL_ERROR(forward_list_empty));
#endif
ETL_ASSERT_CHECK_PUSH_POP_OR_RETURN(!empty(), ETL_ERROR(forward_list_empty));
remove_node_after(start_node);
}

View File

@ -757,9 +757,8 @@ namespace etl
//*********************************************************************
void push_back(const_reference value)
{
#if defined(ETL_CHECK_PUSH_POP)
ETL_ASSERT(size() != capacity(), ETL_ERROR(vector_full));
#endif
ETL_ASSERT_CHECK_PUSH_POP_OR_RETURN(size() != capacity(), ETL_ERROR(vector_full));
T* p = storage.create<T>(value);
lookup.push_back(p);
}
@ -772,9 +771,8 @@ namespace etl
//*********************************************************************
void push_back(rvalue_reference value)
{
#if defined(ETL_CHECK_PUSH_POP)
ETL_ASSERT(size() != capacity(), ETL_ERROR(vector_full));
#endif
ETL_ASSERT_CHECK_PUSH_POP_OR_RETURN(size() != capacity(), ETL_ERROR(vector_full));
T* p = storage.create<T>(etl::move(value));
lookup.push_back(p);
}

View File

@ -206,9 +206,8 @@ namespace etl
//*************************************************************************
void pop_front()
{
#if defined(ETL_CHECK_PUSH_POP)
ETL_ASSERT_OR_RETURN(!empty(), ETL_ERROR(intrusive_forward_list_empty));
#endif
ETL_ASSERT_CHECK_PUSH_POP_OR_RETURN(!empty(), ETL_ERROR(intrusive_forward_list_empty));
disconnect_link_after(start);
}

View File

@ -172,9 +172,8 @@ namespace etl
//*************************************************************************
void pop_front()
{
#if defined(ETL_CHECK_PUSH_POP)
ETL_ASSERT(!empty(), ETL_ERROR(intrusive_list_empty));
#endif
ETL_ASSERT_CHECK_PUSH_POP_OR_RETURN(!empty(), ETL_ERROR(intrusive_list_empty));
disconnect_link(get_head());
}
@ -193,9 +192,8 @@ namespace etl
//*************************************************************************
void pop_back()
{
#if defined(ETL_CHECK_PUSH_POP)
ETL_ASSERT(!empty(), ETL_ERROR(intrusive_list_empty));
#endif
ETL_ASSERT_CHECK_PUSH_POP_OR_RETURN(!empty(), ETL_ERROR(intrusive_list_empty));
disconnect_link(get_tail());
}

View File

@ -124,9 +124,7 @@ namespace etl
//*************************************************************************
void pop()
{
#if defined(ETL_CHECK_PUSH_POP)
ETL_ASSERT_OR_RETURN(!empty(), ETL_ERROR(intrusive_queue_empty));
#endif
ETL_ASSERT_CHECK_PUSH_POP_OR_RETURN(!empty(), ETL_ERROR(intrusive_queue_empty));
link_type* p_front = terminator.etl_next;

View File

@ -115,9 +115,8 @@ namespace etl
//*************************************************************************
void pop()
{
#if defined(ETL_CHECK_PUSH_POP)
ETL_ASSERT_OR_RETURN(!empty(), ETL_ERROR(intrusive_stack_empty));
#endif
ETL_ASSERT_CHECK_PUSH_POP_OR_RETURN(!empty(), ETL_ERROR(intrusive_stack_empty));
link_type* p_next = p_top->etl_next;
p_top->clear();
p_top = p_next;

View File

@ -837,9 +837,8 @@ namespace etl
//*************************************************************************
void push_front(const T& value)
{
#if defined(ETL_CHECK_PUSH_POP)
ETL_ASSERT(!full(), ETL_ERROR(list_full));
#endif
ETL_ASSERT_CHECK_PUSH_POP_OR_RETURN(!full(), ETL_ERROR(list_full));
insert_node(get_head(), allocate_data_node(value));
}
@ -849,9 +848,8 @@ namespace etl
//*************************************************************************
void push_front(rvalue_reference value)
{
#if defined(ETL_CHECK_PUSH_POP)
ETL_ASSERT(!full(), ETL_ERROR(list_full));
#endif
ETL_ASSERT_CHECK_PUSH_POP_OR_RETURN(!full(), ETL_ERROR(list_full));
insert_node(get_head(), allocate_data_node(etl::move(value)));
}
#endif
@ -863,9 +861,9 @@ namespace etl
template <typename ... Args>
reference emplace_front(Args && ... args)
{
#if defined(ETL_CHECK_PUSH_POP)
ETL_ASSERT(!full(), ETL_ERROR(list_full));
#endif
ETL_ASSERT_CHECK_PUSH_POP(!full(), ETL_ERROR(list_full));
ETL_ASSERT(p_node_pool != ETL_NULLPTR, ETL_ERROR(list_no_pool));
data_node_t* p_data_node = allocate_data_node();
@ -880,9 +878,8 @@ namespace etl
//*************************************************************************
reference emplace_front()
{
#if defined(ETL_CHECK_PUSH_POP)
ETL_ASSERT(!full(), ETL_ERROR(list_full));
#endif
ETL_ASSERT_CHECK_PUSH_POP(!full(), ETL_ERROR(list_full));
ETL_ASSERT(p_node_pool != ETL_NULLPTR, ETL_ERROR(list_no_pool));
data_node_t* p_data_node = allocate_data_node();
@ -898,9 +895,8 @@ namespace etl
template <typename T1>
reference emplace_front(const T1& value1)
{
#if defined(ETL_CHECK_PUSH_POP)
ETL_ASSERT(!full(), ETL_ERROR(list_full));
#endif
ETL_ASSERT_CHECK_PUSH_POP(!full(), ETL_ERROR(list_full));
ETL_ASSERT(p_node_pool != ETL_NULLPTR, ETL_ERROR(list_no_pool));
data_node_t* p_data_node = allocate_data_node();
@ -916,9 +912,8 @@ namespace etl
template <typename T1, typename T2>
reference emplace_front(const T1& value1, const T2& value2)
{
#if defined(ETL_CHECK_PUSH_POP)
ETL_ASSERT(!full(), ETL_ERROR(list_full));
#endif
ETL_ASSERT_CHECK_PUSH_POP(!full(), ETL_ERROR(list_full));
ETL_ASSERT(p_node_pool != ETL_NULLPTR, ETL_ERROR(list_no_pool));
data_node_t* p_data_node = allocate_data_node();
@ -934,9 +929,8 @@ namespace etl
template <typename T1, typename T2, typename T3>
reference emplace_front(const T1& value1, const T2& value2, const T3& value3)
{
#if defined(ETL_CHECK_PUSH_POP)
ETL_ASSERT(!full(), ETL_ERROR(list_full));
#endif
ETL_ASSERT_CHECK_PUSH_POP(!full(), ETL_ERROR(list_full));
ETL_ASSERT(p_node_pool != ETL_NULLPTR, ETL_ERROR(list_no_pool));
data_node_t* p_data_node = allocate_data_node();
@ -952,9 +946,8 @@ namespace etl
template <typename T1, typename T2, typename T3, typename T4>
reference emplace_front(const T1& value1, const T2& value2, const T3& value3, const T4& value4)
{
#if defined(ETL_CHECK_PUSH_POP)
ETL_ASSERT(!full(), ETL_ERROR(list_full));
#endif
ETL_ASSERT_CHECK_PUSH_POP(!full(), ETL_ERROR(list_full));
ETL_ASSERT(p_node_pool != ETL_NULLPTR, ETL_ERROR(list_no_pool));
data_node_t* p_data_node = allocate_data_node();
@ -970,9 +963,8 @@ namespace etl
//*************************************************************************
void pop_front()
{
#if defined(ETL_CHECK_PUSH_POP)
ETL_ASSERT(!empty(), ETL_ERROR(list_empty));
#endif
ETL_ASSERT_CHECK_PUSH_POP_OR_RETURN(!empty(), ETL_ERROR(list_empty));
node_t& node = get_head();
remove_node(node);
}
@ -982,9 +974,8 @@ namespace etl
//*************************************************************************
void push_back(const T& value)
{
#if defined(ETL_CHECK_PUSH_POP)
ETL_ASSERT(!full(), ETL_ERROR(list_full));
#endif
ETL_ASSERT_CHECK_PUSH_POP_OR_RETURN(!full(), ETL_ERROR(list_full));
insert_node(terminal_node, allocate_data_node(value));
}
@ -994,9 +985,8 @@ namespace etl
//*************************************************************************
void push_back(rvalue_reference value)
{
#if defined(ETL_CHECK_PUSH_POP)
ETL_ASSERT(!full(), ETL_ERROR(list_full));
#endif
ETL_ASSERT_CHECK_PUSH_POP_OR_RETURN(!full(), ETL_ERROR(list_full));
insert_node(terminal_node, allocate_data_node(etl::move(value)));
}
#endif
@ -1008,9 +998,8 @@ namespace etl
template <typename ... Args>
reference emplace_back(Args && ... args)
{
#if defined(ETL_CHECK_PUSH_POP)
ETL_ASSERT(!full(), ETL_ERROR(list_full));
#endif
ETL_ASSERT_CHECK_PUSH_POP(!full(), ETL_ERROR(list_full));
ETL_ASSERT(p_node_pool != ETL_NULLPTR, ETL_ERROR(list_no_pool));
data_node_t* p_data_node = allocate_data_node();
@ -1022,9 +1011,8 @@ namespace etl
#else
reference emplace_back()
{
#if defined(ETL_CHECK_PUSH_POP)
ETL_ASSERT(!full(), ETL_ERROR(list_full));
#endif
ETL_ASSERT_CHECK_PUSH_POP(!full(), ETL_ERROR(list_full));
ETL_ASSERT(p_node_pool != ETL_NULLPTR, ETL_ERROR(list_no_pool));
data_node_t* p_data_node = allocate_data_node();
@ -1037,9 +1025,8 @@ namespace etl
template <typename T1>
reference emplace_back(const T1& value1)
{
#if defined(ETL_CHECK_PUSH_POP)
ETL_ASSERT(!full(), ETL_ERROR(list_full));
#endif
ETL_ASSERT_CHECK_PUSH_POP(!full(), ETL_ERROR(list_full));
ETL_ASSERT(p_node_pool != ETL_NULLPTR, ETL_ERROR(list_no_pool));
data_node_t* p_data_node = allocate_data_node();
@ -1052,9 +1039,8 @@ namespace etl
template <typename T1, typename T2>
reference emplace_back(const T1& value1, const T2& value2)
{
#if defined(ETL_CHECK_PUSH_POP)
ETL_ASSERT(!full(), ETL_ERROR(list_full));
#endif
ETL_ASSERT_CHECK_PUSH_POP(!full(), ETL_ERROR(list_full));
ETL_ASSERT(p_node_pool != ETL_NULLPTR, ETL_ERROR(list_no_pool));
data_node_t* p_data_node = allocate_data_node();
@ -1067,9 +1053,8 @@ namespace etl
template <typename T1, typename T2, typename T3>
reference emplace_back(const T1& value1, const T2& value2, const T3& value3)
{
#if defined(ETL_CHECK_PUSH_POP)
ETL_ASSERT(!full(), ETL_ERROR(list_full));
#endif
ETL_ASSERT_CHECK_PUSH_POP(!full(), ETL_ERROR(list_full));
ETL_ASSERT(p_node_pool != ETL_NULLPTR, ETL_ERROR(list_no_pool));
data_node_t* p_data_node = allocate_data_node();
@ -1082,9 +1067,8 @@ namespace etl
template <typename T1, typename T2, typename T3, typename T4>
reference emplace_back(const T1& value1, const T2& value2, const T3& value3, const T4& value4)
{
#if defined(ETL_CHECK_PUSH_POP)
ETL_ASSERT(!full(), ETL_ERROR(list_full));
#endif
ETL_ASSERT_CHECK_PUSH_POP(!full(), ETL_ERROR(list_full));
ETL_ASSERT(p_node_pool != ETL_NULLPTR, ETL_ERROR(list_no_pool));
data_node_t* p_data_node = allocate_data_node();
@ -1100,9 +1084,8 @@ namespace etl
//*************************************************************************
void pop_back()
{
#if defined(ETL_CHECK_PUSH_POP)
ETL_ASSERT(!empty(), ETL_ERROR(list_empty));
#endif
ETL_ASSERT_CHECK_PUSH_POP_OR_RETURN(!empty(), ETL_ERROR(list_empty));
node_t& node = get_tail();
remove_node(node);
}

View File

@ -400,9 +400,8 @@ namespace etl
//*********************************************************************
void push_back(value_type value)
{
#if defined(ETL_CHECK_PUSH_POP)
ETL_ASSERT_OR_RETURN(size() != CAPACITY, ETL_ERROR(vector_full));
#endif
ETL_ASSERT_CHECK_PUSH_POP_OR_RETURN(size() != CAPACITY, ETL_ERROR(vector_full));
*p_end++ = value;
}
@ -413,9 +412,8 @@ namespace etl
//*********************************************************************
void emplace_back(value_type value)
{
#if defined(ETL_CHECK_PUSH_POP)
ETL_ASSERT_OR_RETURN(size() != CAPACITY, ETL_ERROR(vector_full));
#endif
ETL_ASSERT_CHECK_PUSH_POP_OR_RETURN(size() != CAPACITY, ETL_ERROR(vector_full));
* p_end++ = value;
}
@ -425,9 +423,8 @@ namespace etl
//*************************************************************************
void pop_back()
{
#if defined(ETL_CHECK_PUSH_POP)
ETL_ASSERT_OR_RETURN(size() > 0, ETL_ERROR(vector_empty));
#endif
ETL_ASSERT_CHECK_PUSH_POP_OR_RETURN(size() > 0, ETL_ERROR(vector_empty));
--p_end;
}

View File

@ -308,9 +308,8 @@ namespace etl
//*************************************************************************
void push(const_reference value)
{
#if defined(ETL_CHECK_PUSH_POP)
ETL_ASSERT(!full(), ETL_ERROR(queue_full));
#endif
ETL_ASSERT_CHECK_PUSH_POP_OR_RETURN(!full(), ETL_ERROR(queue_full));
::new (&p_buffer[in]) T(value);
add_in();
}
@ -323,9 +322,8 @@ namespace etl
//*************************************************************************
void push(rvalue_reference value)
{
#if defined(ETL_CHECK_PUSH_POP)
ETL_ASSERT(!full(), ETL_ERROR(queue_full));
#endif
ETL_ASSERT_CHECK_PUSH_POP_OR_RETURN(!full(), ETL_ERROR(queue_full));
::new (&p_buffer[in]) T(etl::move(value));
add_in();
}
@ -340,9 +338,8 @@ namespace etl
template <typename ... Args>
reference emplace(Args && ... args)
{
#if defined(ETL_CHECK_PUSH_POP)
ETL_ASSERT(!full(), ETL_ERROR(queue_full));
#endif
ETL_ASSERT_CHECK_PUSH_POP(!full(), ETL_ERROR(queue_full));
reference value = p_buffer[in];
::new (&value) T(etl::forward<Args>(args)...);
add_in();
@ -355,9 +352,8 @@ namespace etl
//*************************************************************************
reference emplace()
{
#if defined(ETL_CHECK_PUSH_POP)
ETL_ASSERT(!full(), ETL_ERROR(queue_full));
#endif
ETL_ASSERT_CHECK_PUSH_POP(!full(), ETL_ERROR(queue_full));
reference value = p_buffer[in];
::new (&value) T();
add_in();
@ -372,9 +368,8 @@ namespace etl
template <typename T1>
reference emplace(const T1& value1)
{
#if defined(ETL_CHECK_PUSH_POP)
ETL_ASSERT(!full(), ETL_ERROR(queue_full));
#endif
ETL_ASSERT_CHECK_PUSH_POP(!full(), ETL_ERROR(queue_full));
reference value = p_buffer[in];
::new (&value) T(value1);
add_in();
@ -390,9 +385,8 @@ namespace etl
template <typename T1, typename T2>
reference emplace(const T1& value1, const T2& value2)
{
#if defined(ETL_CHECK_PUSH_POP)
ETL_ASSERT(!full(), ETL_ERROR(queue_full));
#endif
ETL_ASSERT_CHECK_PUSH_POP(!full(), ETL_ERROR(queue_full));
reference value = p_buffer[in];
::new (&value) T(value1, value2);
add_in();
@ -409,9 +403,8 @@ namespace etl
template <typename T1, typename T2, typename T3>
reference emplace(const T1& value1, const T2& value2, const T3& value3)
{
#if defined(ETL_CHECK_PUSH_POP)
ETL_ASSERT(!full(), ETL_ERROR(queue_full));
#endif
ETL_ASSERT_CHECK_PUSH_POP(!full(), ETL_ERROR(queue_full));
reference value = p_buffer[in];
::new (&value) T(value1, value2, value3);
add_in();
@ -429,9 +422,8 @@ namespace etl
template <typename T1, typename T2, typename T3, typename T4>
reference emplace(const T1& value1, const T2& value2, const T3& value3, const T4& value4)
{
#if defined(ETL_CHECK_PUSH_POP)
ETL_ASSERT(!full(), ETL_ERROR(queue_full));
#endif
ETL_ASSERT_CHECK_PUSH_POP(!full(), ETL_ERROR(queue_full));
reference value = p_buffer[in];
::new (&value) T(value1, value2, value3, value4);
add_in();
@ -468,9 +460,8 @@ namespace etl
//*************************************************************************
void pop()
{
#if defined(ETL_CHECK_PUSH_POP)
ETL_ASSERT_OR_RETURN(!empty(), ETL_ERROR(queue_empty));
#endif
ETL_ASSERT_CHECK_PUSH_POP_OR_RETURN(!empty(), ETL_ERROR(queue_empty));
p_buffer[out].~T();
del_out();
}

View File

@ -253,9 +253,8 @@ namespace etl
//*************************************************************************
void push(const_reference value)
{
#if defined(ETL_CHECK_PUSH_POP)
ETL_ASSERT(!full(), ETL_ERROR(stack_full));
#endif
ETL_ASSERT_CHECK_PUSH_POP_OR_RETURN(!full(), ETL_ERROR(stack_full));
base_t::add_in();
::new (&p_buffer[top_index]) T(value);
}
@ -268,9 +267,8 @@ namespace etl
//*************************************************************************
void push(rvalue_reference value)
{
#if defined(ETL_CHECK_PUSH_POP)
ETL_ASSERT(!full(), ETL_ERROR(stack_full));
#endif
ETL_ASSERT_CHECK_PUSH_POP_OR_RETURN(!full(), ETL_ERROR(stack_full));
base_t::add_in();
::new (&p_buffer[top_index]) T(etl::move(value));
}
@ -285,9 +283,8 @@ namespace etl
template <typename ... Args>
reference emplace(Args && ... args)
{
#if defined(ETL_CHECK_PUSH_POP)
ETL_ASSERT(!full(), ETL_ERROR(stack_full));
#endif
ETL_ASSERT_CHECK_PUSH_POP(!full(), ETL_ERROR(stack_full));
base_t::add_in();
::new (&p_buffer[top_index]) T(etl::forward<Args>(args)...);
@ -301,9 +298,8 @@ namespace etl
//*************************************************************************
reference emplace()
{
#if defined(ETL_CHECK_PUSH_POP)
ETL_ASSERT(!full(), ETL_ERROR(stack_full));
#endif
ETL_ASSERT_CHECK_PUSH_POP(!full(), ETL_ERROR(stack_full));
base_t::add_in();
::new (&p_buffer[top_index]) T();
@ -318,9 +314,8 @@ namespace etl
template <typename T1>
reference emplace(const T1& value1)
{
#if defined(ETL_CHECK_PUSH_POP)
ETL_ASSERT(!full(), ETL_ERROR(stack_full));
#endif
ETL_ASSERT_CHECK_PUSH_POP(!full(), ETL_ERROR(stack_full));
base_t::add_in();
::new (&p_buffer[top_index]) T(value1);
@ -335,9 +330,8 @@ namespace etl
template <typename T1, typename T2>
reference emplace(const T1& value1, const T2& value2)
{
#if defined(ETL_CHECK_PUSH_POP)
ETL_ASSERT(!full(), ETL_ERROR(stack_full));
#endif
ETL_ASSERT_CHECK_PUSH_POP(!full(), ETL_ERROR(stack_full));
base_t::add_in();
::new (&p_buffer[top_index]) T(value1, value2);
@ -352,9 +346,8 @@ namespace etl
template <typename T1, typename T2, typename T3>
reference emplace(const T1& value1, const T2& value2, const T3& value3)
{
#if defined(ETL_CHECK_PUSH_POP)
ETL_ASSERT(!full(), ETL_ERROR(stack_full));
#endif
ETL_ASSERT_CHECK_PUSH_POP(!full(), ETL_ERROR(stack_full));
base_t::add_in();
::new (&p_buffer[top_index]) T(value1, value2, value3);
@ -369,9 +362,8 @@ namespace etl
template <typename T1, typename T2, typename T3, typename T4>
reference emplace(const T1& value1, const T2& value2, const T3& value3, const T4& value4)
{
#if defined(ETL_CHECK_PUSH_POP)
ETL_ASSERT(!full(), ETL_ERROR(stack_full));
#endif
ETL_ASSERT_CHECK_PUSH_POP(!full(), ETL_ERROR(stack_full));
base_t::add_in();
::new (&p_buffer[top_index]) T(value1, value2, value3, value4);
@ -412,9 +404,8 @@ namespace etl
//*************************************************************************
void pop()
{
#if defined(ETL_CHECK_PUSH_POP)
ETL_ASSERT_OR_RETURN(!empty(), ETL_ERROR(stack_empty));
#endif
ETL_ASSERT_CHECK_PUSH_POP_OR_RETURN(!empty(), ETL_ERROR(stack_empty));
p_buffer[top_index].~T();
base_t::del_out();
}

View File

@ -433,9 +433,8 @@ namespace etl
//*********************************************************************
void push_back(const_reference value)
{
#if defined(ETL_CHECK_PUSH_POP)
ETL_ASSERT_OR_RETURN(size() != CAPACITY, ETL_ERROR(vector_full));
#endif
ETL_ASSERT_CHECK_PUSH_POP_OR_RETURN(size() != CAPACITY, ETL_ERROR(vector_full));
create_back(value);
}
@ -447,9 +446,8 @@ namespace etl
//*********************************************************************
void push_back(rvalue_reference value)
{
#if defined(ETL_CHECK_PUSH_POP)
ETL_ASSERT_OR_RETURN(size() != CAPACITY, ETL_ERROR(vector_full));
#endif
ETL_ASSERT_CHECK_PUSH_POP_OR_RETURN(size() != CAPACITY, ETL_ERROR(vector_full));
create_back(etl::move(value));
}
#endif
@ -463,9 +461,8 @@ namespace etl
template <typename ... Args>
reference emplace_back(Args && ... args)
{
#if defined(ETL_CHECK_PUSH_POP)
ETL_ASSERT(size() != CAPACITY, ETL_ERROR(vector_full));
#endif
ETL_ASSERT_CHECK_PUSH_POP(size() != CAPACITY, ETL_ERROR(vector_full));
::new (p_end) T(etl::forward<Args>(args)...);
++p_end;
ETL_INCREMENT_DEBUG_COUNT;
@ -479,9 +476,8 @@ namespace etl
//*********************************************************************
reference emplace_back()
{
#if defined(ETL_CHECK_PUSH_POP)
ETL_ASSERT(size() != CAPACITY, ETL_ERROR(vector_full));
#endif
ETL_ASSERT_CHECK_PUSH_POP(size() != CAPACITY, ETL_ERROR(vector_full));
::new (p_end) T();
++p_end;
ETL_INCREMENT_DEBUG_COUNT;
@ -496,9 +492,8 @@ namespace etl
template <typename T1>
reference emplace_back(const T1& value1)
{
#if defined(ETL_CHECK_PUSH_POP)
ETL_ASSERT(size() != CAPACITY, ETL_ERROR(vector_full));
#endif
ETL_ASSERT_CHECK_PUSH_POP(size() != CAPACITY, ETL_ERROR(vector_full));
::new (p_end) T(value1);
++p_end;
ETL_INCREMENT_DEBUG_COUNT;
@ -513,9 +508,8 @@ namespace etl
template <typename T1, typename T2>
reference emplace_back(const T1& value1, const T2& value2)
{
#if defined(ETL_CHECK_PUSH_POP)
ETL_ASSERT(size() != CAPACITY, ETL_ERROR(vector_full));
#endif
ETL_ASSERT_CHECK_PUSH_POP(size() != CAPACITY, ETL_ERROR(vector_full));
::new (p_end) T(value1, value2);
++p_end;
ETL_INCREMENT_DEBUG_COUNT;
@ -530,9 +524,8 @@ namespace etl
template <typename T1, typename T2, typename T3>
reference emplace_back(const T1& value1, const T2& value2, const T3& value3)
{
#if defined(ETL_CHECK_PUSH_POP)
ETL_ASSERT(size() != CAPACITY, ETL_ERROR(vector_full));
#endif
ETL_ASSERT_CHECK_PUSH_POP(size() != CAPACITY, ETL_ERROR(vector_full));
::new (p_end) T(value1, value2, value3);
++p_end;
ETL_INCREMENT_DEBUG_COUNT;
@ -547,9 +540,8 @@ namespace etl
template <typename T1, typename T2, typename T3, typename T4>
reference emplace_back(const T1& value1, const T2& value2, const T3& value3, const T4& value4)
{
#if defined(ETL_CHECK_PUSH_POP)
ETL_ASSERT(size() != CAPACITY, ETL_ERROR(vector_full));
#endif
ETL_ASSERT_CHECK_PUSH_POP(size() != CAPACITY, ETL_ERROR(vector_full));
::new (p_end) T(value1, value2, value3, value4);
++p_end;
ETL_INCREMENT_DEBUG_COUNT;
@ -560,12 +552,12 @@ namespace etl
//*************************************************************************
/// Removes an element from the end of the vector.
/// Does nothing if the vector is empty.
/// If asserts or exceptions are enabled, emits vector_empty if the vector is empty.
//*************************************************************************
void pop_back()
{
#if defined(ETL_CHECK_PUSH_POP)
ETL_ASSERT_OR_RETURN(size() > 0, ETL_ERROR(vector_empty));
#endif
ETL_ASSERT_CHECK_PUSH_POP_OR_RETURN(size() > 0, ETL_ERROR(vector_empty));
destroy_back();
}