From 42e7d7bbb3c2b0994169b2d02b9e6767db90b08a Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Wed, 25 Sep 2013 21:17:17 +0000 Subject: [PATCH] Python: Clean up some old MSVC related code. [SVN r85922] --- include/boost/python/class.hpp | 42 ---------------- .../python/converter/arg_from_python.hpp | 4 +- .../python/converter/arg_to_python_base.hpp | 8 --- include/boost/python/data_members.hpp | 4 +- include/boost/python/detail/config.hpp | 3 -- include/boost/python/detail/construct.hpp | 8 +-- include/boost/python/detail/destroy.hpp | 49 ++----------------- include/boost/python/detail/enable_if.hpp | 35 +------------ .../boost/python/detail/force_instantiate.hpp | 14 ------ include/boost/python/detail/if_else.hpp | 39 +-------------- include/boost/python/detail/result.hpp | 4 +- include/boost/python/extract.hpp | 3 +- include/boost/python/handle.hpp | 4 -- include/boost/python/make_constructor.hpp | 9 ---- .../boost/python/object/class_metadata.hpp | 4 -- include/boost/python/object/forward.hpp | 18 +------ .../boost/python/opaque_pointer_converter.hpp | 8 --- include/boost/python/other.hpp | 4 +- include/boost/python/proxy.hpp | 4 -- include/boost/python/ptr.hpp | 4 +- .../python/suite/indexing/indexing_suite.hpp | 4 -- include/boost/python/to_python_converter.hpp | 5 -- include/boost/python/type_id.hpp | 8 +-- .../boost/python/with_custodian_and_ward.hpp | 4 -- 24 files changed, 18 insertions(+), 271 deletions(-) mode change 100755 => 100644 include/boost/python/converter/arg_from_python.hpp mode change 100755 => 100644 include/boost/python/converter/arg_to_python_base.hpp mode change 100755 => 100644 include/boost/python/detail/enable_if.hpp mode change 100755 => 100644 include/boost/python/detail/force_instantiate.hpp mode change 100755 => 100644 include/boost/python/handle.hpp mode change 100755 => 100644 include/boost/python/other.hpp mode change 100755 => 100644 include/boost/python/proxy.hpp diff --git a/include/boost/python/class.hpp b/include/boost/python/class.hpp index 253667bb..d409f9b9 100644 --- a/include/boost/python/class.hpp +++ b/include/boost/python/class.hpp @@ -302,7 +302,6 @@ class class_ : public objects::class_base } // Property creation -# if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) template self& add_property(char const* name, Get fget, char const* docstr = 0) { @@ -317,47 +316,6 @@ class class_ : public objects::class_base name, this->make_getter(fget), this->make_setter(fset), docstr); return *this; } -# else - private: - template - self& add_property_impl(char const* name, Get fget, char const* docstr, int) - { - base::add_property(name, this->make_getter(fget), docstr); - return *this; - } - - template - self& add_property_impl(char const* name, Get fget, Set fset, ...) - { - base::add_property( - name, this->make_getter(fget), this->make_setter(fset), 0); - return *this; - } - - public: - template - self& add_property(char const* name, Get fget) - { - base::add_property(name, this->make_getter(fget), 0); - return *this; - } - - template - self& add_property(char const* name, Get fget, DocStrOrSet docstr_or_set) - { - this->add_property_impl(name, this->make_getter(fget), docstr_or_set, 0); - return *this; - } - - template - self& - add_property(char const* name, Get fget, Set fset, char const* docstr) - { - base::add_property( - name, this->make_getter(fget), this->make_setter(fset), docstr); - return *this; - } -# endif template self& add_static_property(char const* name, Get fget) diff --git a/include/boost/python/converter/arg_from_python.hpp b/include/boost/python/converter/arg_from_python.hpp old mode 100755 new mode 100644 index e2edce7e..61bbaad5 --- a/include/boost/python/converter/arg_from_python.hpp +++ b/include/boost/python/converter/arg_from_python.hpp @@ -115,9 +115,9 @@ struct arg_rvalue_from_python arg_rvalue_from_python(PyObject*); bool convertible() const; -# if BOOST_MSVC < 1301 || _MSC_FULL_VER > 13102196 +# if _MSC_FULL_VER > 13102196 typename arg_rvalue_from_python:: -# endif +# endif result_type operator()(); private: diff --git a/include/boost/python/converter/arg_to_python_base.hpp b/include/boost/python/converter/arg_to_python_base.hpp old mode 100755 new mode 100644 index d85b302e..c66ce9c3 --- a/include/boost/python/converter/arg_to_python_base.hpp +++ b/include/boost/python/converter/arg_to_python_base.hpp @@ -13,17 +13,9 @@ struct registration; namespace detail { struct BOOST_PYTHON_DECL arg_to_python_base -# if !defined(BOOST_MSVC) || BOOST_MSVC <= 1300 || _MSC_FULL_VER > 13102179 : handle<> -# endif { arg_to_python_base(void const volatile* source, registration const&); -# if defined(BOOST_MSVC) && BOOST_MSVC > 1300 && _MSC_FULL_VER <= 13102179 - PyObject* get() const { return m_ptr.get(); } - PyObject* release() { return m_ptr.release(); } - private: - handle<> m_ptr; -# endif }; } diff --git a/include/boost/python/data_members.hpp b/include/boost/python/data_members.hpp index b0851fb1..c000a21a 100644 --- a/include/boost/python/data_members.hpp +++ b/include/boost/python/data_members.hpp @@ -270,7 +270,7 @@ inline object make_getter(D& x) return detail::make_getter(x, policy, is_member_pointer(), 0L); } -# if !BOOST_WORKAROUND(__EDG_VERSION__, <= 238) && !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) +# if !BOOST_WORKAROUND(__EDG_VERSION__, <= 238) template inline object make_getter(D const& d) { @@ -305,7 +305,7 @@ inline object make_setter(D& x) return detail::make_setter(x, default_call_policies(), is_member_pointer(), 0); } -# if !(BOOST_WORKAROUND(BOOST_MSVC, <= 1300) || BOOST_WORKAROUND(__EDG_VERSION__, <= 238)) +# if BOOST_WORKAROUND(__EDG_VERSION__, <= 238)) template inline object make_setter(D const& x) { diff --git a/include/boost/python/detail/config.hpp b/include/boost/python/detail/config.hpp index 76595ebb..1857d39a 100644 --- a/include/boost/python/detail/config.hpp +++ b/include/boost/python/detail/config.hpp @@ -29,9 +29,6 @@ # endif # if defined(BOOST_MSVC) -# if _MSC_VER < 1300 -# define BOOST_MSVC6_OR_EARLIER 1 -# endif # pragma warning (disable : 4786) // disable truncated debug symbols # pragma warning (disable : 4251) // disable exported dll function diff --git a/include/boost/python/detail/construct.hpp b/include/boost/python/detail/construct.hpp index 5f15d22c..e69fbc75 100644 --- a/include/boost/python/detail/construct.hpp +++ b/include/boost/python/detail/construct.hpp @@ -8,13 +8,7 @@ namespace boost { namespace python { namespace detail { template -void construct_pointee(void* storage, Arg& x -# if !defined(BOOST_MSVC) || BOOST_MSVC > 1300 - , T const volatile* -# else - , T const* -# endif - ) +void construct_pointee(void* storage, Arg& x, T const volatile*) { new (storage) T(x); } diff --git a/include/boost/python/detail/destroy.hpp b/include/boost/python/detail/destroy.hpp index 0172dca2..3ea64553 100644 --- a/include/boost/python/detail/destroy.hpp +++ b/include/boost/python/detail/destroy.hpp @@ -7,25 +7,12 @@ # include # include -# if BOOST_WORKAROUND(BOOST_MSVC, == 1300) -# include -# endif namespace boost { namespace python { namespace detail { -template < - bool array -# if BOOST_WORKAROUND(BOOST_MSVC, == 1300) - , bool enum_ // vc7 has a problem destroying enums -# endif - > struct value_destroyer; +template struct value_destroyer; template <> -struct value_destroyer< - false -# if BOOST_WORKAROUND(BOOST_MSVC, == 1300) - , false -# endif - > +struct value_destroyer { template static void execute(T const volatile* p) @@ -35,12 +22,7 @@ struct value_destroyer< }; template <> -struct value_destroyer< - true -# if BOOST_WORKAROUND(BOOST_MSVC, == 1300) - , false -# endif - > +struct value_destroyer { template static void execute(A*, T const volatile* const first) @@ -49,9 +31,6 @@ struct value_destroyer< { value_destroyer< boost::is_array::value -# if BOOST_WORKAROUND(BOOST_MSVC, == 1300) - , boost::is_enum::value -# endif >::execute(p); } } @@ -63,25 +42,6 @@ struct value_destroyer< } }; -# if BOOST_WORKAROUND(BOOST_MSVC, == 1300) -template <> -struct value_destroyer -{ - template - static void execute(T const volatile*) - { - } -}; - -template <> -struct value_destroyer -{ - template - static void execute(T const volatile*) - { - } -}; -# endif template inline void destroy_referent_impl(void* p, T& (*)()) { @@ -89,9 +49,6 @@ inline void destroy_referent_impl(void* p, T& (*)()) // must come *before* T for metrowerks value_destroyer< (boost::is_array::value) -# if BOOST_WORKAROUND(BOOST_MSVC, == 1300) - , (boost::is_enum::value) -# endif >::execute((const volatile T*)p); } diff --git a/include/boost/python/detail/enable_if.hpp b/include/boost/python/detail/enable_if.hpp old mode 100755 new mode 100644 index 46a1d532..7a37be12 --- a/include/boost/python/detail/enable_if.hpp +++ b/include/boost/python/detail/enable_if.hpp @@ -7,40 +7,7 @@ # include # include -# if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) -# include - -namespace boost { namespace python { namespace detail { - -template struct always_void { typedef void type; }; - -template -struct enable_if_arg -{ - typedef typename mpl::if_::type type; -}; - -template -struct disable_if_arg -{ - typedef typename mpl::if_::type type; -}; - -template ::type> -struct enable_if_ret -{ - typedef typename mpl::if_::type type; -}; - -template ::type> -struct disable_if_ret -{ - typedef typename mpl::if_::type type; -}; - -}}} // namespace boost::python::detail - -# elif !defined(BOOST_NO_SFINAE) +#if !defined(BOOST_NO_SFINAE) # include namespace boost { namespace python { namespace detail { diff --git a/include/boost/python/detail/force_instantiate.hpp b/include/boost/python/detail/force_instantiate.hpp old mode 100755 new mode 100644 index 63e28749..a8901b2d --- a/include/boost/python/detail/force_instantiate.hpp +++ b/include/boost/python/detail/force_instantiate.hpp @@ -10,23 +10,9 @@ namespace boost { namespace python { namespace detail { // Allows us to force the argument to be instantiated without // incurring unused variable warnings -# if !defined(BOOST_MSVC) || BOOST_MSVC < 1300 || _MSC_FULL_VER > 13102196 - template inline void force_instantiate(T const&) {} -# else - -# pragma optimize("g", off) -inline void force_instantiate_impl(...) {} -# pragma optimize("", on) -template -inline void force_instantiate(T const& x) -{ - detail::force_instantiate_impl(&x); -} -# endif - }}} // namespace boost::python::detail #endif // FORCE_INSTANTIATE_DWA200265_HPP diff --git a/include/boost/python/detail/if_else.hpp b/include/boost/python/detail/if_else.hpp index 244e63a8..3f505c5e 100644 --- a/include/boost/python/detail/if_else.hpp +++ b/include/boost/python/detail/if_else.hpp @@ -25,46 +25,11 @@ struct if_selected }; }; -# if defined(BOOST_MSVC) && (BOOST_MSVC == 1300) -namespace msvc70_aux { - -template< bool > struct inherit_from -{ - template< typename T > struct result - { - typedef T type; - }; -}; - -template<> struct inherit_from -{ - template< typename T > struct result - { - struct type {}; - }; -}; - -template< typename T > -struct never_true -{ - BOOST_STATIC_CONSTANT(bool, value = false); -}; - -} // namespace msvc70_aux - -#endif // # if defined(BOOST_MSVC) && (BOOST_MSVC == 1300) - template struct elif_selected { -# if !(defined(BOOST_MSVC) && BOOST_MSVC <= 1300 || defined(__MWERKS__) && __MWERKS__ <= 0x2407) +# if !(defined(__MWERKS__) && __MWERKS__ <= 0x2407) template class then; -# elif defined(BOOST_MSVC) && (BOOST_MSVC == 1300) - template - struct then : msvc70_aux::inherit_from< msvc70_aux::never_true::value > - ::template result< if_selected >::type - { - }; # else template struct then : if_selected @@ -73,7 +38,7 @@ struct elif_selected # endif }; -# if !(defined(BOOST_MSVC) && BOOST_MSVC <= 1300 || defined(__MWERKS__) && __MWERKS__ <= 0x2407) +# if !(defined(__MWERKS__) && __MWERKS__ <= 0x2407) template template class elif_selected::then : public if_selected diff --git a/include/boost/python/detail/result.hpp b/include/boost/python/detail/result.hpp index 9b8b4864..8ccc3c50 100644 --- a/include/boost/python/detail/result.hpp +++ b/include/boost/python/detail/result.hpp @@ -43,9 +43,7 @@ namespace boost { namespace python { namespace detail { template boost::type* result(R (T::*), int = 0) { return 0; } -# if (defined(BOOST_MSVC) && _MSC_FULL_VER <= 13102140) \ - || (defined(__GNUC__) && __GNUC__ < 3) \ - || (defined(__MWERKS__) && __MWERKS__ < 0x3000) +# if (defined(__MWERKS__) && __MWERKS__ < 0x3000) // This code actually works on all implementations, but why use it when we don't have to? template struct get_result_type diff --git a/include/boost/python/extract.hpp b/include/boost/python/extract.hpp index 544c61f0..bfdeb83c 100644 --- a/include/boost/python/extract.hpp +++ b/include/boost/python/extract.hpp @@ -21,8 +21,7 @@ # include # include -#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) || BOOST_WORKAROUND(BOOST_INTEL_WIN, <= 900) -// workaround for VC++ 6.x or 7.0 +#if BOOST_WORKAROUND(BOOST_INTEL_WIN, <= 900) # define BOOST_EXTRACT_WORKAROUND () #else # define BOOST_EXTRACT_WORKAROUND diff --git a/include/boost/python/handle.hpp b/include/boost/python/handle.hpp old mode 100755 new mode 100644 index 461a219a..8208f3ab --- a/include/boost/python/handle.hpp +++ b/include/boost/python/handle.hpp @@ -87,8 +87,6 @@ class handle return *this; } -#if !defined(BOOST_MSVC) || (BOOST_MSVC >= 1300) - template handle& operator=(handle const & r) // never throws { @@ -97,8 +95,6 @@ class handle return *this; } -#endif - template handle(handle const& r) : m_p(python::xincref(python::upcast(r.get()))) diff --git a/include/boost/python/make_constructor.hpp b/include/boost/python/make_constructor.hpp index 8ae722bb..47cdf469 100644 --- a/include/boost/python/make_constructor.hpp +++ b/include/boost/python/make_constructor.hpp @@ -104,14 +104,6 @@ namespace detail // If the BasePolicy_ supplied a result converter it would be // ignored; issue an error if it's not the default. -#if defined _MSC_VER && _MSC_VER < 1300 - typedef is_same< - typename BasePolicy_::result_converter - , default_result_converter - > same_result_converter; - //see above for explanation - BOOST_STATIC_ASSERT(same_result_converter::value) ; -#else BOOST_MPL_ASSERT_MSG( (is_same< typename BasePolicy_::result_converter @@ -120,7 +112,6 @@ namespace detail , MAKE_CONSTRUCTOR_SUPPLIES_ITS_OWN_RESULT_CONVERTER_THAT_WOULD_OVERRIDE_YOURS , (typename BasePolicy_::result_converter) ); -#endif typedef constructor_result_converter result_converter; typedef offset_args > argument_package; }; diff --git a/include/boost/python/object/class_metadata.hpp b/include/boost/python/object/class_metadata.hpp index 155ae35d..c71cf67c 100644 --- a/include/boost/python/object/class_metadata.hpp +++ b/include/boost/python/object/class_metadata.hpp @@ -53,11 +53,7 @@ struct register_base_of template inline void operator()(Base*) const { -# if !BOOST_WORKAROUND(BOOST_MSVC, == 1200) BOOST_MPL_ASSERT_NOT((is_same)); -# else - BOOST_STATIC_ASSERT(!(is_same::value)); -# endif // Register the Base class register_dynamic_id(); diff --git a/include/boost/python/object/forward.hpp b/include/boost/python/object/forward.hpp index 2faf3321..83182bfb 100644 --- a/include/boost/python/object/forward.hpp +++ b/include/boost/python/object/forward.hpp @@ -12,13 +12,7 @@ # include # include # include -# if BOOST_WORKAROUND(BOOST_MSVC, < 1300) -# include -# include -# include -# else -# include -# endif +# include namespace boost { namespace python { namespace objects { @@ -42,17 +36,7 @@ struct reference_to_value template struct forward : mpl::if_< -# if BOOST_WORKAROUND(BOOST_MSVC, < 1300) - // vc6 chokes on unforwarding enums nested in classes - mpl::and_< - is_scalar - , mpl::not_< - is_enum - > - > -# else mpl::or_, is_scalar > -# endif , T , reference_to_value > diff --git a/include/boost/python/opaque_pointer_converter.hpp b/include/boost/python/opaque_pointer_converter.hpp index 688f3910..e95c49bb 100644 --- a/include/boost/python/opaque_pointer_converter.hpp +++ b/include/boost/python/opaque_pointer_converter.hpp @@ -172,12 +172,6 @@ PyTypeObject opaque::type_object = }; }} // namespace boost::python -# if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) - -# define BOOST_PYTHON_OPAQUE_SPECIALIZED_TYPE_ID(Pointee) - -# else - // If you change the below, don't forget to alter the end of type_id.hpp # define BOOST_PYTHON_OPAQUE_SPECIALIZED_TYPE_ID(Pointee) \ namespace boost { namespace python { \ @@ -193,6 +187,4 @@ PyTypeObject opaque::type_object = } \ }} -# endif - # endif // OPAQUE_POINTER_CONVERTER_HPP_ diff --git a/include/boost/python/other.hpp b/include/boost/python/other.hpp old mode 100755 new mode 100644 index eeece99b..7cd6fa04 --- a/include/boost/python/other.hpp +++ b/include/boost/python/other.hpp @@ -7,9 +7,7 @@ // accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -# if _MSC_VER+0 >= 1020 -# pragma once -# endif +# pragma once # include diff --git a/include/boost/python/proxy.hpp b/include/boost/python/proxy.hpp old mode 100755 new mode 100644 index a956eac1..d3331d56 --- a/include/boost/python/proxy.hpp +++ b/include/boost/python/proxy.hpp @@ -15,11 +15,7 @@ class proxy : public object_operators > { typedef typename Policies::key_type key_type; -# if !defined(BOOST_MSVC) || BOOST_MSVC >= 1300 typedef proxy const& assignment_self; -# else - typedef proxy assignment_self; -# endif public: proxy(object const& target, key_type const& key); operator object() const; diff --git a/include/boost/python/ptr.hpp b/include/boost/python/ptr.hpp index af1339c4..0152459c 100644 --- a/include/boost/python/ptr.hpp +++ b/include/boost/python/ptr.hpp @@ -11,9 +11,7 @@ // Copyright (C) 1999, 2000 Jaakko Jarvi (jaakko.jarvi@cs.utu.fi) // Copyright (C) 2001 Peter Dimov -# if _MSC_VER+0 >= 1020 -# pragma once -# endif +# pragma once # include # include diff --git a/include/boost/python/suite/indexing/indexing_suite.hpp b/include/boost/python/suite/indexing/indexing_suite.hpp index b636b211..40301fdf 100644 --- a/include/boost/python/suite/indexing/indexing_suite.hpp +++ b/include/boost/python/suite/indexing/indexing_suite.hpp @@ -131,11 +131,7 @@ namespace boost { namespace python { typedef detail::container_element container_element_t; -#if BOOST_WORKAROUND(BOOST_MSVC, < 1300) - struct return_policy : return_internal_reference<> {}; -#else typedef return_internal_reference<> return_policy; -#endif typedef typename mpl::if_< no_proxy diff --git a/include/boost/python/to_python_converter.hpp b/include/boost/python/to_python_converter.hpp index 378d159e..4391b6dc 100644 --- a/include/boost/python/to_python_converter.hpp +++ b/include/boost/python/to_python_converter.hpp @@ -48,12 +48,7 @@ template < class T, class Conversion, bool has_get_pytype=false > struct to_python_converter { #ifndef BOOST_PYTHON_NO_PY_SIGNATURES -#if 0 //defined _MSC_VER && _MSC_VER >=1310 - //probably other compilers could come here as well - typedef typename detail::test_get_pytype HasGetPytype; -#else typedef boost::mpl::bool_ HasGetPytype; -#endif static PyTypeObject const* get_pytype_1(boost::mpl::true_ *) { diff --git a/include/boost/python/type_id.hpp b/include/boost/python/type_id.hpp index 2fb8ea77..7873a2f2 100644 --- a/include/boost/python/type_id.hpp +++ b/include/boost/python/type_id.hpp @@ -78,10 +78,9 @@ inline type_info type_id() { return type_info( # if !defined(_MSC_VER) \ - || (!BOOST_WORKAROUND(BOOST_MSVC, <= 1300) \ - && !BOOST_WORKAROUND(BOOST_INTEL_CXX_VERSION, <= 700)) + || !BOOST_WORKAROUND(BOOST_INTEL_CXX_VERSION, <= 700) typeid(T) -# else // strip the decoration which msvc and Intel mistakenly leave in +# else // strip the decoration which Intel mistakenly leaves in python::detail::msvc_typeid((boost::type*)0) # endif ); @@ -169,7 +168,6 @@ inline char const* type_info::name() const BOOST_PYTHON_DECL std::ostream& operator<<(std::ostream&, type_info const&); -# if !BOOST_WORKAROUND(BOOST_MSVC, == 1200) template<> inline type_info type_id() { @@ -183,8 +181,6 @@ inline type_info type_id() } # endif -# endif - }} // namespace boost::python #endif // TYPE_ID_DWA2002517_HPP diff --git a/include/boost/python/with_custodian_and_ward.hpp b/include/boost/python/with_custodian_and_ward.hpp index 9399478f..3431c6f2 100644 --- a/include/boost/python/with_custodian_and_ward.hpp +++ b/include/boost/python/with_custodian_and_ward.hpp @@ -85,14 +85,10 @@ struct with_custodian_and_ward_postcall : BasePolicy_ static PyObject* postcall(ArgumentPackage const& args_, PyObject* result) { std::size_t arity_ = detail::arity(args_); -#if BOOST_WORKAROUND(BOOST_MSVC, < 1300) - if ( custodian > arity_ || ward > arity_ ) -#else // check if either custodian or ward exceeds the arity // (this weird formulation avoids "always false" warnings // for arity_ = 0) if ( (std::max)(custodian, ward) > arity_ ) -#endif { PyErr_SetString( PyExc_IndexError