From dc374a318547637c7b49dd1450254e39cb827db9 Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Fri, 25 Dec 2015 00:01:11 +0000 Subject: [PATCH] Error in ETL_ASSERT definition. Condition should be (!(b)) --- error_handler.h | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/error_handler.h b/error_handler.h index 9db4b08ae..e1f0ea55a 100644 --- a/error_handler.h +++ b/error_handler.h @@ -54,7 +54,7 @@ namespace etl //************************************************************************* /// Callback class for free handler functions. //************************************************************************* - struct free_function : public function + struct free_function : public etl::function { free_function(void (*p_function)(const etl::exception&)) : etl::function(p_function) @@ -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. @@ -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