trace: always enabled There's no need to make tracing opt-in; it should always be included.
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
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 229ba96..cab0cb2 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -41,7 +41,6 @@ OPTION(THREADSAFE "Build libgit2 as threadsafe" ON)
OPTION(BUILD_TESTS "Build Tests using the Clar suite" ON)
OPTION(BUILD_EXAMPLES "Build library usage example apps" OFF)
OPTION(BUILD_FUZZERS "Build the fuzz targets" OFF)
-OPTION(ENABLE_TRACE "Enables tracing support" ON)
OPTION(LIBGIT2_FILENAME "Name of the produced binary" OFF)
OPTION(USE_SSH "Link with libssh2 to enable SSH support" ON)
OPTION(USE_HTTPS "Enable HTTPS support. Can be set to a specific backend" ON)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index fdb3673..b3d620c 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -37,12 +37,6 @@ SET(LIBGIT2_LIBS "")
enable_warnings(missing-declarations)
-# Enable tracing
-IF(ENABLE_TRACE)
- SET(GIT_TRACE 1)
-ENDIF()
-ADD_FEATURE_INFO(tracing GIT_TRACE "tracing support")
-
IF (HAVE_FUTIMENS)
SET(GIT_USE_FUTIMENS 1)
ENDIF ()
diff --git a/src/features.h.in b/src/features.h.in
index 202cef4..a40b608 100644
--- a/src/features.h.in
+++ b/src/features.h.in
@@ -5,7 +5,6 @@
#cmakedefine GIT_DEBUG_STRICT_ALLOC 1
#cmakedefine GIT_DEBUG_STRICT_OPEN 1
-#cmakedefine GIT_TRACE 1
#cmakedefine GIT_THREADS 1
#cmakedefine GIT_WIN32_LEAKCHECK 1
diff --git a/src/trace.c b/src/trace.c
index c316bca..b0c56c4 100644
--- a/src/trace.c
+++ b/src/trace.c
@@ -11,15 +11,10 @@
#include "runtime.h"
#include "git2/trace.h"
-#ifdef GIT_TRACE
-
struct git_trace_data git_trace__data = {0};
-#endif
-
int git_trace_set(git_trace_level_t level, git_trace_cb callback)
{
-#ifdef GIT_TRACE
GIT_ASSERT_ARG(level == 0 || callback != NULL);
git_trace__data.level = level;
@@ -27,12 +22,4 @@ int git_trace_set(git_trace_level_t level, git_trace_cb callback)
GIT_MEMORY_BARRIER;
return 0;
-#else
- GIT_UNUSED(level);
- GIT_UNUSED(callback);
-
- git_error_set(GIT_ERROR_INVALID,
- "this version of libgit2 was not built with tracing.");
- return -1;
-#endif
}
diff --git a/src/trace.h b/src/trace.h
index eb20ec5..239928d 100644
--- a/src/trace.h
+++ b/src/trace.h
@@ -12,8 +12,6 @@
#include <git2/trace.h>
#include "str.h"
-#ifdef GIT_TRACE
-
struct git_trace_data {
git_trace_level_t level;
git_trace_cb callback;
@@ -50,19 +48,4 @@ GIT_INLINE(void) git_trace(git_trace_level_t level, const char *fmt, ...)
}
}
-#else
-
-GIT_INLINE(void) git_trace__null(
- git_trace_level_t level,
- const char *fmt, ...)
-{
- GIT_UNUSED(level);
- GIT_UNUSED(fmt);
-}
-
-#define git_trace_level() ((git_trace_level_t)0)
-#define git_trace git_trace__null
-
-#endif
-
#endif