[mlpack-git] master: Avoid generation of the backtrace.hpp entirely. (aaa17fc)
gitdub at big.cc.gt.atl.ga.us
gitdub at big.cc.gt.atl.ga.us
Wed Mar 25 16:14:43 EDT 2015
Repository : https://github.com/mlpack/mlpack
On branch : master
Link : https://github.com/mlpack/mlpack/compare/73b48dd8d3eb3ecd702a8d9cdb9501a270e1925a...aaa17fc7f5a64c2e91fdc2eeb6aec0f7829d68d4
>---------------------------------------------------------------
commit aaa17fc7f5a64c2e91fdc2eeb6aec0f7829d68d4
Author: Marcus Edel <marcus.edel at fu-berlin.de>
Date: Wed Mar 25 21:14:27 2015 +0100
Avoid generation of the backtrace.hpp entirely.
>---------------------------------------------------------------
aaa17fc7f5a64c2e91fdc2eeb6aec0f7829d68d4
CMake/backtrace.h.in | 15 ---------------
CMakeLists.txt | 6 ++----
src/mlpack/core/util/backtrace.hpp | 12 ------------
src/mlpack/core/util/log.cpp | 9 ++++++---
src/mlpack/tests/log_test.cpp | 2 --
5 files changed, 8 insertions(+), 36 deletions(-)
diff --git a/CMake/backtrace.h.in b/CMake/backtrace.h.in
deleted file mode 100644
index a83883a..0000000
--- a/CMake/backtrace.h.in
+++ /dev/null
@@ -1,15 +0,0 @@
-/**
- * @file backtrace.hpp
- *
- * Configuration file that includes backtrace headers (if they exist on this
- * system), auto-generated by CMake.
- */
-#ifndef __MLPACK_CORE_UTIL_BACKTRACE_HPP
-#define __MLPACK_CORE_UTIL_BACKTRACE_HPP
-
-#cmakedefine01 Backtrace_FOUND
-#if Backtrace_FOUND
- #include <@Backtrace_HEADER@>
-#endif
-
-#endif
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1a51fbf..681c06e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -65,12 +65,10 @@ endif(CMAKE_COMPILER_IS_GNUCC AND PROFILE)
find_package(Backtrace)
if(Backtrace_FOUND)
include_directories(${Backtrace_INCLUDE_DIRS})
+ add_definitions(-DBACKTRACE_FOUND)
+ add_definitions(-DBACKTRACE_HEADER="${Backtrace_HEADER}")
endif(Backtrace_FOUND)
-# Generate the backtrace header file.
-configure_file(${CMAKE_MODULE_PATH}/backtrace.h.in
- ${CMAKE_SOURCE_DIR}/src/mlpack/core/util/backtrace.hpp)
-
# If the user asked for running test cases with verbose output, turn that on.
if(TEST_VERBOSE)
add_definitions(-DTEST_VERBOSE)
diff --git a/src/mlpack/core/util/backtrace.hpp b/src/mlpack/core/util/backtrace.hpp
deleted file mode 100644
index 0601e02..0000000
--- a/src/mlpack/core/util/backtrace.hpp
+++ /dev/null
@@ -1,12 +0,0 @@
-/**
- * @file backtrace.hpp
- *
- * Default configuration file to include backtrace() functionality. Here we
- * assume it is not available.
- */
-#ifndef __MLPACK_CORE_UTIL_BACKTRACE_HPP
-#define __MLPACK_CORE_UTIL_BACKTRACE_HPP
-
-#define Backtrace_FOUND 0
-
-#endif
diff --git a/src/mlpack/core/util/log.cpp b/src/mlpack/core/util/log.cpp
index 6d95d3a..c532a55 100644
--- a/src/mlpack/core/util/log.cpp
+++ b/src/mlpack/core/util/log.cpp
@@ -10,7 +10,10 @@
#endif
#include "log.hpp"
-#include "backtrace.hpp"
+
+#ifdef BACKTRACE_FOUND
+ #include BACKTRACE_HEADER
+#endif
// Color code escape sequences -- but not on Windows.
#ifndef _WIN32
@@ -53,7 +56,7 @@ void Log::Assert(bool condition, const std::string& message)
{
if (!condition)
{
-#if Backtrace_FOUND
+#ifdef BACKTRACE_FOUND
void* array[25];
size_t size = backtrace(array, sizeof(array) / sizeof(void*));
char** messages = backtrace_symbols(array, size);
@@ -118,7 +121,7 @@ void Log::Assert(bool condition, const std::string& message)
#endif
Log::Debug << message << std::endl;
-#if Backtrace_FOUND
+#ifdef BACKTRACE_FOUND
free(messages);
#endif
diff --git a/src/mlpack/tests/log_test.cpp b/src/mlpack/tests/log_test.cpp
index 5251684..09a56c2 100644
--- a/src/mlpack/tests/log_test.cpp
+++ b/src/mlpack/tests/log_test.cpp
@@ -10,8 +10,6 @@
#include <boost/test/unit_test.hpp>
#include "old_boost_test_definitions.hpp"
-#include <mlpack/core/util/backtrace.hpp>
-
using namespace mlpack;
BOOST_AUTO_TEST_SUITE(LogTest);
More information about the mlpack-git
mailing list