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 25, 2015
2 parents c7abb82 + dc374a3 commit 94914dc
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions error_handler.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ namespace etl
//*************************************************************************
/// Callback class for free handler functions.
//*************************************************************************
struct free_function : public function<void, const etl::exception&>
struct free_function : public etl::function<void, const etl::exception&>
{
free_function(void (*p_function)(const etl::exception&))
: etl::function<void, const etl::exception&>(p_function)
Expand Down Expand Up @@ -84,7 +84,7 @@ namespace etl
}

//***************************************************************************
/// Asserts a coondition.
/// Asserts a condition.
/// Versions of the macro that return a constant value of 'true' will allow the compiler to optimise away
/// any 'if' statements that it is contained within.
/// If ETL_NO_CHECKS is defined then no runtime checks are executed at all.
Expand All @@ -94,35 +94,35 @@ namespace etl
///\ingroup error_handler
//***************************************************************************
#if defined(ETL_NO_CHECKS)
#define ETL_ASSERT(b, e) // Does nothing.
#define ETL_ASSERT(b, e) // Does nothing.
#elif defined(ETL_THROW_EXCEPTIONS)
#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.
#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.
#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) // Does nothing.
#define ETL_ASSERT(b, e) // Does nothing.
#else
#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.
#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.
#define ETL_ASSERT(b, e) assert((b)) // If the condition fails, asserts.
#endif
#endif
#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(e) (e(__FILE__, __LINE__)) // Make an exception with the file name and line number.
#else
#define ETL_ERROR(e) (e("", __LINE__)) // Make an exception with the line number.
#define ETL_ERROR(e) (e("", __LINE__)) // Make an exception with the line number.
#endif

#if defined(ETL_VERBOSE_ERRORS)
#define ETL_ERROR_TEXT(verbose_text, terse_text) (verbose_text) // Use the verbose text.
#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_TEXT(verbose_text, terse_text) (terse_text) // Use the terse text.
#endif

#endif
Expand Down

0 comments on commit 94914dc

Please sign in to comment.