From b9e20437d89aa69864846f37e66de417226b5811 Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Sat, 18 Jun 2016 07:08:55 +0100 Subject: [PATCH] Changed NDEBUG test so that it does not preclude using ETL_LOG_ERRORS --- src/error_handler.h | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/error_handler.h b/src/error_handler.h index 53875fcc..8a125ef4 100644 --- a/src/error_handler.h +++ b/src/error_handler.h @@ -102,11 +102,15 @@ namespace etl #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. - #else - #if defined(ETL_LOG_ERRORS) + #if defined(ETL_LOG_ERRORS) + #if defined(NDEBUG) + #define ETL_ASSERT(b, e) {etl::error_handler::error((e));} // If the condition fails, calls the error handler + #else #define ETL_ASSERT(b, e) {etl::error_handler::error((e)); assert((b));} // If the condition fails, calls the error handler then asserts. + #endif + #else + #if defined(NDEBUG) + #define ETL_ASSERT(b, e) // Does nothing. #else #define ETL_ASSERT(b, e) assert((b)) // If the condition fails, asserts. #endif