Browse Source

Debugging macros

Source commit: 38befd1dd5e4b8495468131d8dcd8107b6d365f5
Martin Prikryl 1 year ago
parent
commit
35d27659a2
2 changed files with 8 additions and 4 deletions
  1. 2 1
      source/core/CoreMain.h
  2. 6 3
      source/core/Global.h

+ 2 - 1
source/core/CoreMain.h

@@ -9,7 +9,8 @@ extern TConfiguration *Configuration;
 extern TStoredSessionList *StoredSessions;
 extern bool AnySession;
 extern TApplicationLog * ApplicationLog;
-#define AppLog(S) if (ApplicationLog->Logging) ApplicationLog->Log(S)
+#define APPLOG_INTERNAL(S) if (ApplicationLog->Logging) ApplicationLog->Log(S)
+#define AppLog(S) APPLOG_INTERNAL(S)
 #define AppLogFmt(S, F) AppLog(FORMAT(S, F))
 //---------------------------------------------------------------------------
 void CoreInitialize();

+ 6 - 3
source/core/Global.h

@@ -38,16 +38,19 @@ private:
 //---------------------------------------------------------------------------
 #include <assert.h>
 #define ACCESS_VIOLATION_TEST { (*((int*)NULL)) = 0; }
-#if !defined(_DEBUG) || defined(DESIGN_ONLY)
+#if defined(_DEBUG) && !defined(DESIGN_ONLY)
+#define DODEBUGGING
+#endif
+#ifndef DODEBUGGING
 #define DebugAssert(p)   ((void)0)
 #define DebugCheck(p) (p)
 #define DebugFail()
-#else // if !defined(_DEBUG) || defined(DESIGN_ONLY)
+#else // ifndef DODEBUGGING
 void __fastcall DoAssert(wchar_t * Message, wchar_t * Filename, int LineNumber);
 #define DebugAssert(p) ((p) ? (void)0 : DoAssert(TEXT(#p), TEXT(__FILE__), __LINE__))
 #define DebugCheck(p) { bool __CHECK_RESULT__ = (p); DebugAssert(__CHECK_RESULT__); }
 #define DebugFail() DebugAssert(false)
-#endif // if !defined(_DEBUG) || defined(DESIGN_ONLY)
+#endif // ifndef DODEBUGGING
 //---------------------------------------------------------------------------
 #define DebugAlwaysTrue(p) (p)
 #define DebugAlwaysFalse(p) (p)