Updated boost patch to fix exception error.

This commit is contained in:
Axel 2020-02-25 09:51:54 +01:00 committed by bernat
parent c27aa1e40b
commit 4cfcf1e52a
3 changed files with 53 additions and 19 deletions

View File

@ -87,7 +87,7 @@
#include <boost/type_traits/is_convertible.hpp>
#include <boost/type_traits/is_class.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/core/no_exceptions_support.hpp>
#include <boost/type_traits/is_array.hpp>
// Control whether depreciated GCD and LCM functions are included (default: yes)
#ifndef BOOST_CONTROL_RATIONAL_HAS_GCD
@ -114,8 +114,11 @@ IntType lcm(IntType n, IntType m)
namespace rational_detail{
template <class FromInt, class ToInt, typename Enable = void>
struct is_compatible_integer;
template <class FromInt, class ToInt>
struct is_compatible_integer
struct is_compatible_integer<FromInt, ToInt, typename enable_if_c<!is_array<FromInt>::value>::type>
{
BOOST_STATIC_CONSTANT(bool, value = ((std::numeric_limits<FromInt>::is_specialized && std::numeric_limits<FromInt>::is_integer
&& (std::numeric_limits<FromInt>::digits <= std::numeric_limits<ToInt>::digits)
@ -126,6 +129,29 @@ namespace rational_detail{
|| (is_class<ToInt>::value && is_class<FromInt>::value && is_convertible<FromInt, ToInt>::value));
};
template <class FromInt, class ToInt>
struct is_compatible_integer<FromInt, ToInt, typename enable_if_c<is_array<FromInt>::value>::type>
{
BOOST_STATIC_CONSTANT(bool, value = false);
};
template <class FromInt, class ToInt, typename Enable = void>
struct is_backward_compatible_integer;
template <class FromInt, class ToInt>
struct is_backward_compatible_integer<FromInt, ToInt, typename enable_if_c<!is_array<FromInt>::value>::type>
{
BOOST_STATIC_CONSTANT(bool, value = (std::numeric_limits<FromInt>::is_specialized && std::numeric_limits<FromInt>::is_integer
&& !is_compatible_integer<FromInt, ToInt>::value
&& (std::numeric_limits<FromInt>::radix == std::numeric_limits<ToInt>::radix)
&& is_convertible<FromInt, ToInt>::value));
};
template <class FromInt, class ToInt>
struct is_backward_compatible_integer<FromInt, ToInt, typename enable_if_c<is_array<FromInt>::value>::type>
{
BOOST_STATIC_CONSTANT(bool, value = false);
};
}
class bad_rational : public std::domain_error
@ -153,10 +179,12 @@ public:
BOOST_CONSTEXPR
rational() : num(0), den(1) {}
template <class T>
template <class T>//, typename enable_if_c<!is_array<T>::value>::type>
BOOST_CONSTEXPR rational(const T& n, typename enable_if_c<
rational_detail::is_compatible_integer<T, IntType>::value
>::type const* = 0) : num(n), den(1) {}
template <class T, class U>
BOOST_CXX14_CONSTEXPR rational(const T& n, const U& d, typename enable_if_c<
rational_detail::is_compatible_integer<T, IntType>::value && rational_detail::is_compatible_integer<U, IntType>::value
@ -201,12 +229,9 @@ public:
// conversion from T to IntType, they will throw a bad_rational
// if the conversion results in loss of precision or undefined behaviour.
//
template <class T>
template <class T>//, typename enable_if_c<!is_array<T>::value>::type>
BOOST_CXX14_CONSTEXPR rational(const T& n, typename enable_if_c<
std::numeric_limits<T>::is_specialized && std::numeric_limits<T>::is_integer
&& !rational_detail::is_compatible_integer<T, IntType>::value
&& (std::numeric_limits<T>::radix == std::numeric_limits<IntType>::radix)
&& is_convertible<T, IntType>::value
rational_detail::is_backward_compatible_integer<T, IntType>::value
>::type const* = 0)
{
assign(n, static_cast<T>(1));
@ -921,7 +946,7 @@ std::istream& operator>> (std::istream& is, rational<IntType>& r)
if ( c == '/' )
{
if ( is >> std::noskipws >> d )
BOOST_TRY {
BOOST_TRY {
r.assign( n, d );
} BOOST_CATCH ( bad_rational & ) { // normalization fail
BOOST_TRY { is.setstate(ios::failbit); }

View File

@ -5,8 +5,8 @@
// Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
// Copyright (c) 2017 Adam Wulkiewicz, Lodz, Poland.
// This file was modified by Oracle on 2014, 2015.
// Modifications copyright (c) 2014-2015 Oracle and/or its affiliates.
// This file was modified by Oracle on 2014, 2015, 2018.
// Modifications copyright (c) 2014-2018 Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
@ -39,7 +39,7 @@
#include <boost/geometry/algorithms/assign.hpp>
#include <boost/geometry/algorithms/append.hpp>
#include <boost/geometry/algorithms/clear.hpp>
#include <boost/geometry/algorithms/detail/equals/point_point.hpp>
#include <boost/geometry/algorithms/detail/disjoint/point_point.hpp>
#include <boost/geometry/core/access.hpp>
#include <boost/geometry/core/coordinate_dimension.hpp>
@ -51,7 +51,6 @@
#include <boost/geometry/core/point_type.hpp>
#include <boost/geometry/core/tag_cast.hpp>
#include <boost/geometry/core/tags.hpp>
#include <boost/core/no_exceptions_support.hpp>
#include <boost/geometry/geometries/concepts/check.hpp>
@ -127,8 +126,7 @@ struct parsing_assigner
// Stop at end of tokens, or at "," ot ")"
bool finished = (it == end || *it == "," || *it == ")");
BOOST_TRY
BOOST_TRY
{
// Initialize missing coordinates to default constructor (zero)
// OR
@ -156,7 +154,7 @@ struct parsing_assigner
BOOST_RETHROW;
}
BOOST_CATCH_END
parsing_assigner<Point, Dimension + 1, DimensionCount>::apply(
(finished ? it : ++it), end, point, wkt);
}
@ -300,7 +298,7 @@ struct stateful_range_appender<Geometry, open>
should_append
= is_next_expected
|| pt_index < core_detail::closure::minimum_ring_size<open>::value
|| !detail::equals::equals_point_point(point, first_point);
|| disjoint(point, first_point);
}
++pt_index;
@ -311,6 +309,17 @@ struct stateful_range_appender<Geometry, open>
}
private:
static inline bool disjoint(point_type const& p1, point_type const& p2)
{
// TODO: pass strategy
typedef typename strategy::disjoint::services::default_strategy
<
point_type, point_type
>::type strategy_type;
return detail::disjoint::disjoint_point_point(p1, p2, strategy_type());
}
size_type pt_index;
point_type first_point;
};

View File

@ -157,13 +157,13 @@ else
rm -Rf ${BOOST_BASENAME}-source
rm ${BOOST_PACKAGE_BASENAME}.tar.gz
fi
# Boost patch for exception handling
cp "${CARLA_BUILD_FOLDER}/../Util/BoostFiles/rational.hpp" "${BOOST_BASENAME}-install/include/boost/rational.hpp"
cp "${CARLA_BUILD_FOLDER}/../Util/BoostFiles/read.hpp" "${BOOST_BASENAME}-install/include/boost/geometry/io/wkt/read.hpp"
# ---
fi
unset BOOST_BASENAME
# ==============================================================================