Compare commits

...

3 Commits
master ... f21

Author SHA1 Message Date
Petr Machata 48eaa83d7c libboost_python{,3} should depend on libpython 2015-01-14 00:48:52 +01:00
Petr Machata 6c7e1e8c6e Boost.Atomic: Fixed incorrect initialization of 128-bit values 2015-01-02 14:15:46 +01:00
Petr Machata cfbd80b49d Fix boost::shared_ptr<T>::operator[] for non-array T's 2014-11-12 19:57:23 +01:00
7 changed files with 419 additions and 2 deletions

View File

@ -0,0 +1,88 @@
From f65c57d9d2a4f535e36c96b7f563574634e46b02 Mon Sep 17 00:00:00 2001
From: Peter Dimov <pdimov@pdimov.com>
Date: Wed, 12 Nov 2014 19:04:29 +0200
Subject: [PATCH] Fix explicit instantiation regression
---
include/boost/smart_ptr/shared_ptr.hpp | 2 +-
test/Jamfile.v2 | 2 ++
test/array_fail_array_access.cpp | 6 +++++-
test/sp_explicit_inst_test.cpp | 23 +++++++++++++++++++++++
4 files changed, 31 insertions(+), 2 deletions(-)
create mode 100644 test/sp_explicit_inst_test.cpp
diff --git a/include/boost/smart_ptr/shared_ptr.hpp b/include/boost/smart_ptr/shared_ptr.hpp
index 82ece8b..8be92ab 100644
--- a/boost/smart_ptr/shared_ptr.hpp
+++ b/boost/smart_ptr/shared_ptr.hpp
@@ -655,7 +655,7 @@ public:
BOOST_ASSERT( px != 0 );
BOOST_ASSERT( i >= 0 && ( i < boost::detail::sp_extent< T >::value || boost::detail::sp_extent< T >::value == 0 ) );
- return px[ i ];
+ return static_cast< typename boost::detail::sp_array_access< T >::type >( px[ i ] );
}
element_type * get() const BOOST_NOEXCEPT
diff --git a/test/Jamfile.v2 b/test/Jamfile.v2
index 027367c..0b51eee 100644
--- a/libs/smart_ptr/test/Jamfile.v2
+++ b/libs/smart_ptr/test/Jamfile.v2
@@ -153,5 +153,7 @@ import testing ;
[ run allocate_shared_array_throws_test.cpp ]
[ run allocate_shared_array_esft_test.cpp ]
[ run allocate_shared_array_args_test.cpp ]
+
+ [ compile sp_explicit_inst_test.cpp ]
;
}
diff --git a/test/array_fail_array_access.cpp b/test/array_fail_array_access.cpp
index abfacbe..4f4e3f8 100644
--- a/libs/smart_ptr/test/array_fail_array_access.cpp
+++ b/libs/smart_ptr/test/array_fail_array_access.cpp
@@ -12,8 +12,12 @@ struct X
{
};
+template<class T> void f( T & /*t*/ )
+{
+}
+
int main()
{
boost::shared_ptr<X> px( new X );
- px[ 0 ];
+ f( px[ 0 ] );
}
diff --git a/test/sp_explicit_inst_test.cpp b/test/sp_explicit_inst_test.cpp
new file mode 100644
index 0000000..d8de782
--- /dev/null
+++ b/libs/smart_ptr/test/sp_explicit_inst_test.cpp
@@ -0,0 +1,23 @@
+//
+// Explicit instantiations are reported to exist in user code
+//
+// Copyright (c) 2014 Peter Dimov
+//
+// Distributed under the Boost Software License, Version 1.0.
+// See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt
+//
+
+#include <boost/shared_ptr.hpp>
+
+template class boost::shared_ptr< int >;
+
+struct X
+{
+};
+
+template class boost::shared_ptr< X >;
+
+int main()
+{
+}
--
2.1.0

View File

@ -0,0 +1,48 @@
From 6bb71fdd8f7cc346d90fb14beb38b7297fc1ffd9 Mon Sep 17 00:00:00 2001
From: Andrey Semashev <andrey.semashev@gmail.com>
Date: Sun, 26 Jan 2014 13:58:48 +0400
Subject: [PATCH] Fixed incorrect initialization of 128-bit values, when no
native support for 128-bit integers is available.
---
include/boost/atomic/detail/cas128strong.hpp | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/include/boost/atomic/detail/cas128strong.hpp b/include/boost/atomic/detail/cas128strong.hpp
index 906c13e..dcb4d7d 100644
--- a/include/boost/atomic/detail/cas128strong.hpp
+++ b/include/boost/atomic/detail/cas128strong.hpp
@@ -196,15 +196,17 @@ protected:
public:
BOOST_DEFAULTED_FUNCTION(base_atomic(void), {})
- explicit base_atomic(value_type const& v) BOOST_NOEXCEPT : v_(0)
+ explicit base_atomic(value_type const& v) BOOST_NOEXCEPT
{
+ memset(&v_, 0, sizeof(v_));
memcpy(&v_, &v, sizeof(value_type));
}
void
store(value_type const& value, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
{
- storage_type value_s = 0;
+ storage_type value_s;
+ memset(&value_s, 0, sizeof(value_s));
memcpy(&value_s, &value, sizeof(value_type));
platform_fence_before_store(order);
platform_store128(value_s, &v_);
@@ -247,7 +249,9 @@ public:
memory_order success_order,
memory_order failure_order) volatile BOOST_NOEXCEPT
{
- storage_type expected_s = 0, desired_s = 0;
+ storage_type expected_s, desired_s;
+ memset(&expected_s, 0, sizeof(expected_s));
+ memset(&desired_s, 0, sizeof(desired_s));
memcpy(&expected_s, &expected, sizeof(value_type));
memcpy(&desired_s, &desired, sizeof(value_type));
--
2.1.0

View File

@ -0,0 +1,68 @@
From e4bde20f2eec0a51be14533871d2123bd2ab9cf3 Mon Sep 17 00:00:00 2001
From: Andrey Semashev <andrey.semashev@gmail.com>
Date: Fri, 28 Feb 2014 12:43:11 +0400
Subject: [PATCH] More compilation fixes for the case when 128-bit integers are
not supported.
---
include/boost/atomic/detail/gcc-atomic.hpp | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/include/boost/atomic/detail/gcc-atomic.hpp b/include/boost/atomic/detail/gcc-atomic.hpp
index a130590..4af99a1 100644
--- a/include/boost/atomic/detail/gcc-atomic.hpp
+++ b/include/boost/atomic/detail/gcc-atomic.hpp
@@ -958,14 +958,16 @@ protected:
public:
BOOST_DEFAULTED_FUNCTION(base_atomic(void), {})
- explicit base_atomic(value_type const& v) BOOST_NOEXCEPT : v_(0)
+ explicit base_atomic(value_type const& v) BOOST_NOEXCEPT
{
+ memset(&v_, 0, sizeof(v_));
memcpy(&v_, &v, sizeof(value_type));
}
void store(value_type const& v, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
{
- storage_type tmp = 0;
+ storage_type tmp;
+ memset(&tmp, 0, sizeof(tmp));
memcpy(&tmp, &v, sizeof(value_type));
__atomic_store_n(&v_, tmp, atomics::detail::convert_memory_order_to_gcc(order));
}
@@ -980,7 +982,8 @@ public:
value_type exchange(value_type const& v, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
{
- storage_type tmp = 0;
+ storage_type tmp;
+ memset(&tmp, 0, sizeof(tmp));
memcpy(&tmp, &v, sizeof(value_type));
tmp = __atomic_exchange_n(&v_, tmp, atomics::detail::convert_memory_order_to_gcc(order));
value_type res;
@@ -994,7 +997,9 @@ public:
memory_order success_order,
memory_order failure_order) volatile BOOST_NOEXCEPT
{
- storage_type expected_s = 0, desired_s = 0;
+ storage_type expected_s, desired_s;
+ memset(&expected_s, 0, sizeof(expected_s));
+ memset(&desired_s, 0, sizeof(desired_s));
memcpy(&expected_s, &expected, sizeof(value_type));
memcpy(&desired_s, &desired, sizeof(value_type));
const bool success = __atomic_compare_exchange_n(&v_, &expected_s, desired_s, false,
@@ -1010,7 +1015,9 @@ public:
memory_order success_order,
memory_order failure_order) volatile BOOST_NOEXCEPT
{
- storage_type expected_s = 0, desired_s = 0;
+ storage_type expected_s, desired_s;
+ memset(&expected_s, 0, sizeof(expected_s));
+ memset(&desired_s, 0, sizeof(desired_s));
memcpy(&expected_s, &expected, sizeof(value_type));
memcpy(&desired_s, &desired, sizeof(value_type));
const bool success = __atomic_compare_exchange_n(&v_, &expected_s, desired_s, true,
--
2.1.0

View File

@ -0,0 +1,62 @@
--- boost_1_55_0/tools/build/v2/tools/python.jam 2013-05-21 06:14:18.000000000 +0200
+++ boost_1_55_0/tools/build/v2/tools/python.jam 2014-05-29 19:09:12.115413877 +0200
@@ -94,7 +94,7 @@ feature.feature pythonpath : : free opti
# using python : 2.3 : /usr/local/bin/python ;
#
rule init ( version ? : cmd-or-prefix ? : includes * : libraries ?
- : condition * : extension-suffix ? )
+ : condition * : extension-suffix ? : abi-letters ? )
{
project.push-current $(.project) ;
@@ -107,7 +107,7 @@ rule init ( version ? : cmd-or-prefix ?
}
}
- configure $(version) : $(cmd-or-prefix) : $(includes) : $(libraries) : $(condition) : $(extension-suffix) ;
+ configure $(version) : $(cmd-or-prefix) : $(includes) : $(libraries) : $(condition) : $(extension-suffix) : $(abi-letters) ;
project.pop-current ;
}
@@ -653,7 +653,7 @@ local rule system-library-dependencies (
# Declare a target to represent Python's library.
#
-local rule declare-libpython-target ( version ? : requirements * )
+local rule declare-libpython-target ( version ? : requirements * : abi-letters ? )
{
# Compute the representation of Python version in the name of Python's
# library file.
@@ -677,13 +677,13 @@ local rule declare-libpython-target ( ve
}
# Declare it.
- lib python.lib : : <name>python$(lib-version) $(requirements) ;
+ lib python.lib : : <name>python$(lib-version)$(abi-letters) $(requirements) ;
}
# Implementation of init.
local rule configure ( version ? : cmd-or-prefix ? : includes * : libraries ? :
- condition * : extension-suffix ? )
+ condition * : extension-suffix ? : abi-letters ? )
{
local prefix ;
local exec-prefix ;
@@ -699,6 +699,7 @@ local rule configure ( version ? : cmd-o
extension-suffix ?= _d ;
}
extension-suffix ?= "" ;
+ abi-letters ?= "" ;
# Normalize and dissect any version number.
local major-minor ;
@@ -922,7 +923,7 @@ local rule configure ( version ? : cmd-o
}
else
{
- declare-libpython-target $(version) : $(target-requirements) ;
+ declare-libpython-target $(version) : $(target-requirements) : $(abi-letters) ;
# This is an evil hack. On, Windows, when Python is embedded, nothing
# seems to set up sys.path to include Python's standard library

View File

@ -0,0 +1,13 @@
Index: boost/tools/build/v2/tools/python.jam
===================================================================
--- boost/tools/build/v2/tools/python.jam (revision 50406)
+++ boost/tools/build/v2/tools/python.jam (working copy)
@@ -994,7 +994,7 @@
else
{
alias python_for_extensions
- :
+ : python
: $(target-requirements)
:
: $(usage-requirements)

View File

@ -0,0 +1,98 @@
diff -up boost_1_55_0/libs/python/test/exec.cpp\~ boost_1_55_0/libs/python/test/exec.cpp
--- boost_1_55_0/libs/python/test/exec.cpp~ 2010-07-05 00:38:38.000000000 +0200
+++ boost_1_55_0/libs/python/test/exec.cpp 2015-01-09 21:31:12.903218280 +0100
@@ -56,6 +56,20 @@ void eval_test()
BOOST_TEST(value == "ABCDEFG");
}
+struct PyCtx
+{
+ PyCtx() {
+ Py_Initialize();
+ }
+
+ ~PyCtx() {
+ // N.B. certain problems may arise when Py_Finalize is called when
+ // using Boost.Python. However in this test suite it all seems to
+ // work fine.
+ Py_Finalize();
+ }
+};
+
void exec_test()
{
// Register the module with the interpreter
@@ -68,6 +82,8 @@ void exec_test()
) == -1)
throw std::runtime_error("Failed to add embedded_hello to the interpreter's "
"builtin modules");
+
+ PyCtx ctx;
// Retrieve the main module
python::object main = python::import("__main__");
@@ -148,41 +164,43 @@ void check_pyerr(bool pyerr_expected=fal
}
}
+template <class Cb>
+bool
+run_and_handle_exception(Cb cb, bool pyerr_expected = false)
+{
+ PyCtx ctx;
+ if (python::handle_exception(cb)) {
+ check_pyerr(pyerr_expected);
+ return true;
+ } else {
+ return false;
+ }
+}
+
int main(int argc, char **argv)
{
BOOST_TEST(argc == 2 || argc == 3);
std::string script = argv[1];
- // Initialize the interpreter
- Py_Initialize();
- if (python::handle_exception(eval_test)) {
- check_pyerr();
- }
- else if(python::handle_exception(exec_test)) {
- check_pyerr();
- }
- else if (python::handle_exception(boost::bind(exec_file_test, script))) {
+ // N.B. exec_test mustn't be called through run_and_handle_exception
+ // as it needs to handles the python context by itself.
+ if (run_and_handle_exception(eval_test)
+ || python::handle_exception(exec_test))
check_pyerr();
- }
-
- if (python::handle_exception(exec_test_error))
- {
- check_pyerr(/*pyerr_expected*/ true);
- }
else
- {
+ run_and_handle_exception(boost::bind(exec_file_test, script));
+
+ if (!run_and_handle_exception(exec_test_error, true))
BOOST_ERROR("Python exception expected, but not seen.");
- }
if (argc > 2) {
+ PyCtx ctx;
// The main purpose is to test compilation. Since this test generates
// a file and I (rwgk) am uncertain about the side-effects, run it only
// if explicitly requested.
exercise_embedding_html();
}
- // Boost.Python doesn't support Py_Finalize yet.
- // Py_Finalize();
return boost::report_errors();
}
Diff finished. Fri Jan 9 21:31:13 2015

View File

@ -36,7 +36,7 @@ Name: boost
Summary: The free peer-reviewed portable C++ source libraries
Version: 1.55.0
%define version_enc 1_55_0
Release: 3%{?dist}
Release: 8%{?dist}
License: Boost and MIT and Python
%define toplev_dirname %{name}_%{version_enc}
@ -99,6 +99,7 @@ Patch5: boost-1.48.0-add-bjam-man-page.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=828856
# https://bugzilla.redhat.com/show_bug.cgi?id=828857
# https://svn.boost.org/trac/boost/ticket/6701
Patch15: boost-1.50.0-pool.patch
# https://svn.boost.org/trac/boost/ticket/8844
@ -157,6 +158,18 @@ Patch56: boost-1.55.0-xpressive-unused_typedefs.patch
# Fixed upstream on Aug 20 05:11:14 2013.
Patch57: boost-1.55.0-spirit-unused_typedefs.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=1159960
Patch58: boost-1.54.0-smart_ptr-shared_ptr_at.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=1177066
Patch59: boost-1.55.0-atomic-int128_1.patch
Patch60: boost-1.55.0-atomic-int128_2.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=1102667
Patch61: boost-1.55.0-python-libpython_dep.patch
Patch62: boost-1.55.0-python-abi_letters.patch
Patch63: boost-1.55.0-python-test-PyImport_AppendInittab.patch
%bcond_with tests
%bcond_with docs_generated
@ -643,6 +656,12 @@ a number of significant features and is now developed independently
%patch55 -p1
%patch56 -p1
%patch57 -p1
%patch58 -p1
%patch59 -p2
%patch60 -p2
%patch61 -p1
%patch62 -p1
%patch63 -p1
# At least python2_version needs to be a macro so that it's visible in
# %%install as well.
@ -663,11 +682,13 @@ cat >> ./tools/build/v2/user-config.jam << EOF
# There are many strict aliasing warnings, and it's not feasible to go
# through them all at this time.
using gcc : : : <compileflags>-fno-strict-aliasing ;
%if %{with openmpi} || %{with mpich}
using mpi ;
%endif
%if %{with python3}
# This _adds_ extra python version. It doesn't replace whatever
# python 2.X is default on the system.
using python : %{python3_version} : /usr/bin/python3 : /usr/include/python%{python3_version}%{python3_abiflags} ;
using python : %{python3_version} : /usr/bin/python3 : /usr/include/python%{python3_version}%{python3_abiflags} : : : : %{python3_abiflags} ;
%endif
EOF
@ -1245,6 +1266,25 @@ rm -rf $RPM_BUILD_ROOT
%{_mandir}/man1/bjam.1*
%changelog
* Fri Jan 9 2015 Petr Machata <pmachata@redhat.com> - 1.55.0-8
- Build libboost_python and libboost_python3 such that they depend on
their respective libpython's.
(boost-1.55.0-python-libpython_dep.patch,
boost-1.55.0-python-abi_letters.patch)
- Fix Boost.Python test suite so that PyImport_AppendInittab is called
before PyInitialize, which broke the test suite with Python 3.
(boost-1.55.0-python-test-PyImport_AppendInittab.patch)
* Fri Jan 2 2015 Petr Machata <pmachata@redhat.com> - 1.55.0-6
- Boost.Atomic: Fixed incorrect initialization of 128-bit values, when
no native support for 128-bit integers is available.
(boost-1.55.0-atomic-int128_1.patch,
boost-1.55.0-atomic-int128_2.patch)
* Wed Nov 12 2014 Petr Machata <pmachata@redhat.com> - 1.55.0-4
- Fix boost::shared_ptr<T>::operator[], which was ill-formed for
non-array T's. (boost-1.54.0-smart_ptr-shared_ptr_at.patch)
* Fri Aug 15 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.55.0-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild