From 157343241ced58ac419d5128a90fb727ab670aea Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Tue, 6 Jan 2004 13:08:25 +0000 Subject: [PATCH] merged from trunk: Workaround for gcc-3.4 quirks [SVN r21507] --- include/boost/python/detail/caller.hpp | 21 ++----------------- include/boost/python/make_constructor.hpp | 14 +++---------- include/boost/python/return_arg.hpp | 8 +------ .../boost/python/with_custodian_and_ward.hpp | 12 ++--------- 4 files changed, 8 insertions(+), 47 deletions(-) diff --git a/include/boost/python/detail/caller.hpp b/include/boost/python/detail/caller.hpp index 7682a91d..3a74b5ba 100644 --- a/include/boost/python/detail/caller.hpp +++ b/include/boost/python/detail/caller.hpp @@ -41,19 +41,11 @@ namespace boost { namespace python { namespace detail { -# if 0 // argpkg -template -inline PyObject* get(N, PyObject* const& args_) -{ - return PyTuple_GET_ITEM(args_,N::value); -} -# else -template -inline PyObject* get(PyObject* const& args_ BOOST_APPEND_EXPLICIT_TEMPLATE_NON_TYPE(unsigned,N)) +template +inline PyObject* get(mpl::int_, 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 c_t##n; \ c_t##n c##n(get(mpl::int_(), 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 c_t##n; \ - c_t##n c##n(get(inner_args)); \ - if (!c##n.convertible()) \ - return 0; -# endif # define BOOST_PP_ITERATION_PARAMS_1 \ (3, (0, BOOST_PYTHON_MAX_ARITY + 1, )) diff --git a/include/boost/python/make_constructor.hpp b/include/boost/python/make_constructor.hpp index ceaf4b9e..b4041578 100755 --- a/include/boost/python/make_constructor.hpp +++ b/include/boost/python/make_constructor.hpp @@ -85,19 +85,11 @@ namespace detail BaseArgs base; }; -# if 0 - template - inline PyObject* get(N, offset_args const& args_) + template + inline PyObject* get(mpl::int_, offset_args const& args_) { - return get(mpl::int_<(N::value+Offset::value)>(), args_.base); + return get(mpl::int_<(N+Offset::value)>(), args_.base); } -# else - template - inline PyObject* get(offset_args const& args_ BOOST_APPEND_EXPLICIT_TEMPLATE_NON_TYPE(unsigned,N)) - { - return get<(N + Offset::value)>(args_.base); - } -# endif template inline unsigned arity(offset_args const& args_) diff --git a/include/boost/python/return_arg.hpp b/include/boost/python/return_arg.hpp index 716c2664..7abe3559 100755 --- a/include/boost/python/return_arg.hpp +++ b/include/boost/python/return_arg.hpp @@ -11,9 +11,7 @@ # include # include -# if 0 // argpkg -# include -# endif +# include # include # include @@ -86,11 +84,7 @@ struct return_arg : Base if (!result) return 0; Py_DECREF(result); -# if 0 // argpkg return incref( detail::get(mpl::int_(),args) ); -# else - return incref( detail::get<(arg_pos-1)>(args) ); -# endif } }; diff --git a/include/boost/python/with_custodian_and_ward.hpp b/include/boost/python/with_custodian_and_ward.hpp index cf6727ca..01fd0d75 100644 --- a/include/boost/python/with_custodian_and_ward.hpp +++ b/include/boost/python/with_custodian_and_ward.hpp @@ -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::execute(args_, result); - PyObject* nurse = detail::get_prev::execute(args_, result); -# endif + if (nurse == 0) return 0; result = BasePolicy_::postcall(args_, result);