From 33b1e83abc65d61aa8982f5d1cabdcb2df160f7c Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Sat, 19 Aug 2023 23:51:57 +0800 Subject: [PATCH] Add patch for Boost.Accumulators bug This change silences the warning when compiling Boost.accumulators with GCC 13. as some projects using Boost.Accumulators are compiled with -Werror. Without this change, these project would have to disable -Wuninitialized warning or silence it temporarily when including the offending headers. Neither of these two solution is ideal from a developer's perspective. so let's apply the patch when packaging Boost. The patch was included by Boost 1.83. Signed-off-by: Kefu Chai --- ....0-always-initialize-member-variable.patch | 41 +++++++++++++++++++ boost.spec | 9 +++- 2 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 boost-1.81.0-always-initialize-member-variable.patch diff --git a/boost-1.81.0-always-initialize-member-variable.patch b/boost-1.81.0-always-initialize-member-variable.patch new file mode 100644 index 0000000..14c48ae --- /dev/null +++ b/boost-1.81.0-always-initialize-member-variable.patch @@ -0,0 +1,41 @@ +From ecdc3d41be93d994cf293b6ce08cc33cb9e39e71 Mon Sep 17 00:00:00 2001 +From: Kefu Chai +Date: Thu, 27 Apr 2023 13:09:28 +0800 +Subject: [PATCH] always initialize member variable + +in this change, impl::extended_p_square_quantile_impl::probability is +zero-initialized to silence -Wuninitialized warning from GCC-13. + +despite that this variable is always initialized in +impl::extended_p_square_quantile_impl::result(), it is still referenced +by, for instance the copy constructor, which could be called before +`result()` gets called. and GCC-13 rightly warn us like: + +In copy constructor ‘constexpr boost::accumulators::impl::extended_p_square_quantile_impl::extended_p_square_quantile_impl(const boost::accumulators::impl::extended_p_square_quantile_impl&)’, + inlined from ‘boost::accumulators::detail::accumulator_wrapper::accumulator_wrapper(const boost::accumulators::detail::accumulator_wrapper&) [with Accumulator = boost::accumulators::impl::extended_p_square_quantile_impl; Feature = boost::accumulators::tag::extended_p_square_quantile_quadratic]’ at /usr/include/boost/accumulators/framework/depends_on.hpp:320:69, + inlined from ‘constexpr boost::fusion::cons::cons(typename boost::fusion::detail::call_param::type, typename boost::fusion::detail::call_param::type) [with Car = boost::accumulators::detail::accumulator_wrapper, boost::accumulators::tag::extended_p_square_quantile_quadratic>; Cdr = boost::fusion::cons, boost::accumulators::tag::sum>, boost::fusion::cons, boost::accumulators::tag::mean>, boost::fusion::cons, boost::accumulators::tag::max>, boost::fusion::nil_> > >]’ at /usr/include/boost/fusion/container/list/cons.hpp:66:15, + inlined from ‘static boost::accumulators::detail::build_acc_list::type boost::accumulators::detail::build_acc_list::call(const Args&, const First&, const Last&) [with Args = boost::parameter::aux::flat_like_arg_list, void> >, std::integral_constant >, boost::parameter::aux::flat_like_arg_tuple, boost::parameter::aux::tagged_argument, std::array >, std::integral_constant > >; First = boost::fusion::mpl_iterator, boost::accumulators::tag::max>, boost::mpl::v_item, boost::accumulators::tag::mean>, boost::mpl::v_item, boost::accumulators::tag::sum>, boost::mpl::v_item, boost::accumulators::tag::extended_p_square_quantile_quadratic>, boost::mpl::v_item, boost::accumulators::tag::extended_p_square>, boost::mpl::v_item, boost::mpl::vector0, 0>, 0>, 0>, 0>, 0>, 0>, 2> >; Last = boost::fusion::mpl_iterator, boost::accumulators::tag::max>, boost::mpl::v_item, boost::accumulators::tag::mean>, boost::mpl::v_item, boost::accumulators::tag::sum>, boost::mpl::v_item, boost::accumulators::tag::extended_p_square_quantile_quadratic>, boost::mpl::v_item, boost::accumulators::tag::extended_p_square>, boost::mpl::v_item, boost::mpl::vector0, 0>, 0>, 0>, 0>, 0>, 0>, 6> >]’ at /usr/include/boost/accumulators/framework/depends_on.hpp:252:86, + inlined from ‘static boost::accumulators::detail::build_acc_list::type boost::accumulators::detail::build_acc_list::call(const Args&, const First&, const Last&) [with Args = boost::parameter::aux::flat_like_arg_list, void> >, std::integral_constant >, boost::parameter::aux::flat_like_arg_tuple, boost::parameter::aux::tagged_argument, std::array >, std::integral_constant > >; First = boost::fusion::mpl_iterator, boost::accumulators::tag::max>, boost::mpl::v_item, boost::accumulators::tag::mean>, boost::mpl::v_item, boost::accumulators::tag::sum>, boost::mpl::v_item, boost::accumulators::tag::extended_p_square_quantile_quadratic>, boost::mpl::v_item, boost::accumulators::tag::extended_p_square>, boost::mpl::v_item, boost::mpl::vector0, 0>, 0>, 0>, 0>, 0>, 0>, 1> >; Last = boost::fusion::mpl_iterator, boost::accumulators::tag::max>, boost::mpl::v_item, boost::accumulators::tag::mean>, boost::mpl::v_item, boost::accumulators::tag::sum>, boost::mpl::v_item, boost::accumulators::tag::extended_p_square_quantile_quadratic>, boost::mpl::v_item, boost::accumulators::tag::extended_p_square>, boost::mpl::v_item, boost::mpl::vector0, 0>, 0>, 0>, 0>, 0>, 0>, 6> >]’ at /usr/include/boost/accumulators/framework/depends_on.hpp:252:86: +/usr/include/boost/accumulators/statistics/extended_p_square_quantile.hpp:57:12: error: ‘.boost::accumulators::detail::accumulator_wrapper, boost::accumulators::tag::extended_p_square_quantile_quadratic>::.boost::accumulators::impl::extended_p_square_quantile_impl::probability’ is used uninitialized [-Werror=uninitialized] + 57 | struct extended_p_square_quantile_impl + | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Signed-off-by: Kefu Chai +--- + boost/accumulators/statistics/extended_p_square_quantile.hpp | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/boost/accumulators/statistics/extended_p_square_quantile.hpp b/boost/accumulators/statistics/extended_p_square_quantile.hpp +index f57304c..a4ac3cd 100644 +--- a/boost/accumulators/statistics/extended_p_square_quantile.hpp ++++ b/boost/accumulators/statistics/extended_p_square_quantile.hpp +@@ -76,6 +76,7 @@ namespace impl + boost::begin(args[extended_p_square_probabilities]) + , boost::end(args[extended_p_square_probabilities]) + ) ++ , probability() + { + } + +-- +2.39.2 diff --git a/boost.spec b/boost.spec index 8e0e329..8f69652 100644 --- a/boost.spec +++ b/boost.spec @@ -42,7 +42,7 @@ Name: boost %global real_name boost Summary: The free peer-reviewed portable C++ source libraries Version: 1.81.0 -Release: 7%{?dist} +Release: 8%{?dist} License: BSL-1.0 AND MIT AND Python-2.0.1 # Replace each . with _ in %%{version} @@ -152,6 +152,9 @@ Patch5: boost-1.76.0-fix-narrowing-conversions-for-ppc.patch # https://github.com/boostorg/phoenix/issues/115 Patch6: boost-1.81-phoenix-multiple-defn.patch +# PR https://github.com/boostorg/accumulators/pull/54 +Patch7: boost-1.81.0-always-initialize-member-variable.patch + %bcond_with tests %bcond_with docs_generated @@ -1281,6 +1284,10 @@ fi %{_mandir}/man1/b2.1* %changelog +* Sun Aug 20 2023 Kefu Chai - 1.81.0-8 +- Add patch for Boost.Accumulators bug + See https://github.com/boostorg/accumulators/pull/54 + * Wed Aug 2 2023 Tom Callaway - 1.81.0-7 - add symlink for b2 files