Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorMartin Hořeňovský2017-02-17 14:25:08 +0100
committerMartin Hořeňovský2017-02-17 14:25:08 +0100
commit8cd413572a5223f14c88aacd2539e2d4e2e3acc3 (patch)
tree68ffb7db6f4a33265097fbdfd31d6c9a883d3816 /include
parent90b3946e9c0d25e9f63453d558485ca5bb1fa7ac (diff)
parent30e4dbef1c2a4742a85f5d57c84107631cce9c6c (diff)
downloadcatch3-8cd413572a5223f14c88aacd2539e2d4e2e3acc3.tar.gz
Merge branch 'dev-windows-leakdetection'
Diffstat (limited to 'include')
-rw-r--r--include/internal/catch_default_main.hpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/include/internal/catch_default_main.hpp b/include/internal/catch_default_main.hpp
index 12ca9024..466efa46 100644
--- a/include/internal/catch_default_main.hpp
+++ b/include/internal/catch_default_main.hpp
@@ -10,8 +10,22 @@
#ifndef __OBJC__
+#ifdef CATCH_CONFIG_WINDOWS_CRTDBG
+#include <crtdbg.h>
+#endif
+
// Standard C/C++ main entry point
int main (int argc, char * argv[]) {
+#ifdef CATCH_CONFIG_WINDOWS_CRTDBG
+ int flag = _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG);
+ flag |= _CRTDBG_LEAK_CHECK_DF;
+ flag |= _CRTDBG_ALLOC_MEM_DF;
+ _CrtSetDbgFlag(flag);
+ _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG);
+ _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR);
+ // Change this to leaking allocation's number to break there
+ _CrtSetBreakAlloc(-1);
+#endif
int result = Catch::Session().run( argc, argv );
return ( result < 0xff ? result : 0xff );
}