2
0
mirror of https://github.com/boostorg/python.git synced 2026-01-22 05:22:45 +00:00

merged from trunk: Workaround for gcc-3.4 quirks

[SVN r21507]
This commit is contained in:
Ralf W. Grosse-Kunstleve
2004-01-06 13:08:25 +00:00
parent 11df3bc2d3
commit 157343241c
4 changed files with 8 additions and 47 deletions

View File

@@ -41,19 +41,11 @@
namespace boost { namespace python { namespace detail {
# if 0 // argpkg
template <class N>
inline PyObject* get(N, PyObject* const& args_)
{
return PyTuple_GET_ITEM(args_,N::value);
}
# else
template <unsigned N>
inline PyObject* get(PyObject* const& args_ BOOST_APPEND_EXPLICIT_TEMPLATE_NON_TYPE(unsigned,N))
template <int N>
inline PyObject* get(mpl::int_<N>, PyObject* const& args_)
{
return PyTuple_GET_ITEM(args_,N);
}
# endif
inline unsigned arity(PyObject* const& args_)
{
@@ -106,21 +98,12 @@ struct caller;
# define BOOST_PYTHON_NEXT(init,name,n) \
typedef BOOST_PP_IF(n,typename BOOST_PP_CAT(name,BOOST_PP_DEC(n)) ::next, init) name##n;
# if 0 // argpkg
# define BOOST_PYTHON_ARG_CONVERTER(n) \
BOOST_PYTHON_NEXT(typename first::next, arg_iter,n) \
typedef arg_from_python<BOOST_DEDUCED_TYPENAME arg_iter##n::type> c_t##n; \
c_t##n c##n(get(mpl::int_<n>(), inner_args)); \
if (!c##n.convertible()) \
return 0;
# else
# define BOOST_PYTHON_ARG_CONVERTER(n) \
BOOST_PYTHON_NEXT(typename first::next, arg_iter,n) \
typedef arg_from_python<BOOST_DEDUCED_TYPENAME arg_iter##n::type> c_t##n; \
c_t##n c##n(get<n>(inner_args)); \
if (!c##n.convertible()) \
return 0;
# endif
# define BOOST_PP_ITERATION_PARAMS_1 \
(3, (0, BOOST_PYTHON_MAX_ARITY + 1, <boost/python/detail/caller.hpp>))

View File

@@ -85,19 +85,11 @@ namespace detail
BaseArgs base;
};
# if 0
template <class N, class BaseArgs, class Offset>
inline PyObject* get(N, offset_args<BaseArgs,Offset> const& args_)
template <int N, class BaseArgs, class Offset>
inline PyObject* get(mpl::int_<N>, offset_args<BaseArgs,Offset> const& args_)
{
return get(mpl::int_<(N::value+Offset::value)>(), args_.base);
return get(mpl::int_<(N+Offset::value)>(), args_.base);
}
# else
template <unsigned N, class BaseArgs, class Offset>
inline PyObject* get(offset_args<BaseArgs,Offset> const& args_ BOOST_APPEND_EXPLICIT_TEMPLATE_NON_TYPE(unsigned,N))
{
return get<(N + Offset::value)>(args_.base);
}
# endif
template <class BaseArgs, class Offset>
inline unsigned arity(offset_args<BaseArgs,Offset> const& args_)

View File

@@ -11,9 +11,7 @@
# include <boost/type_traits/add_reference.hpp>
# include <boost/type_traits/add_const.hpp>
# if 0 // argpkg
# include <boost/mpl/int.hpp>
# endif
# include <boost/mpl/int.hpp>
# include <boost/static_assert.hpp>
# include <boost/python/refcount.hpp>
@@ -86,11 +84,7 @@ struct return_arg : Base
if (!result)
return 0;
Py_DECREF(result);
# if 0 // argpkg
return incref( detail::get(mpl::int_<arg_pos-1>(),args) );
# else
return incref( detail::get<(arg_pos-1)>(args) );
# endif
}
};

View File

@@ -59,13 +59,9 @@ struct with_custodian_and_ward : BasePolicy_
return false;
}
# if 0 // argpkg
PyObject* patient = detail::get(mpl::int_<(ward-1)>(), args_);
PyObject* nurse = detail::get(mpl::int_<(custodian-1)>(), args_);
# else
PyObject* patient = detail::get<(ward-1)>(args_);
PyObject* nurse = detail::get<(custodian-1)>(args_);
# endif
PyObject* life_support = python::objects::make_nurse_and_patient(nurse, patient);
if (life_support == 0)
return false;
@@ -97,13 +93,9 @@ struct with_custodian_and_ward_postcall : BasePolicy_
return 0;
}
# if 0 // argpkg
PyObject* patient = ward > 0 ? detail::get(mpl::int_<(ward-1)>(),args_) : result;
PyObject* nurse = custodian > 0 ? detail::get(mpl::int_<(custodian-1)>(),args_) : result;
# else
PyObject* patient = detail::get_prev<ward>::execute(args_, result);
PyObject* nurse = detail::get_prev<custodian>::execute(args_, result);
# endif
if (nurse == 0) return 0;
result = BasePolicy_::postcall(args_, result);