Skip to content

Commit 4405995

Browse files
committed
Workaround for gcc-3.4 quirks
[SVN r21493]
1 parent 44ba088 commit 4405995

5 files changed

Lines changed: 14 additions & 51 deletions

File tree

include/boost/python/converter/rvalue_from_python_data.hpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,12 @@ struct rvalue_from_python_storage
9292
template <class T>
9393
struct rvalue_from_python_data : rvalue_from_python_storage<T>
9494
{
95-
# if (!defined(__MWERKS__) || __MWERKS__ >= 0x3000) \
96-
&& (!defined(__EDG_VERSION__) || __EDG_VERSION__ >= 245) \
97-
&& (!defined(__DECCXX_VER) || __DECCXX_VER > 60590014) \
98-
&& !defined(BOOST_PYTHON_SYNOPSIS) /* Synopsis' OpenCXX has trouble parsing this */
95+
# if (!defined(__MWERKS__) || __MWERKS__ >= 0x3000) \
96+
&& (!defined(__EDG_VERSION__) || __EDG_VERSION__ >= 245) \
97+
&& (!defined(__DECCXX_VER) || __DECCXX_VER > 60590014) \
98+
&& !defined(BOOST_PYTHON_SYNOPSIS) /* Synopsis' OpenCXX has trouble parsing this */ \
99+
&& !(BOOST_WORKAROUND(__GNUC__, == 3) && BOOST_WORKAROUND(__GNUC_MINOR__, == 4))
100+
99101
// This must always be a POD struct with m_data its first member.
100102
BOOST_STATIC_ASSERT(BOOST_PYTHON_OFFSETOF(rvalue_from_python_storage<T>,stage1) == 0);
101103
# endif

include/boost/python/detail/caller.hpp

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -41,19 +41,11 @@
4141

4242
namespace boost { namespace python { namespace detail {
4343

44-
# if 0 // argpkg
45-
template <class N>
46-
inline PyObject* get(N, PyObject* const& args_)
47-
{
48-
return PyTuple_GET_ITEM(args_,N::value);
49-
}
50-
# else
51-
template <unsigned N>
52-
inline PyObject* get(PyObject* const& args_ BOOST_APPEND_EXPLICIT_TEMPLATE_NON_TYPE(unsigned,N))
44+
template <int N>
45+
inline PyObject* get(mpl::int_<N>, PyObject* const& args_)
5346
{
5447
return PyTuple_GET_ITEM(args_,N);
5548
}
56-
# endif
5749

5850
inline unsigned arity(PyObject* const& args_)
5951
{
@@ -106,21 +98,12 @@ struct caller;
10698
# define BOOST_PYTHON_NEXT(init,name,n) \
10799
typedef BOOST_PP_IF(n,typename BOOST_PP_CAT(name,BOOST_PP_DEC(n)) ::next, init) name##n;
108100

109-
# if 0 // argpkg
110101
# define BOOST_PYTHON_ARG_CONVERTER(n) \
111102
BOOST_PYTHON_NEXT(typename first::next, arg_iter,n) \
112103
typedef arg_from_python<BOOST_DEDUCED_TYPENAME arg_iter##n::type> c_t##n; \
113104
c_t##n c##n(get(mpl::int_<n>(), inner_args)); \
114105
if (!c##n.convertible()) \
115106
return 0;
116-
# else
117-
# define BOOST_PYTHON_ARG_CONVERTER(n) \
118-
BOOST_PYTHON_NEXT(typename first::next, arg_iter,n) \
119-
typedef arg_from_python<BOOST_DEDUCED_TYPENAME arg_iter##n::type> c_t##n; \
120-
c_t##n c##n(get<n>(inner_args)); \
121-
if (!c##n.convertible()) \
122-
return 0;
123-
# endif
124107

125108
# define BOOST_PP_ITERATION_PARAMS_1 \
126109
(3, (0, BOOST_PYTHON_MAX_ARITY + 1, <boost/python/detail/caller.hpp>))

include/boost/python/make_constructor.hpp

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -85,19 +85,11 @@ namespace detail
8585
BaseArgs base;
8686
};
8787

88-
# if 0
89-
template <class N, class BaseArgs, class Offset>
90-
inline PyObject* get(N, offset_args<BaseArgs,Offset> const& args_)
88+
template <int N, class BaseArgs, class Offset>
89+
inline PyObject* get(mpl::int_<N>, offset_args<BaseArgs,Offset> const& args_)
9190
{
92-
return get(mpl::int_<(N::value+Offset::value)>(), args_.base);
91+
return get(mpl::int_<(N+Offset::value)>(), args_.base);
9392
}
94-
# else
95-
template <unsigned N, class BaseArgs, class Offset>
96-
inline PyObject* get(offset_args<BaseArgs,Offset> const& args_ BOOST_APPEND_EXPLICIT_TEMPLATE_NON_TYPE(unsigned,N))
97-
{
98-
return get<(N + Offset::value)>(args_.base);
99-
}
100-
# endif
10193

10294
template <class BaseArgs, class Offset>
10395
inline unsigned arity(offset_args<BaseArgs,Offset> const& args_)

include/boost/python/return_arg.hpp

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,7 @@
1111
# include <boost/type_traits/add_reference.hpp>
1212
# include <boost/type_traits/add_const.hpp>
1313

14-
# if 0 // argpkg
15-
# include <boost/mpl/int.hpp>
16-
# endif
14+
# include <boost/mpl/int.hpp>
1715

1816
# include <boost/static_assert.hpp>
1917
# include <boost/python/refcount.hpp>
@@ -86,11 +84,7 @@ struct return_arg : Base
8684
if (!result)
8785
return 0;
8886
Py_DECREF(result);
89-
# if 0 // argpkg
9087
return incref( detail::get(mpl::int_<arg_pos-1>(),args) );
91-
# else
92-
return incref( detail::get<(arg_pos-1)>(args) );
93-
# endif
9488
}
9589
};
9690

include/boost/python/with_custodian_and_ward.hpp

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,9 @@ struct with_custodian_and_ward : BasePolicy_
5959
return false;
6060
}
6161

62-
# if 0 // argpkg
6362
PyObject* patient = detail::get(mpl::int_<(ward-1)>(), args_);
6463
PyObject* nurse = detail::get(mpl::int_<(custodian-1)>(), args_);
65-
# else
66-
PyObject* patient = detail::get<(ward-1)>(args_);
67-
PyObject* nurse = detail::get<(custodian-1)>(args_);
68-
# endif
64+
6965
PyObject* life_support = python::objects::make_nurse_and_patient(nurse, patient);
7066
if (life_support == 0)
7167
return false;
@@ -97,13 +93,9 @@ struct with_custodian_and_ward_postcall : BasePolicy_
9793
return 0;
9894
}
9995

100-
# if 0 // argpkg
10196
PyObject* patient = ward > 0 ? detail::get(mpl::int_<(ward-1)>(),args_) : result;
10297
PyObject* nurse = custodian > 0 ? detail::get(mpl::int_<(custodian-1)>(),args_) : result;
103-
# else
104-
PyObject* patient = detail::get_prev<ward>::execute(args_, result);
105-
PyObject* nurse = detail::get_prev<custodian>::execute(args_, result);
106-
# endif
98+
10799
if (nurse == 0) return 0;
108100

109101
result = BasePolicy_::postcall(args_, result);

0 commit comments

Comments
 (0)