Skip to content

Commit

Permalink
Python: Clean up some old MSVC related code.
Browse files Browse the repository at this point in the history
[SVN r85922]
  • Loading branch information
steveire committed Sep 25, 2013
1 parent 5476f97 commit 42e7d7b
Show file tree
Hide file tree
Showing 24 changed files with 18 additions and 271 deletions.
42 changes: 0 additions & 42 deletions include/boost/python/class.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand All @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions include/boost/python/converter/arg_from_python.hpp
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
8 changes: 0 additions & 8 deletions include/boost/python/converter/arg_to_python_base.hpp
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -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
};
}

Expand Down
4 changes: 2 additions & 2 deletions include/boost/python/data_members.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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)
{
Expand Down
3 changes: 0 additions & 3 deletions include/boost/python/detail/config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 1 addition & 7 deletions include/boost/python/detail/construct.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
49 changes: 3 additions & 46 deletions include/boost/python/detail/destroy.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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);
}
}
Expand All @@ -63,35 +42,13 @@ 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& (*)())
{
// note: cv-qualification needed for MSVC6
// 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);
}

Expand Down
35 changes: 1 addition & 34 deletions include/boost/python/detail/enable_if.hpp
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
14 changes: 0 additions & 14 deletions include/boost/python/detail/force_instantiate.hpp
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -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
39 changes: 2 additions & 37 deletions include/boost/python/detail/if_else.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -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>
Expand Down
4 changes: 1 addition & 3 deletions include/boost/python/detail/result.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions include/boost/python/extract.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 0 additions & 4 deletions include/boost/python/handle.hpp
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand All @@ -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())))
Expand Down
Loading

0 comments on commit 42e7d7b

Please sign in to comment.