2
0
mirror of https://github.com/boostorg/python.git synced 2026-01-19 16:32:16 +00:00

Python: Clean up some old MSVC related code.

[SVN r85922]
This commit is contained in:
Stephen Kelly
2013-09-25 21:17:17 +00:00
parent 5476f97d59
commit 42e7d7bbb3
24 changed files with 18 additions and 271 deletions

View File

@@ -302,7 +302,6 @@ class class_ : public objects::class_base
}
// Property creation
# if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
template <class Get>
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 <class Get>
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 <class Get, class Set>
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 <class Get>
self& add_property(char const* name, Get fget)
{
base::add_property(name, this->make_getter(fget), 0);
return *this;
}
template <class Get, class DocStrOrSet>
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 <class Get, class Set>
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 <class Get>
self& add_static_property(char const* name, Get fget)

4
include/boost/python/converter/arg_from_python.hpp Executable file → Normal file
View File

@@ -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<T>::
# endif
# endif
result_type operator()();
private:

8
include/boost/python/converter/arg_to_python_base.hpp Executable file → Normal file
View File

@@ -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
};
}

View File

@@ -270,7 +270,7 @@ inline object make_getter(D& x)
return detail::make_getter(x, policy, is_member_pointer<D>(), 0L);
}
# if !BOOST_WORKAROUND(__EDG_VERSION__, <= 238) && !BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
# if !BOOST_WORKAROUND(__EDG_VERSION__, <= 238)
template <class D>
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<D>(), 0);
}
# if !(BOOST_WORKAROUND(BOOST_MSVC, <= 1300) || BOOST_WORKAROUND(__EDG_VERSION__, <= 238))
# if BOOST_WORKAROUND(__EDG_VERSION__, <= 238))
template <class D>
inline object make_setter(D const& x)
{

View File

@@ -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

View File

@@ -8,13 +8,7 @@
namespace boost { namespace python { namespace detail {
template <class T, class Arg>
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);
}

View File

@@ -7,25 +7,12 @@
# include <boost/type_traits/is_array.hpp>
# include <boost/detail/workaround.hpp>
# if BOOST_WORKAROUND(BOOST_MSVC, == 1300)
# include <boost/type_traits/is_enum.hpp>
# 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 <bool array> struct value_destroyer;
template <>
struct value_destroyer<
false
# if BOOST_WORKAROUND(BOOST_MSVC, == 1300)
, false
# endif
>
struct value_destroyer<false>
{
template <class T>
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<true>
{
template <class A, class T>
static void execute(A*, T const volatile* const first)
@@ -49,9 +31,6 @@ struct value_destroyer<
{
value_destroyer<
boost::is_array<T>::value
# if BOOST_WORKAROUND(BOOST_MSVC, == 1300)
, boost::is_enum<T>::value
# endif
>::execute(p);
}
}
@@ -63,25 +42,6 @@ struct value_destroyer<
}
};
# if BOOST_WORKAROUND(BOOST_MSVC, == 1300)
template <>
struct value_destroyer<true,true>
{
template <class T>
static void execute(T const volatile*)
{
}
};
template <>
struct value_destroyer<false,true>
{
template <class T>
static void execute(T const volatile*)
{
}
};
# endif
template <class T>
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<T>::value)
# if BOOST_WORKAROUND(BOOST_MSVC, == 1300)
, (boost::is_enum<T>::value)
# endif
>::execute((const volatile T*)p);
}

35
include/boost/python/detail/enable_if.hpp Executable file → Normal file
View File

@@ -7,40 +7,7 @@
# include <boost/python/detail/sfinae.hpp>
# include <boost/detail/workaround.hpp>
# if BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
# include <boost/mpl/if.hpp>
namespace boost { namespace python { namespace detail {
template <class T> struct always_void { typedef void type; };
template <class C, class T = int>
struct enable_if_arg
{
typedef typename mpl::if_<C,T,int&>::type type;
};
template <class C, class T = int>
struct disable_if_arg
{
typedef typename mpl::if_<C,int&,T>::type type;
};
template <class C, class T = typename always_void<C>::type>
struct enable_if_ret
{
typedef typename mpl::if_<C,T,int[2]>::type type;
};
template <class C, class T = typename always_void<C>::type>
struct disable_if_ret
{
typedef typename mpl::if_<C,int[2],T>::type type;
};
}}} // namespace boost::python::detail
# elif !defined(BOOST_NO_SFINAE)
#if !defined(BOOST_NO_SFINAE)
# include <boost/utility/enable_if.hpp>
namespace boost { namespace python { namespace detail {

14
include/boost/python/detail/force_instantiate.hpp Executable file → Normal file
View File

@@ -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 <class T>
inline void force_instantiate(T const&) {}
# else
# pragma optimize("g", off)
inline void force_instantiate_impl(...) {}
# pragma optimize("", on)
template <class T>
inline void force_instantiate(T const& x)
{
detail::force_instantiate_impl(&x);
}
# endif
}}} // namespace boost::python::detail
#endif // FORCE_INSTANTIATE_DWA200265_HPP

View File

@@ -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<true>
{
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 <class T>
struct elif_selected
{
# if !(defined(BOOST_MSVC) && BOOST_MSVC <= 1300 || defined(__MWERKS__) && __MWERKS__ <= 0x2407)
# if !(defined(__MWERKS__) && __MWERKS__ <= 0x2407)
template <class U> class then;
# elif defined(BOOST_MSVC) && (BOOST_MSVC == 1300)
template <class U>
struct then : msvc70_aux::inherit_from< msvc70_aux::never_true<U>::value >
::template result< if_selected<T> >::type
{
};
# else
template <class U>
struct then : if_selected<T>
@@ -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 <class T>
template <class U>
class elif_selected<T>::then : public if_selected<T>

View File

@@ -43,9 +43,7 @@ namespace boost { namespace python { namespace detail {
template <class R, class T>
boost::type<R>* 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 <class T>
struct get_result_type

View File

@@ -21,8 +21,7 @@
# include <boost/python/detail/void_return.hpp>
# include <boost/call_traits.hpp>
#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

4
include/boost/python/handle.hpp Executable file → Normal file
View File

@@ -87,8 +87,6 @@ class handle
return *this;
}
#if !defined(BOOST_MSVC) || (BOOST_MSVC >= 1300)
template<typename Y>
handle& operator=(handle<Y> const & r) // never throws
{
@@ -97,8 +95,6 @@ class handle
return *this;
}
#endif
template <typename Y>
handle(handle<Y> const& r)
: m_p(python::xincref(python::upcast<T>(r.get())))

View File

@@ -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<typename BasePolicy_::argument_package, mpl::int_<1> > argument_package;
};

View File

@@ -53,11 +53,7 @@ struct register_base_of
template <class Base>
inline void operator()(Base*) const
{
# if !BOOST_WORKAROUND(BOOST_MSVC, == 1200)
BOOST_MPL_ASSERT_NOT((is_same<Base,Derived>));
# else
BOOST_STATIC_ASSERT(!(is_same<Base,Derived>::value));
# endif
// Register the Base class
register_dynamic_id<Base>();

View File

@@ -12,13 +12,7 @@
# include <boost/ref.hpp>
# include <boost/python/detail/value_arg.hpp>
# include <boost/python/detail/copy_ctor_mutates_rhs.hpp>
# if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
# include <boost/type_traits/is_enum.hpp>
# include <boost/mpl/and.hpp>
# include <boost/mpl/not.hpp>
# else
# include <boost/mpl/or.hpp>
# endif
# include <boost/mpl/or.hpp>
namespace boost { namespace python { namespace objects {
@@ -42,17 +36,7 @@ struct reference_to_value
template <class T>
struct forward
: mpl::if_<
# if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
// vc6 chokes on unforwarding enums nested in classes
mpl::and_<
is_scalar<T>
, mpl::not_<
is_enum<T>
>
>
# else
mpl::or_<python::detail::copy_ctor_mutates_rhs<T>, is_scalar<T> >
# endif
, T
, reference_to_value<T>
>

View File

@@ -172,12 +172,6 @@ PyTypeObject opaque<Pointee>::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<Pointee>::type_object =
} \
}}
# endif
# endif // OPAQUE_POINTER_CONVERTER_HPP_

4
include/boost/python/other.hpp Executable file → Normal file
View File

@@ -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 <boost/config.hpp>

4
include/boost/python/proxy.hpp Executable file → Normal file
View File

@@ -15,11 +15,7 @@ class proxy : public object_operators<proxy<Policies> >
{
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;

View File

@@ -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 <boost/config.hpp>
# include <boost/mpl/bool.hpp>

View File

@@ -131,11 +131,7 @@ namespace boost { namespace python {
typedef detail::container_element<Container, Index, DerivedPolicies>
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

View File

@@ -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<Conversion> HasGetPytype;
#else
typedef boost::mpl::bool_<has_get_pytype> HasGetPytype;
#endif
static PyTypeObject const* get_pytype_1(boost::mpl::true_ *)
{

View File

@@ -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<T>*)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<void>()
{
@@ -183,8 +181,6 @@ inline type_info type_id<const volatile void>()
}
# endif
# endif
}} // namespace boost::python
#endif // TYPE_ID_DWA2002517_HPP

View File

@@ -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