This patch moves the code called on check and exception failures to exception.cpp rather than Log.cpp.
Index: kernel/include/IMP/exception.h =================================================================== --- kernel/include/IMP/exception.h (revision 573) +++ kernel/include/IMP/exception.h (working copy) @@ -134,13 +134,13 @@ {
//! This is just here so you can catch errors more easily in the debugger -/** Break on Log.cpp:19 to catch assertion failures. +/** Break on exception.cpp:31 to catch assertion failures. \ingroup assert */ IMPDLLEXPORT void assert_fail();
//! Here so you can catch check failures more easily in the debugger -/** Break on Log.cpp:22 to catch check failures. +/** Break on exception.cpp:35 to catch check failures. \ingroup assert */ IMPDLLEXPORT void check_fail(); @@ -178,12 +178,13 @@ \param[in] exception Throw the object constructed by this expression. \ingroup assert */ -#define IMP_check(expr, message, exception) \ - do { \ +#define IMP_check(expr, message, exception) \ + do { \ if (IMP::get_check_level() >= IMP::CHEAP && !(expr)) { \ - IMP_ERROR(message); \ - throw exception; \ - } \ + IMP_ERROR(message); \ + IMP::internal::check_fail(); \ + throw exception; \ + } \ } while (false)
//! A runtime failure for IMP. Index: kernel/src/exception.cpp =================================================================== --- kernel/src/exception.cpp (revision 573) +++ kernel/src/exception.cpp (working copy) @@ -27,4 +27,13 @@ return check_mode; }
+namespace internal { + void assert_fail() { + throw ErrorException(); + } + + void check_fail() { + } +} + } // namespace IMP Index: kernel/src/Log.cpp =================================================================== --- kernel/src/Log.cpp (revision 573) +++ kernel/src/Log.cpp (working copy) @@ -14,13 +14,4 @@ /* Initialize singleton pointer to NULL */ Log* Log::logpt_ = NULL;
- -namespace internal { - void assert_fail() { - throw ErrorException(); - } - - void check_fail() { - } -} } // namespace IMP
participants (1)
-
Daniel Russel