This is an automated email from the ASF dual-hosted git repository. jking pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/thrift.git
commit 9f837bbfb4c61ad8afe80950b6ce677a5cd39aeb Author: cyy <cyye...@outlook.com> AuthorDate: Sat Jan 5 14:49:24 2019 +0800 remove boost smart ptr --- build/cmake/DefineOptions.cmake | 6 ----- build/cmake/DefinePlatformSpecifc.cmake | 2 -- lib/cpp/src/thrift/stdcxx.h | 39 +++++++-------------------------- 3 files changed, 8 insertions(+), 39 deletions(-) diff --git a/build/cmake/DefineOptions.cmake b/build/cmake/DefineOptions.cmake index 43b73e4..7465c80 100644 --- a/build/cmake/DefineOptions.cmake +++ b/build/cmake/DefineOptions.cmake @@ -45,11 +45,6 @@ if (WITH_BOOST_FUNCTIONAL) add_definitions(-DFORCE_BOOST_FUNCTIONAL) endif() -option(WITH_BOOST_SMART_PTR "Use boost/smart_ptr.hpp even under C++11 or later" OFF) -if (WITH_BOOST_SMART_PTR) - add_definitions(-DFORCE_BOOST_SMART_PTR) -endif() - option(WITH_BOOST_STATIC "Build with Boost static link library" OFF) set(Boost_USE_STATIC_LIBS ${WITH_BOOST_STATIC}) if (NOT WITH_BOOST_STATIC) @@ -205,7 +200,6 @@ message(STATUS " Build shared libraries: ${WITH_SHARED_LIB} message(STATUS " Build static libraries: ${WITH_STATIC_LIB}") message(STATUS " Build with Boost static link library: ${WITH_BOOST_STATIC}") message(STATUS " Build with boost/tr1/functional (forced) ${WITH_BOOST_FUNCTIONAL}") -message(STATUS " Build with boost/smart_ptr (forced) ${WITH_BOOST_SMART_PTR}") message(STATUS " Build with C++ std::thread support: ${WITH_STDTHREADS}") message(STATUS " Build with libevent support: ${WITH_LIBEVENT}") message(STATUS " Build with OpenSSL support: ${WITH_OPENSSL}") diff --git a/build/cmake/DefinePlatformSpecifc.cmake b/build/cmake/DefinePlatformSpecifc.cmake index cbd5ca8..98fb589 100644 --- a/build/cmake/DefinePlatformSpecifc.cmake +++ b/build/cmake/DefinePlatformSpecifc.cmake @@ -125,7 +125,5 @@ if (WITH_PLUGIN) if (CMAKE_CXX_COMPILER_ID MATCHES "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.8") message(SEND_ERROR "Thrift compiler plug-in support is not possible with older gcc ( < 4.8 ) compiler") endif() - message(STATUS "Forcing use of boost::smart_ptr to build WITH_PLUGIN") - add_definitions("-DFORCE_BOOST_SMART_PTR=1") endif() diff --git a/lib/cpp/src/thrift/stdcxx.h b/lib/cpp/src/thrift/stdcxx.h index c8cabf5..1a65f87 100644 --- a/lib/cpp/src/thrift/stdcxx.h +++ b/lib/cpp/src/thrift/stdcxx.h @@ -87,42 +87,19 @@ // /////////////////////////////////////////////////////////////////// -// We can use std for memory functions only if the compiler supports template aliasing -// The macro BOOST_NO_CXX11_SMART_PTR is defined as 1 under Visual Studio 2010 and 2012 -// which do not support the feature, so we must continue to use C++98 and boost on them. -// We cannot use __cplusplus to detect this either, since Microsoft advertises an older one. - -#if defined(BOOST_NO_CXX11_SMART_PTR) || (defined(_MSC_VER) && _MSC_VER < 1800) || defined(FORCE_BOOST_SMART_PTR) -#include <boost/smart_ptr.hpp> -#else #include <memory> -#endif namespace apache { namespace thrift { namespace stdcxx { -#if defined(BOOST_NO_CXX11_SMART_PTR) || (defined(_MSC_VER) && _MSC_VER < 1800) || defined(FORCE_BOOST_SMART_PTR) - - using ::boost::const_pointer_cast; - using ::boost::dynamic_pointer_cast; - using ::boost::enable_shared_from_this; - using ::boost::make_shared; - using ::boost::scoped_ptr; - using ::boost::shared_ptr; - using ::boost::static_pointer_cast; - using ::boost::weak_ptr; +using ::std::const_pointer_cast; +using ::std::dynamic_pointer_cast; +using ::std::enable_shared_from_this; +using ::std::make_shared; +template <typename T> using scoped_ptr = std::unique_ptr<T>; // compiler must support template aliasing +using ::std::shared_ptr; +using ::std::static_pointer_cast; +using ::std::weak_ptr; -#else - - using ::std::const_pointer_cast; - using ::std::dynamic_pointer_cast; - using ::std::enable_shared_from_this; - using ::std::make_shared; - template <typename T> using scoped_ptr = std::unique_ptr<T>; // compiler must support template aliasing - using ::std::shared_ptr; - using ::std::static_pointer_cast; - using ::std::weak_ptr; - -#endif }}} // apache::thrift::stdcxx