aboutsummaryrefslogtreecommitdiff
path: root/sp/src/public/tier0/dbgflag.h
diff options
context:
space:
mode:
authorJoe Ludwig <[email protected]>2013-06-26 15:22:04 -0700
committerJoe Ludwig <[email protected]>2013-06-26 15:22:04 -0700
commit39ed87570bdb2f86969d4be821c94b722dc71179 (patch)
treeabc53757f75f40c80278e87650ea92808274aa59 /sp/src/public/tier0/dbgflag.h
downloadsource-sdk-2013-39ed87570bdb2f86969d4be821c94b722dc71179.tar.xz
source-sdk-2013-39ed87570bdb2f86969d4be821c94b722dc71179.zip
First version of the SOurce SDK 2013
Diffstat (limited to 'sp/src/public/tier0/dbgflag.h')
-rw-r--r--sp/src/public/tier0/dbgflag.h65
1 files changed, 65 insertions, 0 deletions
diff --git a/sp/src/public/tier0/dbgflag.h b/sp/src/public/tier0/dbgflag.h
new file mode 100644
index 00000000..5d9b2bb7
--- /dev/null
+++ b/sp/src/public/tier0/dbgflag.h
@@ -0,0 +1,65 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose: This file sets all of our debugging flags. It should be
+// called before all other header files.
+//
+// $NoKeywords: $
+//=============================================================================//
+
+#ifndef DBGFLAG_H
+#define DBGFLAG_H
+#ifdef _WIN32
+#pragma once
+#endif
+
+
+// Here are all the flags we support:
+// DBGFLAG_MEMORY: Enables our memory debugging system, which overrides malloc & free
+// DBGFLAG_MEMORY_NEWDEL: Enables new / delete tracking for memory debug system. Requires DBGFLAG_MEMORY to be enabled.
+// DBGFLAG_VALIDATE: Enables our recursive validation system for checking integrity and memory leaks
+// DBGFLAG_ASSERT: Turns Assert on or off (when off, it isn't compiled at all)
+// DBGFLAG_ASSERTFATAL: Turns AssertFatal on or off (when off, it isn't compiled at all)
+// DBGFLAG_ASSERTDLG: Turns assert dialogs on or off and debug breaks on or off when not under the debugger.
+// (Dialogs will always be on when process is being debugged.)
+// DBGFLAG_STRINGS: Turns on hardcore string validation (slow but safe)
+
+#undef DBGFLAG_MEMORY
+#undef DBGFLAG_MEMORY_NEWDEL
+#undef DBGFLAG_VALIDATE
+#undef DBGFLAG_ASSERT
+#undef DBGFLAG_ASSERTFATAL
+#undef DBGFLAG_ASSERTDLG
+#undef DBGFLAG_STRINGS
+
+//-----------------------------------------------------------------------------
+// Default flags for debug builds
+//-----------------------------------------------------------------------------
+#if (defined( _DEBUG ) || defined( RELEASEASSERTS ) )
+
+#define DBGFLAG_MEMORY
+#ifdef _SERVER // only enable new & delete tracking for server; on client it conflicts with CRT mem leak tracking
+#define DBGFLAG_MEMORY_NEWDEL
+#endif
+#ifdef STEAM
+#define DBGFLAG_VALIDATE
+#endif
+#define DBGFLAG_ASSERT
+#define DBGFLAG_ASSERTFATAL
+#define DBGFLAG_ASSERTDLG
+#define DBGFLAG_STRINGS
+
+
+//-----------------------------------------------------------------------------
+// Default flags for release builds
+//-----------------------------------------------------------------------------
+#else // _DEBUG
+
+#ifdef STEAM
+#define DBGFLAG_ASSERT
+#endif
+#define DBGFLAG_ASSERTFATAL // note: fatal asserts are enabled in release builds
+#define DBGFLAG_ASSERTDLG
+
+#endif // _DEBUG
+
+#endif // DBGFLAG_H