From 2feb0fcf3c1591ae5c6810697b14ab3f06d8027d Mon Sep 17 00:00:00 2001 From: huangqinjin Date: Fri, 13 Sep 2024 23:29:13 +0800 Subject: [PATCH] Don't export boost_stacktrace_impl_return_nullptr for static build --- include/boost/stacktrace/frame.hpp | 14 ++++++++++++++ include/boost/stacktrace/stacktrace.hpp | 4 ---- test/Jamfile.v2 | 4 ++++ 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/include/boost/stacktrace/frame.hpp b/include/boost/stacktrace/frame.hpp index e12195e..06b0659 100644 --- a/include/boost/stacktrace/frame.hpp +++ b/include/boost/stacktrace/frame.hpp @@ -20,6 +20,20 @@ #include #include +#if defined(BOOST_MSVC) && (defined(BOOST_STACKTRACE_INTERNAL_BUILD_LIBS) || !defined(BOOST_STACKTRACE_LINK)) +extern "C" { + +#if defined(BOOST_STACKTRACE_DYN_LINK) +BOOST_SYMBOL_EXPORT +#elif defined(BOOST_STACKTRACE_LINK) +#else +BOOST_SYMBOL_EXPORT inline +#endif +void* boost_stacktrace_impl_return_nullptr() { return nullptr; } + +} +#endif + namespace boost { namespace stacktrace { /// Comparison operators that provide platform dependant ordering and have O(1) complexity; are Async-Handler-Safe. diff --git a/include/boost/stacktrace/stacktrace.hpp b/include/boost/stacktrace/stacktrace.hpp index 5592eba..b37cf33 100644 --- a/include/boost/stacktrace/stacktrace.hpp +++ b/include/boost/stacktrace/stacktrace.hpp @@ -37,10 +37,6 @@ extern "C" { -//#if defined(BOOST_STACKTRACE_LINK) && defined(BOOST_STACKTRACE_DYN_LINK) -BOOST_SYMBOL_EXPORT -//#endif -inline void* boost_stacktrace_impl_return_nullptr() { return nullptr; } const char* boost_stacktrace_impl_current_exception_stacktrace(); bool* boost_stacktrace_impl_ref_capture_stacktraces_at_throw(); diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index 10542ef..72c3aa2 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -188,6 +188,8 @@ test-suite stacktrace_tests [ run test_void_ptr_cast.cpp ] [ run test_num_conv.cpp ] + [ run test_from_exception_none.cpp : : : $(LINKSHARED_NOOP) on : from_exception_none_noop ] + [ run test_from_exception_none.cpp : : : BOOST_STACKTRACE_USE_NOOP $(NOOP_DEPS) on : from_exception_none_noop_ho ] [ run test_from_exception_none.cpp : : : $(LINKSHARED_BASIC) on : from_exception_none_basic ] [ run test_from_exception_none.cpp : : : $(FORCE_SYMBOL_EXPORT) $(BASIC_DEPS) on : from_exception_none_basic_ho ] [ run test_from_exception_none.cpp : : : $(LINKSHARED_BT) on : from_exception_none_bt ] @@ -197,6 +199,8 @@ test-suite stacktrace_tests [ run test_from_exception_none.cpp : : : $(LINKSHARED_WIND_CACHED) on : from_exception_none_windbg_cached ] [ run test_from_exception_none.cpp : : : BOOST_STACKTRACE_USE_WINDBG_CACHED $(WICA_DEPS) on : from_exception_none_windbg_cached_ho ] + [ run test_from_exception_none.cpp : : : /boost/stacktrace//boost_stacktrace_from_exception $(LINKSHARED_NOOP) on : from_exception_disabled_none ] + [ run test_from_exception_none.cpp : : : /boost/stacktrace//boost_stacktrace_from_exception BOOST_STACKTRACE_USE_NOOP $(NOOP_DEPS) : from_exception_disabled_none_ho ] [ run test_from_exception_none.cpp : : : /boost/stacktrace//boost_stacktrace_from_exception $(LINKSHARED_BASIC) on : from_exception_disabled_basic ] [ run test_from_exception_none.cpp : : : /boost/stacktrace//boost_stacktrace_from_exception $(FORCE_SYMBOL_EXPORT) $(BASIC_DEPS) on : from_exception_disabled_basic_ho ] [ run test_from_exception_none.cpp : : : /boost/stacktrace//boost_stacktrace_from_exception $(LINKSHARED_BT) on : from_exception_disabled_bt ]