Now header-only by default, fixes for tests and builds, better backend auto-detection

This commit is contained in:
Antony Polukhin
2016-09-13 00:13:02 +03:00
parent b1f41947d6
commit 326d931bb0
10 changed files with 87 additions and 40 deletions

View File

@@ -17,12 +17,22 @@
#include <string>
/// @cond
#if defined(BOOST_STACKTRACE_HEADER_ONLY)
# define BOOST_STACKTRACE_FUNCTION inline
#elif defined(BOOST_STACKTRACE_INTERNAL_BUILD_LIBS)
# define BOOST_STACKTRACE_FUNCTION BOOST_SYMBOL_EXPORT
#if !defined(BOOST_STACKTRACE_LINK) && defined(BOOST_STACKTRACE_DYN_LINK)
# define BOOST_STACKTRACE_LINK
#endif
#ifdef BOOST_STACKTRACE_LINK
# if defined(BOOST_STACKTRACE_DYN_LINK) || defined(BOOST_ALL_DYN_LINK)
# ifdef BOOST_STACKTRACE_INTERNAL_BUILD_LIBS
# define BOOST_STACKTRACE_FUNCTION BOOST_SYMBOL_EXPORT
# else
# define BOOST_STACKTRACE_FUNCTION BOOST_SYMBOL_IMPORT
# endif
# else
# define BOOST_STACKTRACE_FUNCTION
# endif
#else
# define BOOST_STACKTRACE_FUNCTION BOOST_SYMBOL_IMPORT
# define BOOST_STACKTRACE_FUNCTION inline
#endif
/// @endcond
@@ -90,7 +100,7 @@ std::basic_ostream<CharT, TraitsT>& operator<<(std::basic_ostream<CharT, TraitsT
/// @cond
#undef BOOST_STACKTRACE_FUNCTION
#if defined(BOOST_STACKTRACE_HEADER_ONLY)
#ifndef BOOST_STACKTRACE_LINK
# include <boost/stacktrace/detail/stacktrace.ipp>
#endif
/// @endcond

View File

@@ -15,24 +15,45 @@
#include <boost/stacktrace.hpp>
#include <boost/static_assert.hpp>
#if defined(BOOST_STACKTRACE_USE_NOOP)
// Autodetection
#if !defined(BOOST_STACKTRACE_USE_NOOP) && !defined(BOOST_STACKTRACE_USE_WINDBG) && !defined(BOOST_STACKTRACE_USE_LIBUNWIND) \
&& !defined(BOOST_STACKTRACE_USE_BACKTRACE) &&!defined(BOOST_STACKTRACE_USE_HEADER)
#if defined(__has_include) && (!defined(__GNUC__) || __GNUC__ > 4 || BOOST_CLANG)
# if __has_include(<libunwind.h>)
# define BOOST_STACKTRACE_USE_LIBUNWIND
# elif __has_include(<execinfo.h>)
# define BOOST_STACKTRACE_USE_BACKTRACE
# elif __has_include("DbgHelp.h")
# define BOOST_STACKTRACE_USE_WINDBG
# endif
#else
# if defined(BOOST_WINDOWS)
# define BOOST_STACKTRACE_USE_WINDBG
# else
# define BOOST_STACKTRACE_USE_BACKTRACE
# endif
#endif
#endif
#if defined(BOOST_STACKTRACE_USE_HEADER)
# include BOOST_STACKTRACE_USE_HEADER
#elif defined(BOOST_STACKTRACE_USE_NOOP)
# include <boost/stacktrace/detail/stacktrace_noop.hpp>
#elif defined(BOOST_WINDOWS) || defined(BOOST_STACKTRACE_USE_WINDBG)
#elif defined(BOOST_STACKTRACE_USE_WINDBG)
# include <boost/stacktrace/detail/stacktrace_windows.hpp>
#elif defined(BOOST_STACKTRACE_USE_LIBUNWIND)
# include <boost/stacktrace/detail/stacktrace_libunwind.hpp>
#elif defined(BOOST_STACKTRACE_USE_BACKTRACE)
# include <boost/stacktrace/detail/stacktrace_linux.hpp>
#elif defined(__has_include) && (!defined(__GNUC__) || __GNUC__ > 4)
# if __has_include(<libunwind.h>)
# include <boost/stacktrace/detail/stacktrace_libunwind.hpp>
# elif __has_include(<execinfo.h>)
# include <boost/stacktrace/detail/stacktrace_linux.hpp>
# endif
#else
# error No suitable backtrace backend found
#endif
namespace boost { namespace stacktrace {
namespace detail {