From 38c73aa21585d4a970fb86102cbd2367c9889b51 Mon Sep 17 00:00:00 2001 From: Harry Moffat Date: Tue, 11 Aug 2009 18:38:48 +0000 Subject: [PATCH] Added guards against predefinitions of AssertThrows --- Cantera/src/base/ctexceptions.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Cantera/src/base/ctexceptions.h b/Cantera/src/base/ctexceptions.h index 51e5e0335..80b787814 100755 --- a/Cantera/src/base/ctexceptions.h +++ b/Cantera/src/base/ctexceptions.h @@ -180,9 +180,15 @@ namespace Cantera { #define STR_TRACE (std::string(__FILE__) + ":" + XSTR_TRACE_LINE(__LINE__)) #ifdef NDEBUG +#ifndef AssertTrace # define AssertTrace(expr) ((void) (0)) +#endif +#ifndef AssertThrow # define AssertThrow(expr, procedure) ((void) (0)) +#endif +#ifndef AssertThrowMsg # define AssertThrowMsg(expr,procedure, message) ((void) (0)) +#endif #else //! Assertion must be true or an error is thrown @@ -195,7 +201,9 @@ namespace Cantera { * * @ingroup errorhandling */ +#ifndef AssertTrace # define AssertTrace(expr) ((expr) ? (void) 0 : throw Cantera::CanteraError(STR_TRACE, std::string("failed assert: ") + #expr)) +#endif //! Assertion must be true or an error is thrown /*! @@ -206,7 +214,9 @@ namespace Cantera { * @param procedure Character string or std:string expression indicating the procedure where the assertion failed * @ingroup errorhandling */ +#ifndef AssertThrow # define AssertThrow(expr, procedure) ((expr) ? (void) 0 : throw Cantera::CanteraError(procedure, std::string("failed assert: ") + #expr)) +#endif //! Assertion must be true or an error is thrown /*! @@ -222,8 +232,13 @@ namespace Cantera { * * @ingroup errorhandling */ +#ifndef AssertThrowMsg # define AssertThrowMsg(expr, procedure, message) ((expr) ? (void) 0 : throw Cantera::CanteraError(procedure + std::string(": at failed assert: \"") + std::string(#expr) + std::string("\""), message)) #endif + + + +#endif }