66#if !defined (DEVELOPMENT) && !defined (RELEASE)
69 #elif defined (NDEBUG)
72 #error DEVELOPMENT, RELEASE, _DEBUG, or NDEBUG must be defined!
82#if DEVELOPMENT && defined(_MSC_VER)
83#pragma warning(disable : 4291)
84#pragma warning(disable : 4985)
96#define SMTG_ASSERT(f) \
98 FDebugBreak ("%s(%d) : Assert failed: %s\n", __FILE__, __LINE__, #f);
100#define SMTG_ASSERT_MSG(f, msg) \
102 FDebugBreak ("%s(%d) : Assert failed: [%s] [%s]\n", __FILE__, __LINE__, #f, msg);
105#define SMTG_WARNING(comment) FDebugPrint ("%s(%d) : %s\n", __FILE__, __LINE__, comment);
108#define SMTG_PRINTSYSERROR FPrintLastError (__FILE__, __LINE__);
112#define SMTG_DEBUGSTR(s) FDebugBreak (s);
117#define SMTG_VERIFY(f) SMTG_ASSERT (f)
122#define SMTG_VERIFY_IS(f, r) \
124 FDebugBreak ("%s(%d) : Assert failed: %s\n", __FILE__, __LINE__, #f);
129#define SMTG_VERIFY_NOT(f, r) \
131 FDebugBreak ("%s(%d) : Assert failed: %s\n", __FILE__, __LINE__, #f);
138#define SMTG_DBPRT0(a) FDebugPrint (a);
139#define SMTG_DBPRT1(a, b) FDebugPrint (a, b);
140#define SMTG_DBPRT2(a, b, c) FDebugPrint (a, b, c);
141#define SMTG_DBPRT3(a, b, c, d) FDebugPrint (a, b, c, d);
142#define SMTG_DBPRT4(a, b, c, d, e) FDebugPrint (a, b, c, d, e);
143#define SMTG_DBPRT5(a, b, c, d, e, f) FDebugPrint (a, b, c, d, e, f);
152void FDebugPrint (
const char* format, ...);
153void FDebugBreak (
const char* format, ...);
154void FPrintLastError (
const char* file,
int line);
162using AssertionHandler =
bool (*) (
const char* message);
163extern AssertionHandler gAssertionHandler;
164extern AssertionHandler gPreAssertionHook;
165using DebugPrintLogger = void (*) (
const char* message);
166extern DebugPrintLogger gDebugPrintLogger;
175void operator delete (
void* p,
int,
const char* file,
int line);
176void operator delete[] (
void* p,
int,
const char* file,
int line);
178#define NEW new (1, __FILE__, __LINE__)
179#define NEWVEC new (1, __FILE__, __LINE__)
182#define DEBUG_NEW DEBUG_NEW_LEAKS
184#elif SMTG_OS_WINDOWS && defined(_MSC_VER)
187#define NEW new (1, __FILE__, __LINE__)
188#define NEWVEC new (1, __FILE__, __LINE__)
200#define SMTG_ASSERT(f)
201#define SMTG_ASSERT_MSG(f, msg)
202#define SMTG_WARNING(s)
203#define SMTG_PRINTSYSERROR
204#define SMTG_DEBUGSTR(s)
205#define SMTG_VERIFY(f) f;
206#define SMTG_VERIFY_IS(f, r) f;
207#define SMTG_VERIFY_NOT(f, r) f;
209#define SMTG_DBPRT0(a)
210#define SMTG_DBPRT1(a, b)
211#define SMTG_DBPRT2(a, b, c)
212#define SMTG_DBPRT3(a, b, c, d)
213#define SMTG_DBPRT4(a, b, c, d, e)
214#define SMTG_DBPRT5(a, b, c, d, e, f)
224bool isSmtgUnitTesting ();
225void setSmtgUnitTesting ();
227#if !SMTG_RENAME_ASSERT
232#define ASSERT SMTG_ASSERT
233#define WARNING SMTG_WARNING
234#define DEBUGSTR SMTG_DEBUGSTR
235#define VERIFY SMTG_VERIFY
236#define VERIFY_IS SMTG_VERIFY_IS
237#define VERIFY_NOT SMTG_VERIFY_NOT
238#define PRINTSYSERROR SMTG_PRINTSYSERROR
240#define DBPRT0 SMTG_DBPRT0
241#define DBPRT1 SMTG_DBPRT1
242#define DBPRT2 SMTG_DBPRT2
243#define DBPRT3 SMTG_DBPRT3
244#define DBPRT4 SMTG_DBPRT4
245#define DBPRT5 SMTG_DBPRT5
bool AmIBeingDebugged()
Returns true if a debugger is attached.