From 440599545f174a6dae107345ad4a2a8fa99c54a7 Mon Sep 17 00:00:00 2001 From: Dave Abrahams Date: Mon, 5 Jan 2004 11:46:30 +0000 Subject: [PATCH] Workaround for gcc-3.4 quirks [SVN r21493] --- .../converter/rvalue_from_python_data.hpp | 10 +++++---- 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 ++--------- 5 files changed, 14 insertions(+), 51 deletions(-) diff --git a/include/boost/python/converter/rvalue_from_python_data.hpp b/include/boost/python/converter/rvalue_from_python_data.hpp index 91b5afd8..68df5792 100644 --- a/include/boost/python/converter/rvalue_from_python_data.hpp +++ b/include/boost/python/converter/rvalue_from_python_data.hpp @@ -92,10 +92,12 @@ struct rvalue_from_python_storage template struct rvalue_from_python_data : rvalue_from_python_storage { -# if (!defined(__MWERKS__) || __MWERKS__ >= 0x3000) \ - && (!defined(__EDG_VERSION__) || __EDG_VERSION__ >= 245) \ - && (!defined(__DECCXX_VER) || __DECCXX_VER > 60590014) \ - && !defined(BOOST_PYTHON_SYNOPSIS) /* Synopsis' OpenCXX has trouble parsing this */ +# if (!defined(__MWERKS__) || __MWERKS__ >= 0x3000) \ + && (!defined(__EDG_VERSION__) || __EDG_VERSION__ >= 245) \ + && (!defined(__DECCXX_VER) || __DECCXX_VER > 60590014) \ + && !defined(BOOST_PYTHON_SYNOPSIS) /* Synopsis' OpenCXX has trouble parsing this */ \ + && !(BOOST_WORKAROUND(__GNUC__, == 3) && BOOST_WORKAROUND(__GNUC_MINOR__, == 4)) + // This must always be a POD struct with m_data its first member. BOOST_STATIC_ASSERT(BOOST_PYTHON_OFFSETOF(rvalue_from_python_storage,stage1) == 0); # endif 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);