Skip to content

Commit 0d81eb6

Browse files
committed
Boost.Python: * Workarounds for many SunCC 5.9 bugs * Suppression of many SunCC 5.9 warnings * Improve the style of some test invocations in Jamfile [SVN r41521]
1 parent e0b535d commit 0d81eb6

33 files changed

Lines changed: 113 additions & 91 deletions

include/boost/python/converter/rvalue_from_python_data.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,9 @@ struct rvalue_from_python_data : rvalue_from_python_storage<T>
117117
// Implementataions
118118
//
119119
template <class T>
120-
inline rvalue_from_python_data<T>::rvalue_from_python_data(rvalue_from_python_stage1_data const& stage1)
120+
inline rvalue_from_python_data<T>::rvalue_from_python_data(rvalue_from_python_stage1_data const& _stage1)
121121
{
122-
this->stage1 = stage1;
122+
this->stage1 = _stage1;
123123
}
124124

125125
template <class T>

include/boost/python/data_members.hpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -265,15 +265,17 @@ inline object make_getter(D const& d, Policies const& policies)
265265
template <class D>
266266
inline object make_getter(D& x)
267267
{
268-
detail::not_specified policy;
268+
detail::not_specified policy
269+
= detail::not_specified(); // suppress a SunPro warning
269270
return detail::make_getter(x, policy, is_member_pointer<D>(), 0L);
270271
}
271272

272273
# if !BOOST_WORKAROUND(__EDG_VERSION__, <= 238) && !BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
273274
template <class D>
274275
inline object make_getter(D const& d)
275276
{
276-
detail::not_specified policy;
277+
detail::not_specified policy
278+
= detail::not_specified(); // Suppress a SunPro warning
277279
return detail::make_getter(d, policy, is_member_pointer<D>(), 0L);
278280
}
279281
# endif

include/boost/python/object/class_metadata.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ struct class_metadata
236236
//
237237
// Support for converting smart pointers to python
238238
//
239-
inline static void maybe_register_pointer_to_python(void*,void*,void*) {}
239+
inline static void maybe_register_pointer_to_python(...) {}
240240

241241
#ifndef BOOST_PYTHON_NO_PY_SYGNATURES
242242
inline static void maybe_register_pointer_to_python(void*,void*,mpl::true_*)

include/boost/python/object/pointer_holder.hpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,14 @@ void* pointer_holder<Pointer, Value>::holds(type_info dst_t, bool null_ptr_only)
127127
)
128128
return &this->m_p;
129129

130-
Value* p = get_pointer(this->m_p);
130+
Value* p
131+
# if BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x590))
132+
= static_cast<Value*>( get_pointer(this->m_p) )
133+
# else
134+
= get_pointer(this->m_p)
135+
# endif
136+
;
137+
131138
if (p == 0)
132139
return 0;
133140

include/boost/python/object_protocol.hpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,45 +24,45 @@ namespace boost { namespace python { namespace api {
2424
# endif
2525

2626
template <class Target, class Key>
27-
object getattr(Target const& target, Key const& key BOOST_PYTHON_NO_ARRAY_ARG(key))
27+
object getattr(Target const& target, Key const& key BOOST_PYTHON_NO_ARRAY_ARG(Key))
2828
{
2929
return getattr(object(target), object(key));
3030
}
3131

3232
template <class Target, class Key, class Default>
33-
object getattr(Target const& target, Key const& key, Default const& default_ BOOST_PYTHON_NO_ARRAY_ARG(key))
33+
object getattr(Target const& target, Key const& key, Default const& default_ BOOST_PYTHON_NO_ARRAY_ARG(Key))
3434
{
3535
return getattr(object(target), object(key), object(default_));
3636
}
3737

3838

3939
template <class Key, class Value>
40-
void setattr(object const& target, Key const& key, Value const& value BOOST_PYTHON_NO_ARRAY_ARG(key))
40+
void setattr(object const& target, Key const& key, Value const& value BOOST_PYTHON_NO_ARRAY_ARG(Key))
4141
{
4242
setattr(target, object(key), object(value));
4343
}
4444

4545
template <class Key>
46-
void delattr(object const& target, Key const& key BOOST_PYTHON_NO_ARRAY_ARG(key))
46+
void delattr(object const& target, Key const& key BOOST_PYTHON_NO_ARRAY_ARG(Key))
4747
{
4848
delattr(target, object(key));
4949
}
5050

5151
template <class Target, class Key>
52-
object getitem(Target const& target, Key const& key BOOST_PYTHON_NO_ARRAY_ARG(key))
52+
object getitem(Target const& target, Key const& key BOOST_PYTHON_NO_ARRAY_ARG(Key))
5353
{
5454
return getitem(object(target), object(key));
5555
}
5656

5757

5858
template <class Key, class Value>
59-
void setitem(object const& target, Key const& key, Value const& value BOOST_PYTHON_NO_ARRAY_ARG(key))
59+
void setitem(object const& target, Key const& key, Value const& value BOOST_PYTHON_NO_ARRAY_ARG(Key))
6060
{
6161
setitem(target, object(key), object(value));
6262
}
6363

6464
template <class Key>
65-
void delitem(object const& target, Key const& key BOOST_PYTHON_NO_ARRAY_ARG(key))
65+
void delitem(object const& target, Key const& key BOOST_PYTHON_NO_ARRAY_ARG(Key))
6666
{
6767
delitem(target, object(key));
6868
}

include/boost/python/object_slices.hpp

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,12 @@ struct slice_policies : const_slice_policies
2727
static void del(object const& target, key_type const& key);
2828
};
2929

30+
template <class T, class U>
31+
inline slice_policies::key_type slice_key(T x, U y)
32+
{
33+
return slice_policies::key_type(handle<>(x), handle<>(y));
34+
}
35+
3036
//
3137
// implementation
3238
//
@@ -35,63 +41,63 @@ object_slice
3541
object_operators<U>::slice(object_cref start, object_cref finish)
3642
{
3743
object_cref2 x = *static_cast<U*>(this);
38-
return object_slice(x, std::make_pair(borrowed(start.ptr()), borrowed(finish.ptr())));
44+
return object_slice(x, api::slice_key(borrowed(start.ptr()), borrowed(finish.ptr())));
3945
}
4046

4147
template <class U>
4248
const_object_slice
4349
object_operators<U>::slice(object_cref start, object_cref finish) const
4450
{
4551
object_cref2 x = *static_cast<U const*>(this);
46-
return const_object_slice(x, std::make_pair(borrowed(start.ptr()), borrowed(finish.ptr())));
52+
return const_object_slice(x, api::slice_key(borrowed(start.ptr()), borrowed(finish.ptr())));
4753
}
4854

4955
template <class U>
5056
object_slice
5157
object_operators<U>::slice(slice_nil, object_cref finish)
5258
{
5359
object_cref2 x = *static_cast<U*>(this);
54-
return object_slice(x, std::make_pair(allow_null((PyObject*)0), borrowed(finish.ptr())));
60+
return object_slice(x, api::slice_key(allow_null((PyObject*)0), borrowed(finish.ptr())));
5561
}
5662

5763
template <class U>
5864
const_object_slice
5965
object_operators<U>::slice(slice_nil, object_cref finish) const
6066
{
6167
object_cref2 x = *static_cast<U const*>(this);
62-
return const_object_slice(x, std::make_pair(allow_null((PyObject*)0), borrowed(finish.ptr())));
68+
return const_object_slice(x, api::slice_key(allow_null((PyObject*)0), borrowed(finish.ptr())));
6369
}
6470

6571
template <class U>
6672
object_slice
6773
object_operators<U>::slice(slice_nil, slice_nil)
6874
{
6975
object_cref2 x = *static_cast<U*>(this);
70-
return object_slice(x, std::make_pair(allow_null((PyObject*)0), allow_null((PyObject*)0)));
76+
return object_slice(x, api::slice_key(allow_null((PyObject*)0), allow_null((PyObject*)0)));
7177
}
7278

7379
template <class U>
7480
const_object_slice
7581
object_operators<U>::slice(slice_nil, slice_nil) const
7682
{
7783
object_cref2 x = *static_cast<U const*>(this);
78-
return const_object_slice(x, std::make_pair(allow_null((PyObject*)0), allow_null((PyObject*)0)));
84+
return const_object_slice(x, api::slice_key(allow_null((PyObject*)0), allow_null((PyObject*)0)));
7985
}
8086

8187
template <class U>
8288
object_slice
8389
object_operators<U>::slice(object_cref start, slice_nil)
8490
{
8591
object_cref2 x = *static_cast<U*>(this);
86-
return object_slice(x, std::make_pair(borrowed(start.ptr()), allow_null((PyObject*)0)));
92+
return object_slice(x, api::slice_key(borrowed(start.ptr()), allow_null((PyObject*)0)));
8793
}
8894

8995
template <class U>
9096
const_object_slice
9197
object_operators<U>::slice(object_cref start, slice_nil) const
9298
{
9399
object_cref2 x = *static_cast<U const*>(this);
94-
return const_object_slice(x, std::make_pair(borrowed(start.ptr()), allow_null((PyObject*)0)));
100+
return const_object_slice(x, api::slice_key(borrowed(start.ptr()), allow_null((PyObject*)0)));
95101
}
96102
# if !defined(BOOST_MSVC) || BOOST_MSVC > 1300
97103
template <class U>

src/dict.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ namespace
2929
detail::new_reference dict_base::call(object const& arg_)
3030
{
3131
return (detail::new_reference)PyObject_CallFunction(
32-
(PyObject*)&PyDict_Type, "(O)",
32+
(PyObject*)&PyDict_Type, const_cast<char*>("(O)"),
3333
arg_.ptr());
3434
}
3535

src/exec.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ object BOOST_PYTHON_DECL exec_file(str filename, object global, object local)
3939
// should be 'char const *' but older python versions don't use 'const' yet.
4040
char *f = python::extract<char *>(filename);
4141
// Let python open the file to avoid potential binary incompatibilities.
42-
PyObject *pyfile = PyFile_FromString(f, "r");
42+
PyObject *pyfile = PyFile_FromString(f, const_cast<char*>("r"));
4343
if (!pyfile) throw std::invalid_argument(std::string(f) + " : no such file");
4444
python::handle<> file(pyfile);
4545
PyObject* result = PyRun_File(PyFile_AsFile(file.get()),

src/list.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ detail::new_non_null_reference list_base::call(object const& arg_)
1313
return (detail::new_non_null_reference)
1414
(expect_non_null)(
1515
PyObject_CallFunction(
16-
(PyObject*)&PyList_Type, "(O)",
16+
(PyObject*)&PyList_Type, const_cast<char*>("(O)"),
1717
arg_.ptr()));
1818
}
1919

src/long.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,21 @@ namespace boost { namespace python { namespace detail {
99
new_non_null_reference long_base::call(object const& arg_)
1010
{
1111
return (detail::new_non_null_reference)PyObject_CallFunction(
12-
(PyObject*)&PyLong_Type, "(O)",
12+
(PyObject*)&PyLong_Type, const_cast<char*>("(O)"),
1313
arg_.ptr());
1414
}
1515

1616
new_non_null_reference long_base::call(object const& arg_, object const& base)
1717
{
1818
return (detail::new_non_null_reference)PyObject_CallFunction(
19-
(PyObject*)&PyLong_Type, "(OO)",
19+
(PyObject*)&PyLong_Type, const_cast<char*>("(OO)"),
2020
arg_.ptr(), base.ptr());
2121
}
2222

2323
long_base::long_base()
2424
: object(
2525
detail::new_reference(
26-
PyObject_CallFunction((PyObject*)&PyLong_Type, "()"))
26+
PyObject_CallFunction((PyObject*)&PyLong_Type, const_cast<char*>("()")))
2727
)
2828
{}
2929

0 commit comments

Comments
 (0)