From e9a4f6a805c25334e2014869f262ee946f698bbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= Date: Mon, 1 Jan 2018 21:33:40 +0100 Subject: Just small move of code in qtmipsexception.h --- qtmips_machine/qtmipsexception.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'qtmips_machine/qtmipsexception.h') diff --git a/qtmips_machine/qtmipsexception.h b/qtmips_machine/qtmipsexception.h index db8cf5e..41caa87 100644 --- a/qtmips_machine/qtmipsexception.h +++ b/qtmips_machine/qtmipsexception.h @@ -6,8 +6,6 @@ namespace machine { -#define QTMIPS_EXCEPTION(TYPE, REASON, EXT) (machine::QtMipsException##TYPE (QString(REASON), QString(EXT), QString(__FILE__), __LINE__)) - // Base exception for all machine ones class QtMipsException : public std::exception { public: @@ -67,6 +65,11 @@ protected: QTMIPS_EXCEPTIONS #undef EXCEPTION + +// This is helper macro for throwing QtMips exceptions +#define QTMIPS_EXCEPTION(TYPE, REASON, EXT) (machine::QtMipsException##TYPE (QString(REASON), QString(EXT), QString(__FILE__), __LINE__)) + +// Sanity comparison potentially throwing QtMipsExceptionSanity #define SANITY_ASSERT(COND, MSG) do { if (!(COND)) throw QTMIPS_EXCEPTION(Sanity, "Sanity check failed (" #COND ")", MSG); } while (false) } -- cgit v1.2.3