Commit 8aed4629 by Edward Thomson

cmake: rename MSVC_CRTDBG to WIN32_LEAKCHECK

parent 51825c4f
...@@ -89,8 +89,8 @@ IF(WIN32) ...@@ -89,8 +89,8 @@ IF(WIN32)
ENDIF() ENDIF()
IF(MSVC) IF(MSVC)
# Enable MSVC CRTDBG memory leak reporting when in debug mode. # Enable leak checking using the debugging C runtime.
OPTION(MSVC_CRTDBG "Enable CRTDBG memory leak reporting" OFF) OPTION(WIN32_LEAKCHECK "Enable leak reporting via crtdbg" OFF)
ENDIF() ENDIF()
IF (DEPRECATE_HARD) IF (DEPRECATE_HARD)
...@@ -129,8 +129,8 @@ IF (MSVC) ...@@ -129,8 +129,8 @@ IF (MSVC)
SET(CRT_FLAG_RELEASE "/MD") SET(CRT_FLAG_RELEASE "/MD")
ENDIF() ENDIF()
IF (MSVC_CRTDBG) IF (WIN32_LEAKCHECK)
SET(GIT_MSVC_CRTDBG 1) SET(GIT_WIN32_LEAKCHECK 1)
SET(CRT_FLAG_DEBUG "${CRT_FLAG_DEBUG}") SET(CRT_FLAG_DEBUG "${CRT_FLAG_DEBUG}")
SET(CMAKE_C_STANDARD_LIBRARIES "${CMAKE_C_STANDARD_LIBRARIES} Dbghelp.lib") SET(CMAKE_C_STANDARD_LIBRARIES "${CMAKE_C_STANDARD_LIBRARIES} Dbghelp.lib")
ENDIF() ENDIF()
......
...@@ -13,6 +13,10 @@ vNext ...@@ -13,6 +13,10 @@ vNext
replaces `git_reference_is_valid_name`. Tthe former functions are replaces `git_reference_is_valid_name`. Tthe former functions are
deprecated. deprecated.
### Breaking CMake configuration changes
The `MVSC_CRTDBG` configuration option is now `WIN32_LEAKCHECK`.
v1.1 v1.1
---- ----
......
...@@ -15,7 +15,7 @@ git_allocator git__allocator; ...@@ -15,7 +15,7 @@ git_allocator git__allocator;
static int setup_default_allocator(void) static int setup_default_allocator(void)
{ {
#if defined(GIT_MSVC_CRTDBG) #if defined(GIT_WIN32_LEAKCHECK)
return git_win32_leakcheck_init_allocator(&git__allocator); return git_win32_leakcheck_init_allocator(&git__allocator);
#else #else
return git_stdalloc_init_allocator(&git__allocator); return git_stdalloc_init_allocator(&git__allocator);
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
#include "win32_leakcheck.h" #include "win32_leakcheck.h"
#if defined(GIT_MSVC_CRTDBG) #if defined(GIT_WIN32_LEAKCHECK)
#include "win32/w32_leakcheck.h" #include "win32/w32_leakcheck.h"
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
#cmakedefine GIT_DEBUG_POOL 1 #cmakedefine GIT_DEBUG_POOL 1
#cmakedefine GIT_TRACE 1 #cmakedefine GIT_TRACE 1
#cmakedefine GIT_THREADS 1 #cmakedefine GIT_THREADS 1
#cmakedefine GIT_MSVC_CRTDBG 1 #cmakedefine GIT_WIN32_LEAKCHECK 1
#cmakedefine GIT_ARCH_64 1 #cmakedefine GIT_ARCH_64 1
#cmakedefine GIT_ARCH_32 1 #cmakedefine GIT_ARCH_32 1
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
#include "w32_leakcheck.h" #include "w32_leakcheck.h"
#if defined(GIT_MSVC_CRTDBG) #if defined(GIT_WIN32_LEAKCHECK)
#include "Windows.h" #include "Windows.h"
#include "Dbghelp.h" #include "Dbghelp.h"
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
/* Initialize the win32 leak checking system. */ /* Initialize the win32 leak checking system. */
int git_win32_leakcheck_global_init(void); int git_win32_leakcheck_global_init(void);
#if defined(GIT_MSVC_CRTDBG) #if defined(GIT_WIN32_LEAKCHECK)
#include <stdlib.h> #include <stdlib.h>
#include <crtdbg.h> #include <crtdbg.h>
......
...@@ -164,7 +164,7 @@ void _cl_trace_cb__event_handler( ...@@ -164,7 +164,7 @@ void _cl_trace_cb__event_handler(
switch (ev) { switch (ev) {
case CL_TRACE__SUITE_BEGIN: case CL_TRACE__SUITE_BEGIN:
git_trace(GIT_TRACE_TRACE, "\n\n%s\n%s: Begin Suite", HR, suite_name); git_trace(GIT_TRACE_TRACE, "\n\n%s\n%s: Begin Suite", HR, suite_name);
#if 0 && defined(GIT_MSVC_CRTDBG) #if 0 && defined(GIT_WIN32_LEAKCHECK)
git_win32__crtdbg_stacktrace__dump( git_win32__crtdbg_stacktrace__dump(
GIT_WIN32__CRTDBG_STACKTRACE__SET_MARK, GIT_WIN32__CRTDBG_STACKTRACE__SET_MARK,
suite_name); suite_name);
...@@ -172,7 +172,7 @@ void _cl_trace_cb__event_handler( ...@@ -172,7 +172,7 @@ void _cl_trace_cb__event_handler(
break; break;
case CL_TRACE__SUITE_END: case CL_TRACE__SUITE_END:
#if 0 && defined(GIT_MSVC_CRTDBG) #if 0 && defined(GIT_WIN32_LEAKCHECK)
/* As an example of checkpointing, dump leaks within this suite. /* As an example of checkpointing, dump leaks within this suite.
* This may generate false positives for things like the global * This may generate false positives for things like the global
* TLS error state and maybe the odb cache since they aren't * TLS error state and maybe the odb cache since they aren't
......
#include "clar_libgit2.h" #include "clar_libgit2.h"
#include "win32/w32_leakcheck.h" #include "win32/w32_leakcheck.h"
#if defined(GIT_MSVC_CRTDBG) #if defined(GIT_WIN32_LEAKCHECK)
static void a(void) static void a(void)
{ {
char buf[10000]; char buf[10000];
...@@ -26,7 +26,7 @@ static void c(void) ...@@ -26,7 +26,7 @@ static void c(void)
void test_trace_windows_stacktrace__basic(void) void test_trace_windows_stacktrace__basic(void)
{ {
#if defined(GIT_MSVC_CRTDBG) #if defined(GIT_WIN32_LEAKCHECK)
c(); c();
#endif #endif
} }
...@@ -34,7 +34,7 @@ void test_trace_windows_stacktrace__basic(void) ...@@ -34,7 +34,7 @@ void test_trace_windows_stacktrace__basic(void)
void test_trace_windows_stacktrace__leaks(void) void test_trace_windows_stacktrace__leaks(void)
{ {
#if defined(GIT_MSVC_CRTDBG) #if defined(GIT_WIN32_LEAKCHECK)
void * p1; void * p1;
void * p2; void * p2;
void * p3; void * p3;
...@@ -124,7 +124,7 @@ void test_trace_windows_stacktrace__leaks(void) ...@@ -124,7 +124,7 @@ void test_trace_windows_stacktrace__leaks(void)
#endif #endif
} }
#if defined(GIT_MSVC_CRTDBG) #if defined(GIT_WIN32_LEAKCHECK)
static void aux_cb_alloc__1(unsigned int *aux_id) static void aux_cb_alloc__1(unsigned int *aux_id)
{ {
static unsigned int aux_counter = 0; static unsigned int aux_counter = 0;
...@@ -141,7 +141,7 @@ static void aux_cb_lookup__1(unsigned int aux_id, char *aux_msg, size_t aux_msg_ ...@@ -141,7 +141,7 @@ static void aux_cb_lookup__1(unsigned int aux_id, char *aux_msg, size_t aux_msg_
void test_trace_windows_stacktrace__aux1(void) void test_trace_windows_stacktrace__aux1(void)
{ {
#if defined(GIT_MSVC_CRTDBG) #if defined(GIT_WIN32_LEAKCHECK)
git_win32_leakcheck_stack_set_aux_cb(aux_cb_alloc__1, aux_cb_lookup__1); git_win32_leakcheck_stack_set_aux_cb(aux_cb_alloc__1, aux_cb_lookup__1);
c(); c();
c(); c();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment