From b841d1eadfab6bb70b6b21e4d719cbddce4b02c2 Mon Sep 17 00:00:00 2001 From: Eric Niebler Date: Sun, 2 Dec 2007 23:20:06 +0000 Subject: [PATCH] Merged revisions 41488-41595 via svnmerge from https://svn.boost.org/svn/boost/trunk ........ r41489 | djowel | 2007-11-30 02:07:41 -0800 (Fri, 30 Nov 2007) | 1 line fixed link ........ r41493 | grafik | 2007-11-30 07:56:42 -0800 (Fri, 30 Nov 2007) | 1 line Mode proposal.pdf to new web site. (fixes #1364) ........ r41494 | grafik | 2007-11-30 07:58:59 -0800 (Fri, 30 Nov 2007) | 1 line Obsolete. (fixes #1362) ........ r41497 | grafik | 2007-11-30 08:21:49 -0800 (Fri, 30 Nov 2007) | 1 line Move the content of old more/links.html doc to new web site. (fixes #1360). ........ r41500 | bemandawes | 2007-11-30 08:44:23 -0800 (Fri, 30 Nov 2007) | 1 line Refresh examples, add example build script, reflect that in docs. Apply suggestions from Darren Cook. ........ r41501 | grafik | 2007-11-30 09:13:02 -0800 (Fri, 30 Nov 2007) | 1 line Obsolete. (fixes #1365) ........ r41502 | grafik | 2007-11-30 09:16:00 -0800 (Fri, 30 Nov 2007) | 1 line Obsolete. (fixes #1348) ........ r41504 | grafik | 2007-11-30 09:45:24 -0800 (Fri, 30 Nov 2007) | 1 line Obsolete. (fixes #1345) ........ r41505 | anthonyw | 2007-11-30 10:38:21 -0800 (Fri, 30 Nov 2007) | 1 line interruptible_wait (and hence condition timed_wait) now uses a WaitableTimer where possible, to be robust in the face of clock changes ........ r41506 | danieljames | 2007-11-30 11:28:46 -0800 (Fri, 30 Nov 2007) | 2 lines Frank Mori Hess's patch to get the documentation building. ........ r41511 | danieljames | 2007-11-30 12:06:44 -0800 (Fri, 30 Nov 2007) | 3 lines Remove the formal review schedule, as it has been moved to the new site. Fixes #1351 ........ r41519 | djowel | 2007-11-30 17:11:44 -0800 (Fri, 30 Nov 2007) | 1 line remove old unused file ........ r41521 | dave | 2007-11-30 18:15:17 -0800 (Fri, 30 Nov 2007) | 7 lines 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 ........ r41526 | dave | 2007-11-30 21:07:13 -0800 (Fri, 30 Nov 2007) | 2 lines Fixed grammar in error message ........ r41529 | niels_dekker | 2007-12-01 04:14:37 -0800 (Sat, 01 Dec 2007) | 1 line Added value_init tests, based upon GCC bug report by Jonathan Wakely. Added URL to Borland bug report. ........ r41530 | niels_dekker | 2007-12-01 05:57:06 -0800 (Sat, 01 Dec 2007) | 1 line Marked value_init_test failures on GCC as "expected failures", referring to ticket #1491 ........ r41532 | vladimir_prus | 2007-12-01 06:56:23 -0800 (Sat, 01 Dec 2007) | 2 lines Change the detection of 64-bit windows to handle EM64T processors. ........ r41534 | danieljames | 2007-12-01 08:44:20 -0800 (Sat, 01 Dec 2007) | 4 lines Transfer the rest of the version history to the new website. Fixes #1374. ........ r41535 | grafik | 2007-12-01 08:44:54 -0800 (Sat, 01 Dec 2007) | 1 line Plug memory leak when closing out actions. Thanks to Martin Kortmann for finding this. ........ r41538 | vladimir_prus | 2007-12-01 09:56:47 -0800 (Sat, 01 Dec 2007) | 2 lines Document 64-bit compilation. ........ r41539 | danieljames | 2007-12-01 09:58:44 -0800 (Sat, 01 Dec 2007) | 2 lines Mark hash_long_double_test as failing on all PA-RISC compilers. ........ r41540 | igaztanaga | 2007-12-01 10:01:15 -0800 (Sat, 01 Dec 2007) | 1 line Simplified mutexes for systems with no _POSIX_TIMEOUTS. ........ r41542 | vladimir_prus | 2007-12-01 11:07:22 -0800 (Sat, 01 Dec 2007) | 4 lines Add functionality to unit-test rule. Patch from Mark Desnoyer. ........ r41544 | jhunold | 2007-12-01 11:27:06 -0800 (Sat, 01 Dec 2007) | 2 lines Silence compiler by adding cosmetic virtual destructors. ........ r41547 | vladimir_prus | 2007-12-01 12:06:43 -0800 (Sat, 01 Dec 2007) | 1 line Document runtime-link ........ r41548 | grafik | 2007-12-01 12:17:52 -0800 (Sat, 01 Dec 2007) | 1 line Add support for detection and building with vc9. (fixes #1490) ........ r41549 | jhunold | 2007-12-01 12:24:51 -0800 (Sat, 01 Dec 2007) | 2 lines Silence compiler by adding cosmetic virtual destructors. ........ r41550 | jhunold | 2007-12-01 12:26:37 -0800 (Sat, 01 Dec 2007) | 3 lines Remove unused paramters. Add -Wextra to gcc flags to enable more warnings. ........ r41552 | grafik | 2007-12-01 12:40:56 -0800 (Sat, 01 Dec 2007) | 1 line Remove borders from simple list tables. ........ r41553 | grafik | 2007-12-01 12:42:27 -0800 (Sat, 01 Dec 2007) | 1 line Remove borders from simple list tables. ........ r41554 | t_schwinger | 2007-12-01 12:52:00 -0800 (Sat, 01 Dec 2007) | 3 lines Using central stylesheet now. ........ r41555 | vladimir_prus | 2007-12-01 13:26:09 -0800 (Sat, 01 Dec 2007) | 1 line Document STLport ........ r41556 | grafik | 2007-12-01 13:53:47 -0800 (Sat, 01 Dec 2007) | 1 line Document various "new" features, and add in the history till now for 3.1.16. (fixes #1445 #1447 #1448) ........ r41557 | vladimir_prus | 2007-12-01 14:31:04 -0800 (Sat, 01 Dec 2007) | 1 line Remove unused method ........ r41562 | grafik | 2007-12-01 17:59:02 -0800 (Sat, 01 Dec 2007) | 1 line No-op no-empty action. ........ r41563 | grafik | 2007-12-01 18:03:48 -0800 (Sat, 01 Dec 2007) | 1 line ';' can't be a no-op on nix. ........ r41565 | grafik | 2007-12-01 20:06:28 -0800 (Sat, 01 Dec 2007) | 1 line Remove outdated release procedures, and move content to wiki. Content moved to and . (fixes #1366 #1367) ........ r41566 | grafik | 2007-12-01 20:22:34 -0800 (Sat, 01 Dec 2007) | 1 line Remove obsolete images. (fixes #1257) ........ r41568 | grafik | 2007-12-01 22:56:38 -0800 (Sat, 01 Dec 2007) | 1 line "Who's Using Boost?" content moved to new web site. ........ r41569 | grafik | 2007-12-01 23:02:12 -0800 (Sat, 01 Dec 2007) | 1 line "Who's Using Boost?" content moved to new web site. ........ r41571 | igaztanaga | 2007-12-02 01:25:53 -0800 (Sun, 02 Dec 2007) | 1 line Added missing #include overwritten by previous commit ........ r41572 | danieljames | 2007-12-02 01:59:15 -0800 (Sun, 02 Dec 2007) | 1 line Add some parameters to the standalone hash build. ........ r41574 | danieljames | 2007-12-02 02:23:58 -0800 (Sun, 02 Dec 2007) | 2 lines Initialise svnmerge. ........ r41575 | danieljames | 2007-12-02 02:25:22 -0800 (Sun, 02 Dec 2007) | 1 line Fix the navbar links. ........ r41577 | jhunold | 2007-12-02 03:51:08 -0800 (Sun, 02 Dec 2007) | 3 lines Revert revisions 41544 and 41549. See http://lists.boost.org/Archives/boost/2007/12/131116.php for details. ........ r41580 | danieljames | 2007-12-02 05:47:31 -0800 (Sun, 02 Dec 2007) | 2 lines Revert a change I mean to make on the fix-links branch. ........ r41582 | danieljames | 2007-12-02 06:15:25 -0800 (Sun, 02 Dec 2007) | 5 lines Remove formal_review_process, it looks like I forgot to when I updated the version in the new site. Refs #1350. ........ r41587 | grafik | 2007-12-02 09:03:43 -0800 (Sun, 02 Dec 2007) | 1 line Obsolete. ........ r41588 | hkaiser | 2007-12-02 09:18:54 -0800 (Sun, 02 Dec 2007) | 1 line Applied patch supplied by Jens Seidel. Fixed #1410. ........ r41590 | hkaiser | 2007-12-02 11:08:13 -0800 (Sun, 02 Dec 2007) | 1 line Wave: More fixes to allow error free compilation of every header on its own. ........ r41592 | grafik | 2007-12-02 12:15:25 -0800 (Sun, 02 Dec 2007) | 1 line Support building of universal binaries using architecture options. Thanks to Mat Marcus. (fixes #552 #1342 #989) ........ r41593 | niels_dekker | 2007-12-02 14:10:45 -0800 (Sun, 02 Dec 2007) | 1 line Added missing GCC version (4.0) to expected GCC failures of value_init_test ........ [SVN r41596] --- .../converter/rvalue_from_python_data.hpp | 4 +-- include/boost/python/data_members.hpp | 6 ++-- include/boost/python/detail/result.hpp | 4 +-- include/boost/python/detail/unwind_type.hpp | 2 +- .../boost/python/object/class_metadata.hpp | 2 +- .../boost/python/object/pointer_holder.hpp | 9 ++++- include/boost/python/object_protocol.hpp | 14 ++++---- include/boost/python/object_slices.hpp | 22 +++++++----- include/boost/python/to_python_value.hpp | 4 +-- src/dict.cpp | 2 +- src/exec.cpp | 2 +- src/list.cpp | 2 +- src/long.cpp | 6 ++-- src/object/class.cpp | 36 +++++++++---------- src/object/enum.cpp | 6 ++-- src/object/function.cpp | 21 +++++------ src/object/life_support.cpp | 2 +- src/str.cpp | 7 ++-- src/tuple.cpp | 2 +- test/Jamfile.v2 | 10 ++++-- test/andreas_beyer.cpp | 4 +-- test/back_reference.cpp | 2 +- test/borrowed.cpp | 4 +-- test/callbacks.cpp | 2 +- test/complicated.hpp | 6 ++-- test/exec.cpp | 2 +- test/m1.cpp | 6 ++-- test/numpy.cpp | 4 +-- test/operators_wrapper.cpp | 4 +-- test/pickle1.cpp | 4 +-- test/pickle2.cpp | 4 +-- test/pickle3.cpp | 4 +-- test/pickle4.cpp | 4 +-- test/slice.cpp | 6 +++- test/staticmethod.cpp | 2 +- test/test_class.hpp | 2 +- test/test_pointer_adoption.cpp | 2 +- test/virtual_functions.cpp | 2 +- 38 files changed, 126 insertions(+), 101 deletions(-) diff --git a/include/boost/python/converter/rvalue_from_python_data.hpp b/include/boost/python/converter/rvalue_from_python_data.hpp index 7d2b3e07..471a5255 100644 --- a/include/boost/python/converter/rvalue_from_python_data.hpp +++ b/include/boost/python/converter/rvalue_from_python_data.hpp @@ -117,9 +117,9 @@ struct rvalue_from_python_data : rvalue_from_python_storage // Implementataions // template -inline rvalue_from_python_data::rvalue_from_python_data(rvalue_from_python_stage1_data const& stage1) +inline rvalue_from_python_data::rvalue_from_python_data(rvalue_from_python_stage1_data const& _stage1) { - this->stage1 = stage1; + this->stage1 = _stage1; } template diff --git a/include/boost/python/data_members.hpp b/include/boost/python/data_members.hpp index 8cbc0ac3..b0851fb1 100644 --- a/include/boost/python/data_members.hpp +++ b/include/boost/python/data_members.hpp @@ -265,7 +265,8 @@ inline object make_getter(D const& d, Policies const& policies) template inline object make_getter(D& x) { - detail::not_specified policy; + detail::not_specified policy + = detail::not_specified(); // suppress a SunPro warning return detail::make_getter(x, policy, is_member_pointer(), 0L); } @@ -273,7 +274,8 @@ inline object make_getter(D& x) template inline object make_getter(D const& d) { - detail::not_specified policy; + detail::not_specified policy + = detail::not_specified(); // Suppress a SunPro warning return detail::make_getter(d, policy, is_member_pointer(), 0L); } # endif diff --git a/include/boost/python/detail/result.hpp b/include/boost/python/detail/result.hpp index 9e322dd7..80e4387f 100755 --- a/include/boost/python/detail/result.hpp +++ b/include/boost/python/detail/result.hpp @@ -95,7 +95,7 @@ result(X const&, short = 0) { return 0; } # define N BOOST_PP_ITERATION() template -boost::type* result(R (*pf)(BOOST_PP_ENUM_PARAMS_Z(1, N, A)), int = 0) +boost::type* result(R (*)(BOOST_PP_ENUM_PARAMS_Z(1, N, A)), int = 0) { return 0; } @@ -120,7 +120,7 @@ boost::type* result(R (*pf)(BOOST_PP_ENUM_PARAMS_Z(1, N, A)), int = 0) # define Q BOOST_PYTHON_CV_QUALIFIER(BOOST_PP_RELATIVE_ITERATION(1)) template -boost::type* result(R (T::*pmf)(BOOST_PP_ENUM_PARAMS_Z(1, N, A)) Q, int = 0) +boost::type* result(R (T::*)(BOOST_PP_ENUM_PARAMS_Z(1, N, A)) Q, int = 0) { return 0; } diff --git a/include/boost/python/detail/unwind_type.hpp b/include/boost/python/detail/unwind_type.hpp index 3c6f8ca2..9a997c9d 100755 --- a/include/boost/python/detail/unwind_type.hpp +++ b/include/boost/python/detail/unwind_type.hpp @@ -149,7 +149,7 @@ struct unwind_helper2 template inline typename Generator::result_type #ifndef _MSC_VER -unwind_type(boost::type*p, Generator*) +unwind_type(boost::type*, Generator*) #else unwind_type(boost::type*p =0, Generator* =0) #endif diff --git a/include/boost/python/object/class_metadata.hpp b/include/boost/python/object/class_metadata.hpp index 05740b8e..0738bbe3 100755 --- a/include/boost/python/object/class_metadata.hpp +++ b/include/boost/python/object/class_metadata.hpp @@ -236,7 +236,7 @@ struct class_metadata // // Support for converting smart pointers to python // - inline static void maybe_register_pointer_to_python(void*,void*,void*) {} + inline static void maybe_register_pointer_to_python(...) {} #ifndef BOOST_PYTHON_NO_PY_SYGNATURES inline static void maybe_register_pointer_to_python(void*,void*,mpl::true_*) diff --git a/include/boost/python/object/pointer_holder.hpp b/include/boost/python/object/pointer_holder.hpp index 7fad2a25..9019a185 100644 --- a/include/boost/python/object/pointer_holder.hpp +++ b/include/boost/python/object/pointer_holder.hpp @@ -127,7 +127,14 @@ void* pointer_holder::holds(type_info dst_t, bool null_ptr_only) ) return &this->m_p; - Value* p = get_pointer(this->m_p); + Value* p +# if BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x590)) + = static_cast( get_pointer(this->m_p) ) +# else + = get_pointer(this->m_p) +# endif + ; + if (p == 0) return 0; diff --git a/include/boost/python/object_protocol.hpp b/include/boost/python/object_protocol.hpp index 85ebf87f..7c1c0283 100755 --- a/include/boost/python/object_protocol.hpp +++ b/include/boost/python/object_protocol.hpp @@ -24,45 +24,45 @@ namespace boost { namespace python { namespace api { # endif template -object getattr(Target const& target, Key const& key BOOST_PYTHON_NO_ARRAY_ARG(key)) +object getattr(Target const& target, Key const& key BOOST_PYTHON_NO_ARRAY_ARG(Key)) { return getattr(object(target), object(key)); } template -object getattr(Target const& target, Key const& key, Default const& default_ BOOST_PYTHON_NO_ARRAY_ARG(key)) +object getattr(Target const& target, Key const& key, Default const& default_ BOOST_PYTHON_NO_ARRAY_ARG(Key)) { return getattr(object(target), object(key), object(default_)); } template -void setattr(object const& target, Key const& key, Value const& value BOOST_PYTHON_NO_ARRAY_ARG(key)) +void setattr(object const& target, Key const& key, Value const& value BOOST_PYTHON_NO_ARRAY_ARG(Key)) { setattr(target, object(key), object(value)); } template -void delattr(object const& target, Key const& key BOOST_PYTHON_NO_ARRAY_ARG(key)) +void delattr(object const& target, Key const& key BOOST_PYTHON_NO_ARRAY_ARG(Key)) { delattr(target, object(key)); } template -object getitem(Target const& target, Key const& key BOOST_PYTHON_NO_ARRAY_ARG(key)) +object getitem(Target const& target, Key const& key BOOST_PYTHON_NO_ARRAY_ARG(Key)) { return getitem(object(target), object(key)); } template -void setitem(object const& target, Key const& key, Value const& value BOOST_PYTHON_NO_ARRAY_ARG(key)) +void setitem(object const& target, Key const& key, Value const& value BOOST_PYTHON_NO_ARRAY_ARG(Key)) { setitem(target, object(key), object(value)); } template -void delitem(object const& target, Key const& key BOOST_PYTHON_NO_ARRAY_ARG(key)) +void delitem(object const& target, Key const& key BOOST_PYTHON_NO_ARRAY_ARG(Key)) { delitem(target, object(key)); } diff --git a/include/boost/python/object_slices.hpp b/include/boost/python/object_slices.hpp index e70faff7..748c2e95 100644 --- a/include/boost/python/object_slices.hpp +++ b/include/boost/python/object_slices.hpp @@ -27,6 +27,12 @@ struct slice_policies : const_slice_policies static void del(object const& target, key_type const& key); }; +template +inline slice_policies::key_type slice_key(T x, U y) +{ + return slice_policies::key_type(handle<>(x), handle<>(y)); +} + // // implementation // @@ -35,7 +41,7 @@ object_slice object_operators::slice(object_cref start, object_cref finish) { object_cref2 x = *static_cast(this); - return object_slice(x, std::make_pair(borrowed(start.ptr()), borrowed(finish.ptr()))); + return object_slice(x, api::slice_key(borrowed(start.ptr()), borrowed(finish.ptr()))); } template @@ -43,7 +49,7 @@ const_object_slice object_operators::slice(object_cref start, object_cref finish) const { object_cref2 x = *static_cast(this); - return const_object_slice(x, std::make_pair(borrowed(start.ptr()), borrowed(finish.ptr()))); + return const_object_slice(x, api::slice_key(borrowed(start.ptr()), borrowed(finish.ptr()))); } template @@ -51,7 +57,7 @@ object_slice object_operators::slice(slice_nil, object_cref finish) { object_cref2 x = *static_cast(this); - return object_slice(x, std::make_pair(allow_null((PyObject*)0), borrowed(finish.ptr()))); + return object_slice(x, api::slice_key(allow_null((PyObject*)0), borrowed(finish.ptr()))); } template @@ -59,7 +65,7 @@ const_object_slice object_operators::slice(slice_nil, object_cref finish) const { object_cref2 x = *static_cast(this); - return const_object_slice(x, std::make_pair(allow_null((PyObject*)0), borrowed(finish.ptr()))); + return const_object_slice(x, api::slice_key(allow_null((PyObject*)0), borrowed(finish.ptr()))); } template @@ -67,7 +73,7 @@ object_slice object_operators::slice(slice_nil, slice_nil) { object_cref2 x = *static_cast(this); - return object_slice(x, std::make_pair(allow_null((PyObject*)0), allow_null((PyObject*)0))); + return object_slice(x, api::slice_key(allow_null((PyObject*)0), allow_null((PyObject*)0))); } template @@ -75,7 +81,7 @@ const_object_slice object_operators::slice(slice_nil, slice_nil) const { object_cref2 x = *static_cast(this); - return const_object_slice(x, std::make_pair(allow_null((PyObject*)0), allow_null((PyObject*)0))); + return const_object_slice(x, api::slice_key(allow_null((PyObject*)0), allow_null((PyObject*)0))); } template @@ -83,7 +89,7 @@ object_slice object_operators::slice(object_cref start, slice_nil) { object_cref2 x = *static_cast(this); - return object_slice(x, std::make_pair(borrowed(start.ptr()), allow_null((PyObject*)0))); + return object_slice(x, api::slice_key(borrowed(start.ptr()), allow_null((PyObject*)0))); } template @@ -91,7 +97,7 @@ const_object_slice object_operators::slice(object_cref start, slice_nil) const { object_cref2 x = *static_cast(this); - return const_object_slice(x, std::make_pair(borrowed(start.ptr()), allow_null((PyObject*)0))); + return const_object_slice(x, api::slice_key(borrowed(start.ptr()), allow_null((PyObject*)0))); } # if !defined(BOOST_MSVC) || BOOST_MSVC > 1300 template diff --git a/include/boost/python/to_python_value.hpp b/include/boost/python/to_python_value.hpp index c40299ba..a48948d2 100644 --- a/include/boost/python/to_python_value.hpp +++ b/include/boost/python/to_python_value.hpp @@ -36,7 +36,7 @@ template struct object_manager_get_pytype { template - static PyTypeObject const* get( U& (*p)() =0) + static PyTypeObject const* get( U& (*)() =0) { return converter::object_manager_traits::get_pytype(); } @@ -46,7 +46,7 @@ template <> struct object_manager_get_pytype { template - static PyTypeObject const* get( U const& (*p)() =0) + static PyTypeObject const* get( U const& (*)() =0) { return converter::object_manager_traits::get_pytype(); } diff --git a/src/dict.cpp b/src/dict.cpp index ee2ee29f..441b0257 100644 --- a/src/dict.cpp +++ b/src/dict.cpp @@ -29,7 +29,7 @@ namespace detail::new_reference dict_base::call(object const& arg_) { return (detail::new_reference)PyObject_CallFunction( - (PyObject*)&PyDict_Type, "(O)", + (PyObject*)&PyDict_Type, const_cast("(O)"), arg_.ptr()); } diff --git a/src/exec.cpp b/src/exec.cpp index 050cc63e..6c30797a 100644 --- a/src/exec.cpp +++ b/src/exec.cpp @@ -39,7 +39,7 @@ object BOOST_PYTHON_DECL exec_file(str filename, object global, object local) // should be 'char const *' but older python versions don't use 'const' yet. char *f = python::extract(filename); // Let python open the file to avoid potential binary incompatibilities. - PyObject *pyfile = PyFile_FromString(f, "r"); + PyObject *pyfile = PyFile_FromString(f, const_cast("r")); if (!pyfile) throw std::invalid_argument(std::string(f) + " : no such file"); python::handle<> file(pyfile); PyObject* result = PyRun_File(PyFile_AsFile(file.get()), diff --git a/src/list.cpp b/src/list.cpp index 3c26950e..2c29251b 100644 --- a/src/list.cpp +++ b/src/list.cpp @@ -13,7 +13,7 @@ detail::new_non_null_reference list_base::call(object const& arg_) return (detail::new_non_null_reference) (expect_non_null)( PyObject_CallFunction( - (PyObject*)&PyList_Type, "(O)", + (PyObject*)&PyList_Type, const_cast("(O)"), arg_.ptr())); } diff --git a/src/long.cpp b/src/long.cpp index a534bf29..1ec8ebc0 100644 --- a/src/long.cpp +++ b/src/long.cpp @@ -9,21 +9,21 @@ namespace boost { namespace python { namespace detail { new_non_null_reference long_base::call(object const& arg_) { return (detail::new_non_null_reference)PyObject_CallFunction( - (PyObject*)&PyLong_Type, "(O)", + (PyObject*)&PyLong_Type, const_cast("(O)"), arg_.ptr()); } new_non_null_reference long_base::call(object const& arg_, object const& base) { return (detail::new_non_null_reference)PyObject_CallFunction( - (PyObject*)&PyLong_Type, "(OO)", + (PyObject*)&PyLong_Type, const_cast("(OO)"), arg_.ptr(), base.ptr()); } long_base::long_base() : object( detail::new_reference( - PyObject_CallFunction((PyObject*)&PyLong_Type, "()")) + PyObject_CallFunction((PyObject*)&PyLong_Type, const_cast("()"))) ) {} diff --git a/src/object/class.cpp b/src/object/class.cpp index 9daf42b7..a05851ef 100644 --- a/src/object/class.cpp +++ b/src/object/class.cpp @@ -74,7 +74,7 @@ extern "C" { propertyobject *gs = (propertyobject *)self; - return PyObject_CallFunction(gs->prop_get, "()"); + return PyObject_CallFunction(gs->prop_get, const_cast("()")); } static int @@ -95,9 +95,9 @@ extern "C" return -1; } if (value == NULL) - res = PyObject_CallFunction(func, "()"); + res = PyObject_CallFunction(func, const_cast("()")); else - res = PyObject_CallFunction(func, "(O)", value); + res = PyObject_CallFunction(func, const_cast("(O)"), value); if (res == NULL) return -1; Py_DECREF(res); @@ -108,7 +108,7 @@ extern "C" static PyTypeObject static_data_object = { PyObject_HEAD_INIT(0)//&PyType_Type) 0, - "Boost.Python.StaticProperty", + const_cast("Boost.Python.StaticProperty"), PyType_Type.tp_basicsize, 0, 0, /* tp_dealloc */ @@ -212,7 +212,7 @@ extern "C" static PyTypeObject class_metatype_object = { PyObject_HEAD_INIT(0)//&PyType_Type) 0, - "Boost.Python.class", + const_cast("Boost.Python.class"), PyType_Type.tp_basicsize, 0, 0, /* tp_dealloc */ @@ -316,7 +316,7 @@ namespace objects { // Attempt to find the __instance_size__ attribute. If not present, no problem. PyObject* d = type_->tp_dict; - PyObject* instance_size_obj = PyObject_GetAttrString(d, "__instance_size__"); + PyObject* instance_size_obj = PyObject_GetAttrString(d, const_cast("__instance_size__")); long instance_size = instance_size_obj ? PyInt_AsLong(instance_size_obj) : 0; @@ -357,20 +357,20 @@ namespace objects static PyGetSetDef instance_getsets[] = { - {"__dict__", instance_get_dict, instance_set_dict, NULL, 0}, + {const_cast("__dict__"), instance_get_dict, instance_set_dict, NULL, 0}, {0, 0, 0, 0, 0} }; static PyMemberDef instance_members[] = { - {"__weakref__", T_OBJECT, offsetof(instance<>, weakrefs), 0, 0}, + {const_cast("__weakref__"), T_OBJECT, offsetof(instance<>, weakrefs), 0, 0}, {0, 0, 0, 0, 0} }; static PyTypeObject class_type_object = { PyObject_HEAD_INIT(0) //&class_metatype_object) 0, - "Boost.Python.instance", + const_cast("Boost.Python.instance"), offsetof(instance<>,storage), /* tp_basicsize */ 1, /* tp_itemsize */ instance_dealloc, /* tp_dealloc */ @@ -572,7 +572,7 @@ namespace objects { object property( (python::detail::new_reference) - PyObject_CallFunction((PyObject*)&PyProperty_Type, "Osss", fget.ptr(), 0, 0, docstr)); + PyObject_CallFunction((PyObject*)&PyProperty_Type, const_cast("Osss"), fget.ptr(), 0, 0, docstr)); this->setattr(name, property); } @@ -582,7 +582,7 @@ namespace objects { object property( (python::detail::new_reference) - PyObject_CallFunction((PyObject*)&PyProperty_Type, "OOss", fget.ptr(), fset.ptr(), 0, docstr)); + PyObject_CallFunction((PyObject*)&PyProperty_Type, const_cast("OOss"), fget.ptr(), fset.ptr(), 0, docstr)); this->setattr(name, property); } @@ -591,7 +591,7 @@ namespace objects { object property( (python::detail::new_reference) - PyObject_CallFunction(static_data(), "O", fget.ptr())); + PyObject_CallFunction(static_data(), const_cast("O"), fget.ptr())); this->setattr(name, property); } @@ -600,7 +600,7 @@ namespace objects { object property( (python::detail::new_reference) - PyObject_CallFunction(static_data(), "OO", fget.ptr(), fset.ptr())); + PyObject_CallFunction(static_data(), const_cast("OO"), fget.ptr(), fset.ptr())); this->setattr(name, property); } @@ -615,13 +615,13 @@ namespace objects { extern "C" PyObject* no_init(PyObject*, PyObject*) { - ::PyErr_SetString(::PyExc_RuntimeError, "This class cannot be instantiated from Python"); + ::PyErr_SetString(::PyExc_RuntimeError, const_cast("This class cannot be instantiated from Python")); return NULL; } static ::PyMethodDef no_init_def = { - "__init__", no_init, METH_VARARGS, - "Raises an exception\n" - "This class cannot be instantiated from Python\n" + const_cast("__init__"), no_init, METH_VARARGS, + const_cast("Raises an exception\n" + "This class cannot be instantiated from Python\n") }; } @@ -650,7 +650,7 @@ namespace objects ::PyErr_Format( PyExc_TypeError - , "staticmethod expects callable object; got an object of type %s, which is not callable" + , const_cast("staticmethod expects callable object; got an object of type %s, which is not callable") , callable->ob_type->tp_name ); diff --git a/src/object/enum.cpp b/src/object/enum.cpp index 2fb215ca..f95dba03 100644 --- a/src/object/enum.cpp +++ b/src/object/enum.cpp @@ -23,7 +23,7 @@ struct enum_object }; static PyMemberDef enum_members[] = { - {"name", T_OBJECT_EX, offsetof(enum_object,name),READONLY, 0}, + {const_cast("name"), T_OBJECT_EX, offsetof(enum_object,name),READONLY, 0}, {0, 0, 0, 0, 0} }; @@ -32,7 +32,7 @@ extern "C" { static PyObject* enum_repr(PyObject* self_) { - const char *mod = PyString_AsString(PyObject_GetAttrString( self_, "__module__")); + const char *mod = PyString_AsString(PyObject_GetAttrString( self_, const_cast("__module__"))); enum_object* self = downcast(self_); if (!self->name) { @@ -65,7 +65,7 @@ extern "C" static PyTypeObject enum_type_object = { PyObject_HEAD_INIT(0) // &PyType_Type 0, - "Boost.Python.enum", + const_cast("Boost.Python.enum"), sizeof(enum_object), /* tp_basicsize */ 0, /* tp_itemsize */ 0, /* tp_dealloc */ diff --git a/src/object/function.cpp b/src/object/function.cpp index 8b4cc82d..2dad6ab1 100644 --- a/src/object/function.cpp +++ b/src/object/function.cpp @@ -297,7 +297,7 @@ object function::signatures(bool show_return_type) const void function::argument_error(PyObject* args, PyObject* /*keywords*/) const { static handle<> exception( - PyErr_NewException("Boost.Python.ArgumentError", PyExc_TypeError, 0)); + PyErr_NewException(const_cast("Boost.Python.ArgumentError"), PyExc_TypeError, 0)); object message = "Python argument types in\n %s.%s(" % make_tuple(this->m_namespace, this->m_name); @@ -440,7 +440,7 @@ void function::add_to_namespace( else if (PyType_Check(ns)) dict = ((PyTypeObject*)ns)->tp_dict; else - dict = PyObject_GetAttrString(ns, "__dict__"); + dict = PyObject_GetAttrString(ns, const_cast("__dict__")); if (dict == 0) throw_error_already_set(); @@ -487,7 +487,7 @@ void function::add_to_namespace( new_func->m_name = name; handle<> name_space_name( - allow_null(::PyObject_GetAttrString(name_space.ptr(), "__name__"))); + allow_null(::PyObject_GetAttrString(name_space.ptr(), const_cast("__name__")))); if (name_space_name) new_func->m_namespace = object(name_space_name); @@ -661,18 +661,18 @@ extern "C" } static PyGetSetDef function_getsetlist[] = { - {"__name__", (getter)function_get_name, 0, 0, 0 }, - {"func_name", (getter)function_get_name, 0, 0, 0 }, - {"__class__", (getter)function_get_class, 0, 0, 0 }, // see note above - {"__doc__", (getter)function_get_doc, (setter)function_set_doc, 0, 0}, - {"func_doc", (getter)function_get_doc, (setter)function_set_doc, 0, 0}, + {const_cast("__name__"), (getter)function_get_name, 0, 0, 0 }, + {const_cast("func_name"), (getter)function_get_name, 0, 0, 0 }, + {const_cast("__class__"), (getter)function_get_class, 0, 0, 0 }, // see note above + {const_cast("__doc__"), (getter)function_get_doc, (setter)function_set_doc, 0, 0}, + {const_cast("func_doc"), (getter)function_get_doc, (setter)function_set_doc, 0, 0}, {NULL, 0, 0, 0, 0} /* Sentinel */ }; PyTypeObject function_type = { PyObject_HEAD_INIT(0) 0, - "Boost.Python.function", + const_cast("Boost.Python.function"), sizeof(function), 0, (destructor)function_dealloc, /* tp_dealloc */ @@ -758,7 +758,8 @@ namespace detail } void BOOST_PYTHON_DECL pure_virtual_called() { - PyErr_SetString(PyExc_RuntimeError, "Pure virtual function called"); + PyErr_SetString( + PyExc_RuntimeError, const_cast("Pure virtual function called")); throw_error_already_set(); } } diff --git a/src/object/life_support.cpp b/src/object/life_support.cpp index a1768cba..013253b5 100644 --- a/src/object/life_support.cpp +++ b/src/object/life_support.cpp @@ -38,7 +38,7 @@ extern "C" PyTypeObject life_support_type = { PyObject_HEAD_INIT(0)//(&PyType_Type) 0, - "Boost.Python.life_support", + const_cast("Boost.Python.life_support"), sizeof(life_support), 0, life_support_dealloc, /* tp_dealloc */ diff --git a/src/str.cpp b/src/str.cpp index 7ee748a3..a7646866 100644 --- a/src/str.cpp +++ b/src/str.cpp @@ -10,7 +10,7 @@ namespace boost { namespace python { namespace detail { detail::new_reference str_base::call(object const& arg_) { return (detail::new_reference)PyObject_CallFunction( - (PyObject*)&PyString_Type, "(O)", + (PyObject*)&PyString_Type, const_cast("(O)"), arg_.ptr()); } @@ -68,8 +68,9 @@ str str_base:: name ( BOOST_PP_ENUM_PARAMS(arity, object_cref x) ) const return str(new_reference( \ expect_non_null( \ PyObject_CallMethod( \ - this->ptr(), #name, \ - "(" BOOST_PP_REPEAT(arity, BOOST_PYTHON_FORMAT_OBJECT, _) ")" \ + this->ptr(), const_cast( #name ), \ + const_cast( \ + "(" BOOST_PP_REPEAT(arity, BOOST_PYTHON_FORMAT_OBJECT, _) ")") \ BOOST_PP_REPEAT_1(arity, BOOST_PYTHON_OBJECT_PTR, _))))); \ } diff --git a/src/tuple.cpp b/src/tuple.cpp index b5696504..6719713b 100644 --- a/src/tuple.cpp +++ b/src/tuple.cpp @@ -9,7 +9,7 @@ namespace boost { namespace python { namespace detail { detail::new_reference tuple_base::call(object const& arg_) { return (detail::new_reference)PyObject_CallFunction( - (PyObject*)&PyTuple_Type, "(O)", + (PyObject*)&PyTuple_Type, const_cast("(O)"), arg_.ptr()); } diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index 4ab785f0..4e1479b4 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -5,7 +5,10 @@ import python ; use-project /boost/python : ../build ; -project /boost/python/test ; +project /boost/python/test + : requirements + gcc:-Wextra + ; local PY = ; if [ python.configured ] @@ -39,7 +42,7 @@ test-suite python : [ - run exec.cpp ../build//boost_python/static $(PY) + run exec.cpp /boost/python//boost_python/static $(PY) : # program args : exec.py # input files : # requirements @@ -168,7 +171,8 @@ bpl-test crossmod_opaque /boost/python//boost_python ] [ bpl-test map_indexing_suite : map_indexing_suite.py map_indexing_suite_ext ] -[ py-run import_.cpp : import_.py ] + +[ run import_.cpp /boost/python//boost_python $(PY) : : import_.py ] # if $(TEST_BIENSTMAN_NON_BUGS) # { diff --git a/test/andreas_beyer.cpp b/test/andreas_beyer.cpp index da3aa751..b28b1566 100755 --- a/test/andreas_beyer.cpp +++ b/test/andreas_beyer.cpp @@ -25,8 +25,8 @@ class B { B() { a = A::A_ptr(new A()); } - void set(A::A_ptr a) { - this->a = a; + void set(A::A_ptr _a) { + this->a = _a; } A::A_ptr get() { return a; diff --git a/test/back_reference.cpp b/test/back_reference.cpp index b5d1378c..266ed291 100644 --- a/test/back_reference.cpp +++ b/test/back_reference.cpp @@ -27,7 +27,7 @@ struct X X(X const& rhs) : x(rhs.x), magic(7654321) { ++counter; } virtual ~X() { BOOST_ASSERT(magic == 7654321); magic = 6666666; x = 9999; --counter; } - void set(int x) { BOOST_ASSERT(magic == 7654321); this->x = x; } + void set(int _x) { BOOST_ASSERT(magic == 7654321); this->x = _x; } int value() const { BOOST_ASSERT(magic == 7654321); return x; } static int count() { return counter; } private: diff --git a/test/borrowed.cpp b/test/borrowed.cpp index 0daccff1..2c1bd1b7 100755 --- a/test/borrowed.cpp +++ b/test/borrowed.cpp @@ -9,13 +9,13 @@ using namespace boost::python; template -void assert_borrowed_ptr(T const& x) +void assert_borrowed_ptr(T const&) { BOOST_STATIC_ASSERT(boost::python::detail::is_borrowed_ptr::value); } template -void assert_not_borrowed_ptr(T const& x) +void assert_not_borrowed_ptr(T const&) { BOOST_STATIC_ASSERT(!boost::python::detail::is_borrowed_ptr::value); } diff --git a/test/callbacks.cpp b/test/callbacks.cpp index 255ed1b7..66bd3524 100644 --- a/test/callbacks.cpp +++ b/test/callbacks.cpp @@ -34,7 +34,7 @@ struct X X(X const& rhs) : x(rhs.x), magic(7654321) { ++counter; } ~X() { BOOST_ASSERT(magic == 7654321); magic = 6666666; x = 9999; --counter; } - void set(int x) { BOOST_ASSERT(magic == 7654321); this->x = x; } + void set(int _x) { BOOST_ASSERT(magic == 7654321); this->x = _x; } int value() const { BOOST_ASSERT(magic == 7654321); return x; } static int count() { return counter; } private: diff --git a/test/complicated.hpp b/test/complicated.hpp index 5c15e80a..5ff19aea 100644 --- a/test/complicated.hpp +++ b/test/complicated.hpp @@ -19,10 +19,10 @@ struct complicated int n; }; -inline complicated::complicated(simple const&s, int n) - : s(s.s), n(n) +inline complicated::complicated(simple const&s, int _n) + : s(s.s), n(_n) { - std::cout << "constructing complicated: " << this->s << ", " << n << std::endl; + std::cout << "constructing complicated: " << this->s << ", " << _n << std::endl; } inline complicated::~complicated() diff --git a/test/exec.cpp b/test/exec.cpp index bad33c6f..31883d89 100644 --- a/test/exec.cpp +++ b/test/exec.cpp @@ -59,7 +59,7 @@ void eval_test() void exec_test() { // Register the module with the interpreter - if (PyImport_AppendInittab("embedded_hello", initembedded_hello) == -1) + if (PyImport_AppendInittab(const_cast("embedded_hello"), initembedded_hello) == -1) throw std::runtime_error("Failed to add embedded_hello to the interpreter's " "builtin modules"); // Retrieve the main module diff --git a/test/m1.cpp b/test/m1.cpp index 407924fe..ff075076 100644 --- a/test/m1.cpp +++ b/test/m1.cpp @@ -34,7 +34,7 @@ struct NoddyObject : PyObject PyTypeObject NoddyType = { PyObject_HEAD_INIT(NULL) 0, - "Noddy", + const_cast("Noddy"), sizeof(NoddyObject), 0, dealloc, /* tp_dealloc */ @@ -106,7 +106,7 @@ struct extract_simple_object PyTypeObject SimpleType = { PyObject_HEAD_INIT(NULL) 0, - "Simple", + const_cast("Simple"), sizeof(SimpleObject), 0, dealloc, /* tp_dealloc */ @@ -159,7 +159,7 @@ PyTypeObject SimpleType = { PyObject* new_simple() { SimpleObject* simple = PyObject_New(SimpleObject, &SimpleType); - simple->x.s = "hello, world"; + simple->x.s = const_cast("hello, world"); return (PyObject*)simple; } diff --git a/test/numpy.cpp b/test/numpy.cpp index e5da7c9b..59eb5266 100644 --- a/test/numpy.cpp +++ b/test/numpy.cpp @@ -12,7 +12,7 @@ using namespace boost::python; #if BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x580)) -# define make_tuple boost::python::make_tuple +# define make_tuple ::boost::python::make_tuple #endif // See if we can invoke array() from C++ @@ -51,7 +51,7 @@ namespace str format("exception type: %sn"); format += "exception value: %sn"; format += "traceback:n%s" ; - object ret = format % boost::python::make_tuple(ty, v, tr); + object ret = format % make_tuple(ty, v, tr); return ret; } } diff --git a/test/operators_wrapper.cpp b/test/operators_wrapper.cpp index f00aa2b4..12f30048 100644 --- a/test/operators_wrapper.cpp +++ b/test/operators_wrapper.cpp @@ -5,10 +5,10 @@ struct vector { virtual ~vector() {} - vector operator+( const vector& x ) const + vector operator+( const vector& ) const { return vector(); } - vector& operator+=( const vector& x ) + vector& operator+=( const vector& ) { return *this; } vector operator-() const diff --git a/test/pickle1.cpp b/test/pickle1.cpp index 28845fc9..7988f211 100644 --- a/test/pickle1.cpp +++ b/test/pickle1.cpp @@ -27,8 +27,8 @@ namespace boost_python_test { private: std::string country; public: - world(const std::string& country) { - this->country = country; + world(const std::string& _country) { + this->country = _country; } std::string greet() const { return "Hello from " + country + "!"; } std::string get_country() const { return country; } diff --git a/test/pickle2.cpp b/test/pickle2.cpp index 1c08cbd0..7cdf05f0 100644 --- a/test/pickle2.cpp +++ b/test/pickle2.cpp @@ -34,8 +34,8 @@ namespace boost_python_test { class world { public: - world(const std::string& country) : secret_number(0) { - this->country = country; + world(const std::string& _country) : secret_number(0) { + this->country = _country; } std::string greet() const { return "Hello from " + country + "!"; } std::string get_country() const { return country; } diff --git a/test/pickle3.cpp b/test/pickle3.cpp index 01ce27cf..7aaddc9a 100644 --- a/test/pickle3.cpp +++ b/test/pickle3.cpp @@ -35,8 +35,8 @@ namespace boost_python_test { class world { public: - world(const std::string& country) : secret_number(0) { - this->country = country; + world(const std::string& _country) : secret_number(0) { + this->country = _country; } std::string greet() const { return "Hello from " + country + "!"; } std::string get_country() const { return country; } diff --git a/test/pickle4.cpp b/test/pickle4.cpp index d9758c28..1374cc7d 100644 --- a/test/pickle4.cpp +++ b/test/pickle4.cpp @@ -23,8 +23,8 @@ namespace boost_python_test { private: std::string country; public: - world(const std::string& country) { - this->country = country; + world(const std::string& _country) { + this->country = _country; } std::string greet() const { return "Hello from " + country + "!"; } std::string get_country() const { return country; } diff --git a/test/slice.cpp b/test/slice.cpp index f28e38f5..03953e39 100644 --- a/test/slice.cpp +++ b/test/slice.cpp @@ -100,7 +100,11 @@ bool accept_slice( slice) { return true; } || BOOST_WORKAROUND( BOOST_INTEL_WIN, == 710) int check_slice_get_indicies(slice index); #endif -int check_slice_get_indicies(const slice index) +int check_slice_get_indicies( +#if !BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x590)) + const +#endif + slice index) { // A vector of integers from [-5, 5]. std::vector coll(11); diff --git a/test/staticmethod.cpp b/test/staticmethod.cpp index 5947e538..dcd75ca8 100644 --- a/test/staticmethod.cpp +++ b/test/staticmethod.cpp @@ -20,7 +20,7 @@ struct X X(X const& rhs) : x(rhs.x), magic(7654321) { ++counter; } virtual ~X() { BOOST_ASSERT(magic == 7654321); magic = 6666666; x = 9999; --counter; } - void set(int x) { BOOST_ASSERT(magic == 7654321); this->x = x; } + void set(int _x) { BOOST_ASSERT(magic == 7654321); this->x = _x; } int value() const { BOOST_ASSERT(magic == 7654321); return x; } static int count() { return counter; } private: diff --git a/test/test_class.hpp b/test/test_class.hpp index 6eb5e1e4..5404fdba 100644 --- a/test/test_class.hpp +++ b/test/test_class.hpp @@ -13,7 +13,7 @@ struct test_class test_class(test_class const& rhs) : x(rhs.x), magic(7654321 + n) { ++counter; } virtual ~test_class() { BOOST_TEST(magic == 7654321 + n); magic = 6666666; x = 9999; --counter; } - void set(int x) { BOOST_TEST(magic == 7654321 + n); this->x = x; } + void set(int _x) { BOOST_TEST(magic == 7654321 + n); this->x = _x; } int value() const { BOOST_TEST(magic == 7654321 + n); return x; } operator int() const { return x; } static int count() { return counter; } diff --git a/test/test_pointer_adoption.cpp b/test/test_pointer_adoption.cpp index eeda8a9b..a4e14af5 100644 --- a/test/test_pointer_adoption.cpp +++ b/test/test_pointer_adoption.cpp @@ -65,7 +65,7 @@ struct B B() : x(0) {} B(A* x_) : x(x_) {} - inner const* adopt(A* x) { this->x = x; return &x->get_inner(); } + inner const* adopt(A* _x) { this->x = _x; return &_x->get_inner(); } std::string a_content() { diff --git a/test/virtual_functions.cpp b/test/virtual_functions.cpp index d871192a..774b11b1 100644 --- a/test/virtual_functions.cpp +++ b/test/virtual_functions.cpp @@ -22,7 +22,7 @@ struct X X(X const& rhs) : x(rhs.x), magic(7654321) { ++counter; } virtual ~X() { BOOST_ASSERT(magic == 7654321); magic = 6666666; x = 9999; --counter; } - void set(int x) { BOOST_ASSERT(magic == 7654321); this->x = x; } + void set(int _x) { BOOST_ASSERT(magic == 7654321); this->x = _x; } int value() const { BOOST_ASSERT(magic == 7654321); return x; } static int count() { return counter; } private: