Skip to content

Commit b5e2058

Browse files
committed
Fixes for FreeBSD and other OSes that do not define _GNU_SOURCE but have _Unwind_Backtrace function
1 parent af78623 commit b5e2058

6 files changed

Lines changed: 21 additions & 2 deletions

File tree

build/has_windbg_cached.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
#include "dbgeng.h"
1313

1414
#ifdef BOOST_NO_CXX11_THREAD_LOCAL
15-
# error Your compiler does not support C++11 thread_local storage. It's impossible to build with BOOST_STACKTRACE_USE_WINDBG_CACHED.
15+
# error Your compiler does not support C++11 thread_local storage. It`s impossible to build with BOOST_STACKTRACE_USE_WINDBG_CACHED.
1616
#endif
1717

1818
int foo() {

include/boost/stacktrace/detail/collect_unwind.ipp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@
1717
#include <unwind.h>
1818
#include <cstdio>
1919

20+
#if !defined(_GNU_SOURCE) && !defined(BOOST_STACKTRACE_GNU_SOURCE_NOT_REQUIRED)
21+
#error "Boost.Stacktrace requires `_Unwind_Backtrace` function. Define `_GNU_SOURCE` macro or `BOOST_STACKTRACE_GNU_SOURCE_NOT_REQUIRED` if _Unwind_Backtrace is available without `_GNU_SOURCE`."
22+
#endif
23+
2024
namespace boost { namespace stacktrace { namespace detail {
2125

2226
struct unwind_state {

include/boost/stacktrace/detail/frame_msvc.ipp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ public:
164164
#else
165165

166166
#ifdef BOOST_NO_CXX11_THREAD_LOCAL
167-
# error Your compiler does not support C++11 thread_local storage. It's impossible to build with BOOST_STACKTRACE_USE_WINDBG_CACHED.
167+
# error Your compiler does not support C++11 thread_local storage. It`s impossible to build with BOOST_STACKTRACE_USE_WINDBG_CACHED.
168168
#endif
169169

170170
static com_holder< ::IDebugSymbols>& get_thread_local_debug_inst() BOOST_NOEXCEPT {

src/addr2line.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,10 @@
77
#define BOOST_STACKTRACE_INTERNAL_BUILD_LIBS
88
#define BOOST_STACKTRACE_USE_ADDR2LINE
99
#define BOOST_STACKTRACE_LINK
10+
11+
#ifndef _GNU_SOURCE
12+
# define _GNU_SOURCE
13+
#endif
14+
1015
#include <boost/stacktrace/detail/frame_unwind.ipp>
1116
#include <boost/stacktrace/safe_dump_to.hpp>

src/backtrace.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,10 @@
77
#define BOOST_STACKTRACE_INTERNAL_BUILD_LIBS
88
#define BOOST_STACKTRACE_USE_BACKTRACE
99
#define BOOST_STACKTRACE_LINK
10+
11+
#ifndef _GNU_SOURCE
12+
# define _GNU_SOURCE
13+
#endif
14+
1015
#include <boost/stacktrace/detail/frame_unwind.ipp>
1116
#include <boost/stacktrace/safe_dump_to.hpp>

src/basic.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,10 @@
66

77
#define BOOST_STACKTRACE_INTERNAL_BUILD_LIBS
88
#define BOOST_STACKTRACE_LINK
9+
10+
#ifndef _GNU_SOURCE
11+
# define _GNU_SOURCE
12+
#endif
13+
914
#include <boost/stacktrace/detail/frame_unwind.ipp>
1015
#include <boost/stacktrace/safe_dump_to.hpp>

0 commit comments

Comments
 (0)