Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/development'
Browse files Browse the repository at this point in the history
  • Loading branch information
John Wellbelove committed Dec 24, 2015
2 parents 831d5dc + 6d2170a commit c7abb82
Show file tree
Hide file tree
Showing 28 changed files with 849 additions and 840 deletions.
35 changes: 31 additions & 4 deletions basic_intrusive_forward_list.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,38 @@ SOFTWARE.
#include "nullptr.h"
#include "type_traits.h"
#include "basic_intrusive_forward_list_node.h"
#include "error_handler.h"

namespace etl
{
//***************************************************************************
/// Exception for the intrusive_forward_list.
///\ingroup intrusive_forward_list
//***************************************************************************
class basic_intrusive_forward_list_exception : public exception
{
public:

basic_intrusive_forward_list_exception(string_type what, string_type file_name, numeric_type line_number)
: exception(what, file_name, line_number)
{
}
};

//***************************************************************************
/// Empty exception for the intrusive_forward_list.
///\ingroup intrusive_forward_list
//***************************************************************************
class basic_intrusive_forward_list_empty : public basic_intrusive_forward_list_exception
{
public:

basic_intrusive_forward_list_empty(string_type file_name, numeric_type line_number)
: basic_intrusive_forward_list_exception(ETL_ERROR_TEXT("basic_intrusive_forward_list:empty", ETL_FILE"A"), file_name, line_number)
{
}
};

//***************************************************************************
/// An intrusive forward list.
///\ingroup basic_intrusive_forward_list
Expand Down Expand Up @@ -400,10 +429,8 @@ namespace etl
//*************************************************************************
void pop_front()
{
if (!empty())
{
remove_node_after(start_node);
}
ETL_ASSERT(!empty(), ETL_ERROR(basic_intrusive_forward_list_empty));
remove_node_after(start_node);
}

//*************************************************************************
Expand Down
6 changes: 2 additions & 4 deletions bitset.h
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,8 @@ namespace etl
//*************************************************************************
bitset<N>& set(const char* text)
{
if (ETL_ASSERT(text != 0, ETL_ERROR(bitset_nullptr)))
{
ibitset::set(text);
}
ETL_ASSERT(text != 0, ETL_ERROR(bitset_nullptr));
ibitset::set(text);

return *this;
}
Expand Down
18 changes: 12 additions & 6 deletions error_handler.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,16 +94,22 @@ namespace etl
///\ingroup error_handler
//***************************************************************************
#if defined(ETL_NO_CHECKS)
#define ETL_ASSERT(b, e) (true) // Does nothing. Evaluates to 'true'.
#define ETL_ASSERT(b, e) // Does nothing.
#elif defined(ETL_THROW_EXCEPTIONS)
#define ETL_ASSERT(b, e) (((b) ? true : throw((e))), true) // Throws an exception if the condition fails. Evaluates to 'true'.
#elif defined(ETL_LOG_ERRORS)
#define ETL_ASSERT(b, e) (((b) ? true : etl::error_handler::error((e))), (b)) // Logs the error if the condition fails. Evaluates to the result of the condition.
#if defined(ETL_LOG_ERRORS)
#define ETL_ASSERT(b, e) {if (b) {etl::error_handler::error((e)); throw((e);)}} // If the condition fails, calls the error handler then throws an exception.
#else
#define ETL_ASSERT(b, e) {if (b) {throw((e));}} // If the condition fails, throws an exception.
#endif
#else
#if defined(NDEBUG)
#define ETL_ASSERT(b, e) (true) // Does nothing. Evaluates to 'true'.
#define ETL_ASSERT(b, e) // Does nothing.
#else
#define ETL_ASSERT(b, e) ((assert((b))), true) // Asserts if the condition fails. Evaluates to 'true'.
#if defined(ETL_LOG_ERRORS)
#define ETL_ASSERT(b, e) {etl::error_handler::error((e)); assert((b));} // If the condition fails, calls the error handler then asserts.
#else
#define ETL_ASSERT(b, e) assert((b)) // If the condition fails, asserts.
#endif
#endif
#endif

Expand Down
Loading

0 comments on commit c7abb82

Please sign in to comment.