From 29406b799db80521d33a93d5a58c05f2974821d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20St=C3=B6neberg?= Date: Fri, 20 Mar 2015 14:10:24 +0100 Subject: [PATCH] Revert "there is no way something called assert_always should ever be compiled out - people should be able to depend on side effects of something with 'always' in the name" This reverts commit 5ffe5ce5513a51e7be74a0af90556bc2fa1aab5a. --- src/emu/emucore.h | 67 ++++++++++++++++++++++++----------------------- 1 file changed, 34 insertions(+), 33 deletions(-) diff --git a/src/emu/emucore.h b/src/emu/emucore.h index 0f89ae59f50..238c0d284bd 100644 --- a/src/emu/emucore.h +++ b/src/emu/emucore.h @@ -32,44 +32,18 @@ #include #include -// needed for OSD macros -#include "osdcomm.h" - - - -//************************************************************************** -// EXCEPTION CLASSES -//************************************************************************** - -// emu_exception is the base class for all emu-related exceptions -class emu_exception : public std::exception { }; - - -// emu_fatalerror is a generic fatal exception that provides an error string -class emu_fatalerror : public emu_exception -{ -public: - emu_fatalerror(const char *format, ...) ATTR_PRINTF(2,3); - emu_fatalerror(const char *format, va_list ap); - emu_fatalerror(int _exitcode, const char *format, ...) ATTR_PRINTF(3,4); - emu_fatalerror(int _exitcode, const char *format, va_list ap); - - const char *string() const { return text; } - int exitcode() const { return code; } - -private: - char text[1024]; - int code; -}; - +// TODO: make the assert replacement and especially assert_always work again +#include +#define assert_always(x, msg) assert(x) +/* // standard assertion macros #undef assert #undef assert_always #if defined(MAME_DEBUG_FAST) #define assert(x) do { } while (0) -#define assert_always(x, msg) do { if (!(x)) throw emu_fatalerror("Fatal error: %s\nCaused by assert: %s:%d: %s", msg, __FILE__, __LINE__, #x); } while (0) +#define assert_always(x, msg) do { } while (0) #elif defined(MAME_DEBUG) #define assert(x) do { if (!(x)) throw emu_fatalerror("assert: %s:%d: %s", __FILE__, __LINE__, #x); } while (0) #define assert_always(x, msg) do { if (!(x)) throw emu_fatalerror("Fatal error: %s\nCaused by assert: %s:%d: %s", msg, __FILE__, __LINE__, #x); } while (0) @@ -77,10 +51,10 @@ private: #define assert(x) do { } while (0) #define assert_always(x, msg) do { if (!(x)) throw emu_fatalerror("Fatal error: %s (%s:%d)", msg, __FILE__, __LINE__); } while (0) #endif - - +*/ // core system includes +#include "osdcomm.h" #include "astring.h" #include "emualloc.h" #include "corestr.h" @@ -310,6 +284,33 @@ inline void operator--(_Type &value, int) { value = (_Type)((int)value - 1); } +//************************************************************************** +// EXCEPTION CLASSES +//************************************************************************** + +// emu_exception is the base class for all emu-related exceptions +class emu_exception : public std::exception { }; + + +// emu_fatalerror is a generic fatal exception that provides an error string +class emu_fatalerror : public emu_exception +{ +public: + emu_fatalerror(const char *format, ...) ATTR_PRINTF(2,3); + emu_fatalerror(const char *format, va_list ap); + emu_fatalerror(int _exitcode, const char *format, ...) ATTR_PRINTF(3,4); + emu_fatalerror(int _exitcode, const char *format, va_list ap); + + const char *string() const { return text; } + int exitcode() const { return code; } + +private: + char text[1024]; + int code; +}; + + + //************************************************************************** // CASTING TEMPLATES //**************************************************************************