From 8e23ffde9e34d7d95d0c647a2c15c8573b6c3c2f Mon Sep 17 00:00:00 2001 From: Edward Diener Date: Mon, 30 Mar 2020 18:47:19 -0400 Subject: [PATCH 1/5] Change __BORLANDC__ to BOOST_BORLANDC, which is defined in Boost config for the Embarcadero non-clang-based compilers. --- include/boost/algorithm/string/compare.hpp | 6 +++--- include/boost/algorithm/string/detail/case_conv.hpp | 4 ++-- include/boost/algorithm/string/detail/classification.hpp | 2 +- include/boost/algorithm/string/detail/formatter.hpp | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/include/boost/algorithm/string/compare.hpp b/include/boost/algorithm/string/compare.hpp index 734303a..dc34007 100644 --- a/include/boost/algorithm/string/compare.hpp +++ b/include/boost/algorithm/string/compare.hpp @@ -65,7 +65,7 @@ namespace boost { template< typename T1, typename T2 > bool operator()( const T1& Arg1, const T2& Arg2 ) const { - #if defined(__BORLANDC__) && (__BORLANDC__ >= 0x560) && (__BORLANDC__ <= 0x564) && !defined(_USE_OLD_RW_STL) + #if defined(BOOST_BORLANDC) && (BOOST_BORLANDC >= 0x560) && (BOOST_BORLANDC <= 0x564) && !defined(_USE_OLD_RW_STL) return std::toupper(Arg1)==std::toupper(Arg2); #else return std::toupper(Arg1,m_Loc)==std::toupper(Arg2,m_Loc); @@ -118,7 +118,7 @@ namespace boost { template< typename T1, typename T2 > bool operator()( const T1& Arg1, const T2& Arg2 ) const { - #if defined(__BORLANDC__) && (__BORLANDC__ >= 0x560) && (__BORLANDC__ <= 0x564) && !defined(_USE_OLD_RW_STL) + #if defined(BOOST_BORLANDC) && (BOOST_BORLANDC >= 0x560) && (BOOST_BORLANDC <= 0x564) && !defined(_USE_OLD_RW_STL) return std::toupper(Arg1)(Arg1,m_Loc)(Arg2,m_Loc); @@ -171,7 +171,7 @@ namespace boost { template< typename T1, typename T2 > bool operator()( const T1& Arg1, const T2& Arg2 ) const { - #if defined(__BORLANDC__) && (__BORLANDC__ >= 0x560) && (__BORLANDC__ <= 0x564) && !defined(_USE_OLD_RW_STL) + #if defined(BOOST_BORLANDC) && (BOOST_BORLANDC >= 0x560) && (BOOST_BORLANDC <= 0x564) && !defined(_USE_OLD_RW_STL) return std::toupper(Arg1)<=std::toupper(Arg2); #else return std::toupper(Arg1,m_Loc)<=std::toupper(Arg2,m_Loc); diff --git a/include/boost/algorithm/string/detail/case_conv.hpp b/include/boost/algorithm/string/detail/case_conv.hpp index 233912c..3ba317f 100644 --- a/include/boost/algorithm/string/detail/case_conv.hpp +++ b/include/boost/algorithm/string/detail/case_conv.hpp @@ -40,7 +40,7 @@ namespace boost { // Operation CharT operator ()( CharT Ch ) const { - #if defined(__BORLANDC__) && (__BORLANDC__ >= 0x560) && (__BORLANDC__ <= 0x564) && !defined(_USE_OLD_RW_STL) + #if defined(BOOST_BORLANDC) && (BOOST_BORLANDC >= 0x560) && (BOOST_BORLANDC <= 0x564) && !defined(_USE_OLD_RW_STL) return std::tolower( static_cast::type> ( Ch )); #else return std::tolower( Ch, *m_Loc ); @@ -62,7 +62,7 @@ namespace boost { // Operation CharT operator ()( CharT Ch ) const { - #if defined(__BORLANDC__) && (__BORLANDC__ >= 0x560) && (__BORLANDC__ <= 0x564) && !defined(_USE_OLD_RW_STL) + #if defined(BOOST_BORLANDC) && (BOOST_BORLANDC >= 0x560) && (BOOST_BORLANDC <= 0x564) && !defined(_USE_OLD_RW_STL) return std::toupper( static_cast::type> ( Ch )); #else return std::toupper( Ch, *m_Loc ); diff --git a/include/boost/algorithm/string/detail/classification.hpp b/include/boost/algorithm/string/detail/classification.hpp index 704d9d2..febf8b7 100644 --- a/include/boost/algorithm/string/detail/classification.hpp +++ b/include/boost/algorithm/string/detail/classification.hpp @@ -45,7 +45,7 @@ namespace boost { return std::use_facet< std::ctype >(m_Locale).is( m_Type, Ch ); } - #if defined(__BORLANDC__) && (__BORLANDC__ >= 0x560) && (__BORLANDC__ <= 0x582) && !defined(_USE_OLD_RW_STL) + #if defined(BOOST_BORLANDC) && (BOOST_BORLANDC >= 0x560) && (BOOST_BORLANDC <= 0x582) && !defined(_USE_OLD_RW_STL) template<> bool operator()( char const Ch ) const { diff --git a/include/boost/algorithm/string/detail/formatter.hpp b/include/boost/algorithm/string/detail/formatter.hpp index c071822..f4c6728 100644 --- a/include/boost/algorithm/string/detail/formatter.hpp +++ b/include/boost/algorithm/string/detail/formatter.hpp @@ -42,7 +42,7 @@ namespace boost { m_Format(::boost::begin(Format), ::boost::end(Format)) {} // Operation -#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) +#if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x564)) template result_type& operator()(const Range2T&) { From 6d86fb3aaa96b3639f5c65f7cbf28afa66cba81a Mon Sep 17 00:00:00 2001 From: Marshall Clow Date: Tue, 28 Apr 2020 12:41:10 -0700 Subject: [PATCH 2/5] Change include of boost/bind.hpp -> boost/bind/bind.hpp. Thanks to Andrey for the suggested patch --- include/boost/algorithm/gather.hpp | 8 +++++--- string/example/predicate_example.cpp | 2 -- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/boost/algorithm/gather.hpp b/include/boost/algorithm/gather.hpp index 7a0fdf2..e777f8b 100644 --- a/include/boost/algorithm/gather.hpp +++ b/include/boost/algorithm/gather.hpp @@ -22,9 +22,10 @@ #include // for std::stable_partition #include +#include // for std::make_pair #include -#include // for boost::bind +#include // for boost::bind #include // for boost::begin(range) #include // for boost::end(range) @@ -81,13 +82,14 @@ namespace boost { namespace algorithm { */ template < - typename BidirectionalIterator, // Iter models BidirectionalIterator - typename Pred> // Pred models UnaryPredicate + typename BidirectionalIterator, // models BidirectionalIterator + typename Pred> // models UnaryPredicate std::pair gather ( BidirectionalIterator first, BidirectionalIterator last, BidirectionalIterator pivot, Pred pred ) { // The first call partitions everything up to (but not including) the pivot element, // while the second call partitions the rest of the sequence. + using namespace boost::placeholders; return std::make_pair ( std::stable_partition ( first, pivot, !boost::bind ( pred, _1 )), std::stable_partition ( pivot, last, boost::bind ( pred, _1 ))); diff --git a/string/example/predicate_example.cpp b/string/example/predicate_example.cpp index 473ab8b..26d24e4 100644 --- a/string/example/predicate_example.cpp +++ b/string/example/predicate_example.cpp @@ -12,8 +12,6 @@ #include #include #include -#include - using namespace std; using namespace boost; From ed4033f0ccf859baf37db544996bd31a3056a374 Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Mon, 11 May 2020 17:21:24 +0300 Subject: [PATCH 3/5] Avoid using deprecated header boost/detail/iterator.hpp. This header is deprecated in favor of and will be removed in a future release. This silences deprecation warnings. --- include/boost/algorithm/string/detail/finder.hpp | 14 +++++++------- include/boost/algorithm/string/detail/trim.hpp | 6 +++--- include/boost/algorithm/string/predicate.hpp | 7 ++++--- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/include/boost/algorithm/string/detail/finder.hpp b/include/boost/algorithm/string/detail/finder.hpp index a2a9582..112fde9 100644 --- a/include/boost/algorithm/string/detail/finder.hpp +++ b/include/boost/algorithm/string/detail/finder.hpp @@ -13,7 +13,7 @@ #include #include -#include +#include #include #include @@ -127,8 +127,8 @@ namespace boost { if( boost::empty(m_Search) ) return result_type( End, End ); - typedef BOOST_STRING_TYPENAME boost::detail:: - iterator_traits::iterator_category category; + typedef BOOST_STRING_TYPENAME + std::iterator_traits::iterator_category category; return findit( Begin, End, category() ); } @@ -375,8 +375,8 @@ namespace boost { ForwardIteratorT End, unsigned int N ) { - typedef BOOST_STRING_TYPENAME boost::detail:: - iterator_traits::iterator_category category; + typedef BOOST_STRING_TYPENAME + std::iterator_traits::iterator_category category; return ::boost::algorithm::detail::find_head_impl( Begin, End, N, category() ); } @@ -448,8 +448,8 @@ namespace boost { ForwardIteratorT End, unsigned int N ) { - typedef BOOST_STRING_TYPENAME boost::detail:: - iterator_traits::iterator_category category; + typedef BOOST_STRING_TYPENAME + std::iterator_traits::iterator_category category; return ::boost::algorithm::detail::find_tail_impl( Begin, End, N, category() ); } diff --git a/include/boost/algorithm/string/detail/trim.hpp b/include/boost/algorithm/string/detail/trim.hpp index 1233e49..3bb4ef2 100644 --- a/include/boost/algorithm/string/detail/trim.hpp +++ b/include/boost/algorithm/string/detail/trim.hpp @@ -12,7 +12,7 @@ #define BOOST_STRING_TRIM_DETAIL_HPP #include -#include +#include namespace boost { namespace algorithm { @@ -80,8 +80,8 @@ namespace boost { ForwardIteratorT InEnd, PredicateT IsSpace ) { - typedef BOOST_STRING_TYPENAME boost::detail:: - iterator_traits::iterator_category category; + typedef BOOST_STRING_TYPENAME + std::iterator_traits::iterator_category category; return ::boost::algorithm::detail::trim_end_iter_select( InBegin, InEnd, IsSpace, category() ); } diff --git a/include/boost/algorithm/string/predicate.hpp b/include/boost/algorithm/string/predicate.hpp index 0879829..d7c86e8 100644 --- a/include/boost/algorithm/string/predicate.hpp +++ b/include/boost/algorithm/string/predicate.hpp @@ -11,6 +11,7 @@ #ifndef BOOST_STRING_PREDICATE_HPP #define BOOST_STRING_PREDICATE_HPP +#include #include #include #include @@ -144,10 +145,10 @@ namespace boost { iterator_range::type> lit_input(::boost::as_literal(Input)); iterator_range::type> lit_test(::boost::as_literal(Test)); - typedef BOOST_STRING_TYPENAME + typedef BOOST_STRING_TYPENAME range_const_iterator::type Iterator1T; - typedef BOOST_STRING_TYPENAME boost::detail:: - iterator_traits::iterator_category category; + typedef BOOST_STRING_TYPENAME + std::iterator_traits::iterator_category category; return detail:: ends_with_iter_select( From 8710bbd4b698c331725dee6dccc6fdedcc0e5e85 Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Mon, 11 May 2020 18:42:15 +0300 Subject: [PATCH 4/5] Remove a few leftover uses of boost/detail/iterator.hpp. --- include/boost/algorithm/string/find_format.hpp | 3 +-- include/boost/algorithm/string/formatter.hpp | 1 - string/example/rle_example.cpp | 10 +++++----- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/include/boost/algorithm/string/find_format.hpp b/include/boost/algorithm/string/find_format.hpp index 0e84a4e..4d9315c 100644 --- a/include/boost/algorithm/string/find_format.hpp +++ b/include/boost/algorithm/string/find_format.hpp @@ -12,7 +12,6 @@ #define BOOST_STRING_FIND_FORMAT_HPP #include -#include #include #include #include @@ -40,7 +39,7 @@ namespace boost { this substring and replace it in the input. The result is a modified copy of the input. It is returned as a sequence or copied to the output iterator. - + \param Output An output iterator to which the result will be copied \param Input An input sequence \param Finder A Finder object used to search for a match to be replaced diff --git a/include/boost/algorithm/string/formatter.hpp b/include/boost/algorithm/string/formatter.hpp index de8681b..0e08ae7 100644 --- a/include/boost/algorithm/string/formatter.hpp +++ b/include/boost/algorithm/string/formatter.hpp @@ -11,7 +11,6 @@ #ifndef BOOST_STRING_FORMATTER_HPP #define BOOST_STRING_FORMATTER_HPP -#include #include #include #include diff --git a/string/example/rle_example.cpp b/string/example/rle_example.cpp index 9e52b96..ff47ccc 100644 --- a/string/example/rle_example.cpp +++ b/string/example/rle_example.cpp @@ -16,7 +16,7 @@ #include #include #include -#include +#include #include #include @@ -46,7 +46,7 @@ struct find_compressF ForwardIteratorT End ) const { typedef ForwardIteratorT input_iterator_type; - typedef typename boost::detail::iterator_traits::value_type value_type; + typedef typename std::iterator_traits::value_type value_type; typedef iterator_range result_type; // begin of the matching segment @@ -144,7 +144,7 @@ struct find_decompressF ForwardIteratorT End ) const { typedef ForwardIteratorT input_iterator_type; - typedef typename boost::detail::iterator_traits::value_type value_type; + typedef typename std::iterator_traits::value_type value_type; typedef iterator_range result_type; for(input_iterator_type It=Begin; It!=End; It++) @@ -153,12 +153,12 @@ struct find_decompressF { // Repeat mark found, extract body input_iterator_type It2=It++; - + if ( It==End ) break; It++; if ( It==End ) break; It++; - + return result_type( It2, It ); } } From 130e4da8cba8b3c980cdd52265bc49fbf436f513 Mon Sep 17 00:00:00 2001 From: Marshall Clow Date: Thu, 28 May 2020 22:05:47 -0700 Subject: [PATCH 5/5] Remove empty loop bodies to prevent clang 'extra-semi-stmt warnings'. Thanks to Eugene for the heads-up --- include/boost/algorithm/string/detail/finder.hpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/include/boost/algorithm/string/detail/finder.hpp b/include/boost/algorithm/string/detail/finder.hpp index 112fde9..8e70240 100644 --- a/include/boost/algorithm/string/detail/finder.hpp +++ b/include/boost/algorithm/string/detail/finder.hpp @@ -344,9 +344,8 @@ namespace boost { typedef iterator_range result_type; input_iterator_type It=Begin; - for( - unsigned int Index=0; - Index result_type; input_iterator_type It=End; - for( - unsigned int Index=0; - Index