cmake: rename MSVC_CRTDBG to WIN32_LEAKCHECK
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b6f23cf..05ad1ba 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -89,8 +89,8 @@ IF(WIN32)
ENDIF()
IF(MSVC)
- # Enable MSVC CRTDBG memory leak reporting when in debug mode.
- OPTION(MSVC_CRTDBG "Enable CRTDBG memory leak reporting" OFF)
+ # Enable leak checking using the debugging C runtime.
+ OPTION(WIN32_LEAKCHECK "Enable leak reporting via crtdbg" OFF)
ENDIF()
IF (DEPRECATE_HARD)
@@ -129,8 +129,8 @@ IF (MSVC)
SET(CRT_FLAG_RELEASE "/MD")
ENDIF()
- IF (MSVC_CRTDBG)
- SET(GIT_MSVC_CRTDBG 1)
+ IF (WIN32_LEAKCHECK)
+ SET(GIT_WIN32_LEAKCHECK 1)
SET(CRT_FLAG_DEBUG "${CRT_FLAG_DEBUG}")
SET(CMAKE_C_STANDARD_LIBRARIES "${CMAKE_C_STANDARD_LIBRARIES} Dbghelp.lib")
ENDIF()
diff --git a/docs/changelog.md b/docs/changelog.md
index 98bde2f..edd2c3f 100644
--- a/docs/changelog.md
+++ b/docs/changelog.md
@@ -13,6 +13,10 @@ vNext
replaces `git_reference_is_valid_name`. Tthe former functions are
deprecated.
+### Breaking CMake configuration changes
+
+The `MVSC_CRTDBG` configuration option is now `WIN32_LEAKCHECK`.
+
v1.1
----
diff --git a/src/alloc.c b/src/alloc.c
index 291511d..6efa104 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -15,7 +15,7 @@ git_allocator git__allocator;
static int setup_default_allocator(void)
{
-#if defined(GIT_MSVC_CRTDBG)
+#if defined(GIT_WIN32_LEAKCHECK)
return git_win32_leakcheck_init_allocator(&git__allocator);
#else
return git_stdalloc_init_allocator(&git__allocator);
diff --git a/src/allocators/win32_leakcheck.c b/src/allocators/win32_leakcheck.c
index 3be45ca..fe06a14 100644
--- a/src/allocators/win32_leakcheck.c
+++ b/src/allocators/win32_leakcheck.c
@@ -7,7 +7,7 @@
#include "win32_leakcheck.h"
-#if defined(GIT_MSVC_CRTDBG)
+#if defined(GIT_WIN32_LEAKCHECK)
#include "win32/w32_leakcheck.h"
diff --git a/src/features.h.in b/src/features.h.in
index e000de5..c8d0180 100644
--- a/src/features.h.in
+++ b/src/features.h.in
@@ -4,7 +4,7 @@
#cmakedefine GIT_DEBUG_POOL 1
#cmakedefine GIT_TRACE 1
#cmakedefine GIT_THREADS 1
-#cmakedefine GIT_MSVC_CRTDBG 1
+#cmakedefine GIT_WIN32_LEAKCHECK 1
#cmakedefine GIT_ARCH_64 1
#cmakedefine GIT_ARCH_32 1
diff --git a/src/win32/w32_leakcheck.c b/src/win32/w32_leakcheck.c
index 31803d5..95187a5 100644
--- a/src/win32/w32_leakcheck.c
+++ b/src/win32/w32_leakcheck.c
@@ -7,7 +7,7 @@
#include "w32_leakcheck.h"
-#if defined(GIT_MSVC_CRTDBG)
+#if defined(GIT_WIN32_LEAKCHECK)
#include "Windows.h"
#include "Dbghelp.h"
diff --git a/src/win32/w32_leakcheck.h b/src/win32/w32_leakcheck.h
index 29bce4e..7da03ab 100644
--- a/src/win32/w32_leakcheck.h
+++ b/src/win32/w32_leakcheck.h
@@ -13,7 +13,7 @@
/* Initialize the win32 leak checking system. */
int git_win32_leakcheck_global_init(void);
-#if defined(GIT_MSVC_CRTDBG)
+#if defined(GIT_WIN32_LEAKCHECK)
#include <stdlib.h>
#include <crtdbg.h>
diff --git a/tests/clar_libgit2_trace.c b/tests/clar_libgit2_trace.c
index d4d8d2c..8eb6d4e 100644
--- a/tests/clar_libgit2_trace.c
+++ b/tests/clar_libgit2_trace.c
@@ -164,7 +164,7 @@ void _cl_trace_cb__event_handler(
switch (ev) {
case CL_TRACE__SUITE_BEGIN:
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__SET_MARK,
suite_name);
@@ -172,7 +172,7 @@ void _cl_trace_cb__event_handler(
break;
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.
* This may generate false positives for things like the global
* TLS error state and maybe the odb cache since they aren't
diff --git a/tests/trace/windows/stacktrace.c b/tests/trace/windows/stacktrace.c
index 15604a5..0a77ef9 100644
--- a/tests/trace/windows/stacktrace.c
+++ b/tests/trace/windows/stacktrace.c
@@ -1,7 +1,7 @@
#include "clar_libgit2.h"
#include "win32/w32_leakcheck.h"
-#if defined(GIT_MSVC_CRTDBG)
+#if defined(GIT_WIN32_LEAKCHECK)
static void a(void)
{
char buf[10000];
@@ -26,7 +26,7 @@ static void c(void)
void test_trace_windows_stacktrace__basic(void)
{
-#if defined(GIT_MSVC_CRTDBG)
+#if defined(GIT_WIN32_LEAKCHECK)
c();
#endif
}
@@ -34,7 +34,7 @@ void test_trace_windows_stacktrace__basic(void)
void test_trace_windows_stacktrace__leaks(void)
{
-#if defined(GIT_MSVC_CRTDBG)
+#if defined(GIT_WIN32_LEAKCHECK)
void * p1;
void * p2;
void * p3;
@@ -124,7 +124,7 @@ void test_trace_windows_stacktrace__leaks(void)
#endif
}
-#if defined(GIT_MSVC_CRTDBG)
+#if defined(GIT_WIN32_LEAKCHECK)
static void aux_cb_alloc__1(unsigned int *aux_id)
{
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_
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);
c();
c();