From aefc564640ae509e004e624a226c984108415f14 Mon Sep 17 00:00:00 2001 From: bolero-MURAKAMI Date: Wed, 20 Sep 2017 17:11:33 +0900 Subject: [PATCH] fix auto_ptr workaround --- sprout/config/stdlib/dinkumware.hpp | 73 ++++++++++++++++++++++++++ sprout/config/stdlib/libcpp.hpp | 81 +++++++++++++++++++++++++++-- sprout/memory/get_pointer.hpp | 3 +- 3 files changed, 150 insertions(+), 7 deletions(-) diff --git a/sprout/config/stdlib/dinkumware.hpp b/sprout/config/stdlib/dinkumware.hpp index a35ec14d..6d3f6859 100644 --- a/sprout/config/stdlib/dinkumware.hpp +++ b/sprout/config/stdlib/dinkumware.hpp @@ -45,6 +45,79 @@ #if !defined(_CPPLIB_VER) || _CPPLIB_VER < 610 # define SPROUT_NO_CXX11_HDR_INITIALIZER_LIST # define SPROUT_NO_CXX11_HDR_ATOMIC +# define SPROUT_NO_CXX11_ALLOCATOR +# define SPROUT_NO_CXX11_STD_ALIGN +#endif + +#if !defined(_CPPLIB_VER) || _CPPLIB_VER < 650 +# define SPROUT_NO_CXX11_POINTER_TRAITS +#elif defined(_MSC_VER) && _MSC_VER < 1910 +# define SPROUT_NO_CXX11_POINTER_TRAITS +#endif + +#if defined(__has_include) +#if !__has_include() +# define SPROUT_NO_CXX14_HDR_SHARED_MUTEX +#elif (__cplusplus < 201402) && !defined(_MSC_VER) +# define SPROUT_NO_CXX14_HDR_SHARED_MUTEX +#endif +#elif !defined(_CPPLIB_VER) || (_CPPLIB_VER < 650) +# define SPROUT_NO_CXX14_HDR_SHARED_MUTEX +#endif + +#if !defined(_CPPLIB_VER) || (_CPPLIB_VER < 650) +# define SPROUT_NO_CXX14_STD_EXCHANGE +#endif + +#if !defined(_CPPLIB_VER) || (_CPPLIB_VER < 650) || !defined(_MSC_VER) || (_MSC_VER < 1910) || !defined(_HAS_CXX17) || (_HAS_CXX17 == 0) +# define SPROUT_NO_CXX17_STD_APPLY +#endif +#if !defined(_CPPLIB_VER) || (_CPPLIB_VER < 650) +# define SPROUT_NO_CXX17_STD_INVOKE +#endif + +#if !defined(_CPPLIB_VER) || _CPPLIB_VER < 650 +# define SPROUT_NO_CXX11_ADDRESSOF +#endif + +#if defined(_CPPLIB_VER) && (_CPPLIB_VER == 650) +# define SPROUT_NO_CXX11_HDR_CODECVT +#endif + +#if defined(_CPPLIB_VER) && (_CPPLIB_VER >= 650) +# if defined(_HAS_AUTO_PTR_ETC) && (_HAS_AUTO_PTR_ETC == 0) +# define SPROUT_NO_AUTO_PTR +# define SPROUT_NO_CXX98_RANDOM_SHUFFLE +# define SPROUT_NO_CXX98_FUNCTION_BASE +# define SPROUT_NO_CXX98_BINDERS +# endif +#endif + +#ifdef _M_CEE +# ifndef SPROUT_NO_CXX11_HDR_MUTEX +# define SPROUT_NO_CXX11_HDR_MUTEX +# endif +# ifndef SPROUT_NO_CXX11_HDR_ATOMIC +# define SPROUT_NO_CXX11_HDR_ATOMIC +# endif +# ifndef SPROUT_NO_CXX11_HDR_FUTURE +# define SPROUT_NO_CXX11_HDR_FUTURE +# endif +# ifndef SPROUT_NO_CXX11_HDR_CONDITION_VARIABLE +# define SPROUT_NO_CXX11_HDR_CONDITION_VARIABLE +# endif +# ifndef SPROUT_NO_CXX11_HDR_THREAD +# define SPROUT_NO_CXX11_HDR_THREAD +# endif +# ifndef SPROUT_NO_CXX14_HDR_SHARED_MUTEX +# define SPROUT_NO_CXX14_HDR_SHARED_MUTEX +# endif +# ifndef SPROUT_NO_CXX14_STD_EXCHANGE +# define SPROUT_NO_CXX14_STD_EXCHANGE +# endif +# ifndef SPROUT_NO_FENV_H +# define SPROUT_NO_FENV_H +# endif #endif #define SPROUT_NO_CXX14_INITIALIZER_LIST diff --git a/sprout/config/stdlib/libcpp.hpp b/sprout/config/stdlib/libcpp.hpp index f906a044..3581bdcb 100644 --- a/sprout/config/stdlib/libcpp.hpp +++ b/sprout/config/stdlib/libcpp.hpp @@ -12,11 +12,82 @@ # define SPROUT_NO_CXX11_HDR_TUPLE #endif -#define SPROUT_NO_CXX11_HDR_CHRONO -#define SPROUT_NO_CXX11_HDR_FUTURE -#define SPROUT_NO_CXX11_HDR_TYPE_TRAITS -#define SPROUT_NO_CXX11_ATOMIC_SMART_PTR -#define SPROUT_NO_CXX11_HDR_ATOMIC +#if defined(_LIBCPP_HAS_NO_TEMPLATE_ALIASES) +# define SPROUT_NO_CXX11_ALLOCATOR +# define SPROUT_NO_CXX11_POINTER_TRAITS +#endif + +#if __cplusplus < 201103 +# define SPROUT_NO_CXX11_HDR_CODECVT +# define SPROUT_NO_CXX11_HDR_CONDITION_VARIABLE +# define SPROUT_NO_CXX11_HDR_INITIALIZER_LIST +# define SPROUT_NO_CXX11_HDR_MUTEX +# define SPROUT_NO_CXX11_HDR_RANDOM +# define SPROUT_NO_CXX11_HDR_RATIO +# define SPROUT_NO_CXX11_HDR_REGEX +# define SPROUT_NO_CXX11_HDR_SYSTEM_ERROR +# define SPROUT_NO_CXX11_HDR_THREAD +# define SPROUT_NO_CXX11_HDR_TUPLE +# define SPROUT_NO_CXX11_HDR_TYPEINDEX +# define SPROUT_NO_CXX11_HDR_UNORDERED_MAP +# define SPROUT_NO_CXX11_HDR_UNORDERED_SET +# define SPROUT_NO_CXX11_NUMERIC_LIMITS +# define SPROUT_NO_CXX11_ALLOCATOR +# define SPROUT_NO_CXX11_POINTER_TRAITS +# define SPROUT_NO_CXX11_SMART_PTR +# define SPROUT_NO_CXX11_HDR_FUNCTIONAL +# define SPROUT_NO_CXX11_STD_ALIGN +# define SPROUT_NO_CXX11_ADDRESSOF +# define SPROUT_NO_CXX11_HDR_ATOMIC +# define SPROUT_NO_CXX11_ATOMIC_SMART_PTR +# define SPROUT_NO_CXX11_HDR_CHRONO +# define SPROUT_NO_CXX11_HDR_TYPE_TRAITS +# define SPROUT_NO_CXX11_HDR_FUTURE +#elif _LIBCPP_VERSION < 3700 +# define SPROUT_NO_CXX11_HDR_ATOMIC +# define SPROUT_NO_CXX11_ATOMIC_SMART_PTR +# define SPROUT_NO_CXX11_HDR_CHRONO +# define SPROUT_NO_CXX11_HDR_TYPE_TRAITS +# define SPROUT_NO_CXX11_HDR_FUTURE +#endif + +#if _LIBCPP_VERSION < 3700 +# define SPROUT_NO_STD_MESSAGES +#endif + +#if (_LIBCPP_VERSION < 3700) || (__cplusplus <= 201402L) +# define SPROUT_NO_CXX14_STD_EXCHANGE +#endif + +#if (_LIBCPP_VERSION < 3700) || (__cplusplus <= 201402L) +# define SPROUT_NO_CXX17_STD_INVOKE +#endif +#if (_LIBCPP_VERSION < 4000) || (__cplusplus <= 201402L) +# define SPROUT_NO_CXX17_STD_APPLY +#endif +#if (_LIBCPP_VERSION > 4000) && (__cplusplus > 201402L) && !defined(_LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR) +# define SPROUT_NO_AUTO_PTR +#endif +#if (_LIBCPP_VERSION > 4000) && (__cplusplus > 201402L) && !defined(_LIBCPP_ENABLE_CXX17_REMOVED_RANDOM_SHUFFLE) +# define SPROUT_NO_CXX98_RANDOM_SHUFFLE +#endif +#if (_LIBCPP_VERSION > 4000) && (__cplusplus > 201402L) && !defined(_LIBCPP_ENABLE_CXX17_REMOVED_BINDERS) +# define SPROUT_NO_CXX98_BINDERS +#endif + +#if (_LIBCPP_VERSION <= 1101) && !defined(SPROUT_NO_CXX11_THREAD_LOCAL) +# define SPROUT_NO_CXX11_THREAD_LOCAL +#endif + +#if defined(__has_include) +#if !__has_include() +# define SPROUT_NO_CXX14_HDR_SHARED_MUTEX +#elif __cplusplus <= 201103 +# define SPROUT_NO_CXX14_HDR_SHARED_MUTEX +#endif +#elif __cplusplus < 201402 +# define SPROUT_NO_CXX14_HDR_SHARED_MUTEX +#endif #include #if defined(_LIBCPP_VERSION) && (_LIBCPP_VERSION <= 1001) diff --git a/sprout/memory/get_pointer.hpp b/sprout/memory/get_pointer.hpp index 50c41363..f149714d 100644 --- a/sprout/memory/get_pointer.hpp +++ b/sprout/memory/get_pointer.hpp @@ -10,7 +10,6 @@ #include #include -#include namespace sprout { // @@ -22,7 +21,7 @@ namespace sprout { return p; } -#if !SPROUT_CLANG_OR_LATER(5, 0, 0) || (_LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR)) +#if !defined(SPROUT_NO_AUTO_PTR) template inline SPROUT_NON_CONSTEXPR T* get_pointer(std::auto_ptr const& p) SPROUT_NOEXCEPT {