Revert "Create FailWithMessage/AssertWithMessage"
This reverts commit fbe0e0b658.
This commit is contained in:
+4
-12
@@ -100,20 +100,12 @@ public:
|
||||
virtual int GetFileSize() const = 0;
|
||||
virtual int GetFD() { return -1; }
|
||||
virtual RString GetDisplayPath() const { return RString(); }
|
||||
virtual RageFileBasic* Copy() const
|
||||
{
|
||||
FAIL_M("Copying unimplemented");
|
||||
return nullptr; // Return a default value - the return value is unused
|
||||
}
|
||||
virtual RageFileBasic *Copy() const { FAIL_M( "Copying unimplemented" ); }
|
||||
|
||||
protected:
|
||||
virtual int SeekInternal(int /* iOffset */)
|
||||
{
|
||||
FAIL_M("Seeking unimplemented");
|
||||
return -1; // Return a default value - the return value is unused
|
||||
}
|
||||
virtual int ReadInternal(void* pBuffer, size_t iBytes) = 0;
|
||||
virtual int WriteInternal(const void* pBuffer, size_t iBytes) = 0;
|
||||
virtual int SeekInternal( int /* iOffset */ ) { FAIL_M( "Seeking unimplemented" ); }
|
||||
virtual int ReadInternal( void *pBuffer, size_t iBytes ) = 0;
|
||||
virtual int WriteInternal( const void *pBuffer, size_t iBytes ) = 0;
|
||||
virtual int FlushInternal() { return 0; }
|
||||
|
||||
void EnableReadBuffering();
|
||||
|
||||
@@ -25,19 +25,6 @@
|
||||
#include "archutils/Unix/CrashHandler.h"
|
||||
#endif
|
||||
|
||||
void FailWithMessage(const char* message)
|
||||
{
|
||||
CHECKPOINT_M(message);
|
||||
sm_crash(message);
|
||||
}
|
||||
|
||||
void AssertWithMessage(bool condition, const char* message)
|
||||
{
|
||||
if (unlikely(!condition)) {
|
||||
FailWithMessage(message);
|
||||
}
|
||||
}
|
||||
|
||||
void sm_crash( const char *reason )
|
||||
{
|
||||
#if ( defined(_WIN32) && defined(CRASH_HANDLER) ) || defined(MACOSX) || defined(_XDBG)
|
||||
|
||||
+4
-10
@@ -66,19 +66,13 @@ void sm_crash( const char *reason = "Internal error" );
|
||||
*
|
||||
* This should probably be used instead of throwing an exception in most
|
||||
* cases we expect never to happen (but not in cases that we do expect,
|
||||
* such as DSound init failure.)
|
||||
*
|
||||
* There are macros here for legacy compatibility so we don't have
|
||||
* to change or fix hundreds of calls to FAIL_M / ASSERT_M / ASSERT.
|
||||
*/
|
||||
void FailWithMessage(const char* message);
|
||||
#define FAIL_M(MESSAGE) FailWithMessage(MESSAGE)
|
||||
* such as DSound init failure.) */
|
||||
#define FAIL_M(MESSAGE) do { CHECKPOINT_M(MESSAGE); sm_crash(MESSAGE); } while(0)
|
||||
#define ASSERT_M(COND, MESSAGE) do { if(unlikely(!(COND))) { FAIL_M(MESSAGE); } } while(0)
|
||||
|
||||
void AssertWithMessage(bool condition, const char* message);
|
||||
#define ASSERT_M(COND, MESSAGE) AssertWithMessage((COND), MESSAGE)
|
||||
|
||||
#if !defined(CO_EXIST_WITH_MFC)
|
||||
#define ASSERT(COND) AssertWithMessage((COND), "Assertion '" #COND "' failed")
|
||||
#define ASSERT(COND) ASSERT_M((COND), "Assertion '" #COND "' failed")
|
||||
#endif
|
||||
|
||||
/** @brief Use this to catch switching on invalid values */
|
||||
|
||||
Reference in New Issue
Block a user