Remove more old compiler workarounds.

This commit is contained in:
jzmaddock
2021-01-25 11:53:39 +00:00
parent 33c9ed2d42
commit ce47bbe593
6 changed files with 1 additions and 98 deletions

View File

@ -166,16 +166,12 @@ struct regex_data : public named_subexpressions
::boost::regex_traits_wrapper<traits> >& t) ::boost::regex_traits_wrapper<traits> >& t)
: m_ptraits(t), m_flags(0), m_status(0), m_expression(0), m_expression_len(0), : m_ptraits(t), m_flags(0), m_status(0), m_expression(0), m_expression_len(0),
m_mark_count(0), m_first_state(0), m_restart_type(0), m_mark_count(0), m_first_state(0), m_restart_type(0),
#if !defined(BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX) && !(defined(BOOST_REGEX_MSVC) && (BOOST_REGEX_MSVC < 1900))
m_startmap{ 0 }, m_startmap{ 0 },
#endif
m_can_be_null(0), m_word_mask(0), m_has_recursions(false), m_disable_match_any(false) {} m_can_be_null(0), m_word_mask(0), m_has_recursions(false), m_disable_match_any(false) {}
regex_data() regex_data()
: m_ptraits(new ::boost::regex_traits_wrapper<traits>()), m_flags(0), m_status(0), m_expression(0), m_expression_len(0), : m_ptraits(new ::boost::regex_traits_wrapper<traits>()), m_flags(0), m_status(0), m_expression(0), m_expression_len(0),
m_mark_count(0), m_first_state(0), m_restart_type(0), m_mark_count(0), m_first_state(0), m_restart_type(0),
#if !defined(BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX) && !(defined(BOOST_REGEX_MSVC) && (BOOST_REGEX_MSVC < 1900))
m_startmap{ 0 }, m_startmap{ 0 },
#endif
m_can_be_null(0), m_word_mask(0), m_has_recursions(false), m_disable_match_any(false) {} m_can_be_null(0), m_word_mask(0), m_has_recursions(false), m_disable_match_any(false) {}
::std::shared_ptr< ::std::shared_ptr<
@ -390,7 +386,6 @@ public:
{ {
return do_assign(p1, p2, f); return do_assign(p1, p2, f);
} }
#if !defined(BOOST_NO_MEMBER_TEMPLATES)
template <class ST, class SA> template <class ST, class SA>
unsigned int set_expression(const std::basic_string<charT, ST, SA>& p, flag_type f = regex_constants::normal) unsigned int set_expression(const std::basic_string<charT, ST, SA>& p, flag_type f = regex_constants::normal)
@ -444,30 +439,6 @@ public:
} }
return assign(static_cast<const charT*>(0), static_cast<const charT*>(0), f); return assign(static_cast<const charT*>(0), static_cast<const charT*>(0), f);
} }
#else
unsigned int set_expression(const std::basic_string<charT>& p, flag_type f = regex_constants::normal)
{
return set_expression(p.data(), p.data() + p.size(), f);
}
basic_regex(const std::basic_string<charT>& p, flag_type f = regex_constants::normal)
{
assign(p, f);
}
basic_regex& operator=(const std::basic_string<charT>& p)
{
return assign(p.data(), p.data() + p.size(), regex_constants::normal);
}
basic_regex& assign(
const std::basic_string<charT>& s,
flag_type f = regex_constants::normal)
{
return assign(s.data(), s.data() + s.size(), f);
}
#endif
// //
// locale: // locale:
@ -695,7 +666,6 @@ void swap(basic_regex<charT, traits>& e1, basic_regex<charT, traits>& e2)
e1.swap(e2); e1.swap(e2);
} }
#ifndef BOOST_NO_STD_LOCALE
template <class charT, class traits, class traits2> template <class charT, class traits, class traits2>
std::basic_ostream<charT, traits>& std::basic_ostream<charT, traits>&
operator << (std::basic_ostream<charT, traits>& os, operator << (std::basic_ostream<charT, traits>& os,
@ -703,13 +673,6 @@ std::basic_ostream<charT, traits>&
{ {
return (os << e.str()); return (os << e.str());
} }
#else
template <class traits>
std::ostream& operator << (std::ostream& os, const basic_regex<char, traits>& e)
{
return (os << e.str());
}
#endif
// //
// class reg_expression: // class reg_expression:
@ -741,7 +704,6 @@ public:
return this->assign(that); return this->assign(that);
} }
#if !defined(BOOST_NO_MEMBER_TEMPLATES)
template <class ST, class SA> template <class ST, class SA>
explicit reg_expression(const std::basic_string<charT, ST, SA>& p, flag_type f = regex_constants::normal) explicit reg_expression(const std::basic_string<charT, ST, SA>& p, flag_type f = regex_constants::normal)
: basic_regex<charT, traits>(p, f) : basic_regex<charT, traits>(p, f)
@ -760,18 +722,6 @@ public:
this->assign(p); this->assign(p);
return *this; return *this;
} }
#else
explicit reg_expression(const std::basic_string<charT>& p, flag_type f = regex_constants::normal)
: basic_regex<charT, traits>(p, f)
{
}
reg_expression& operator=(const std::basic_string<charT>& p)
{
this->assign(p);
return *this;
}
#endif
}; };

View File

@ -42,9 +42,7 @@ struct digraph : public std::pair<charT, charT>
digraph(charT c1, charT c2) : std::pair<charT, charT>(c1, c2) digraph(charT c1, charT c2) : std::pair<charT, charT>(c1, c2)
{} {}
digraph(const digraph<charT>& d) : std::pair<charT, charT>(d.first, d.second){} digraph(const digraph<charT>& d) : std::pair<charT, charT>(d.first, d.second){}
#ifndef BOOST_NO_CXX11_DEFAULTED_FUNCTIONS
digraph<charT>& operator=(const digraph<charT>&) = default; digraph<charT>& operator=(const digraph<charT>&) = default;
#endif
template <class Seq> template <class Seq>
digraph(const Seq& s) : std::pair<charT, charT>() digraph(const Seq& s) : std::pair<charT, charT>()
{ {

View File

@ -202,7 +202,6 @@ void basic_regex_parser<charT, traits>::fail(regex_constants::error_type error_c
this->m_pdata->m_status = error_code; this->m_pdata->m_status = error_code;
m_position = m_end; // don't bother parsing anything else m_position = m_end; // don't bother parsing anything else
#ifndef BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS
// //
// Augment error message with the regular expression text: // Augment error message with the regular expression text:
// //
@ -223,7 +222,6 @@ void basic_regex_parser<charT, traits>::fail(regex_constants::error_type error_c
} }
message += "'."; message += "'.";
} }
#endif
#ifndef BOOST_NO_EXCEPTIONS #ifndef BOOST_NO_EXCEPTIONS
if(0 == (this->flags() & regex_constants::no_except)) if(0 == (this->flags() & regex_constants::no_except))
@ -457,13 +455,8 @@ bool basic_regex_parser<charT, traits>::parse_open_paren()
if(0 == (this->flags() & regbase::nosubs)) if(0 == (this->flags() & regbase::nosubs))
{ {
markid = ++m_mark_count; markid = ++m_mark_count;
#ifndef BOOST_NO_STD_DISTANCE
if(this->flags() & regbase::save_subexpression_location) if(this->flags() & regbase::save_subexpression_location)
this->m_pdata->m_subs.push_back(std::pair<std::size_t, std::size_t>(std::distance(m_base, m_position) - 1, 0)); this->m_pdata->m_subs.push_back(std::pair<std::size_t, std::size_t>(std::distance(m_base, m_position) - 1, 0));
#else
if(this->flags() & regbase::save_subexpression_location)
this->m_pdata->m_subs.push_back(std::pair<std::size_t, std::size_t>((m_position - m_base) - 1, 0));
#endif
} }
re_brace* pb = static_cast<re_brace*>(this->append_state(syntax_element_startmark, sizeof(re_brace))); re_brace* pb = static_cast<re_brace*>(this->append_state(syntax_element_startmark, sizeof(re_brace)));
pb->index = markid; pb->index = markid;
@ -522,13 +515,8 @@ bool basic_regex_parser<charT, traits>::parse_open_paren()
} }
if(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_close_mark) if(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_close_mark)
return false; return false;
#ifndef BOOST_NO_STD_DISTANCE
if(markid && (this->flags() & regbase::save_subexpression_location)) if(markid && (this->flags() & regbase::save_subexpression_location))
this->m_pdata->m_subs.at(markid - 1).second = std::distance(m_base, m_position); this->m_pdata->m_subs.at(markid - 1).second = std::distance(m_base, m_position);
#else
if(markid && (this->flags() & regbase::save_subexpression_location))
this->m_pdata->m_subs.at(markid - 1).second = (m_position - m_base);
#endif
++m_position; ++m_position;
// //
// append closing parenthesis state: // append closing parenthesis state:
@ -2428,13 +2416,8 @@ named_capture_jump:
if(0 == (this->flags() & regbase::nosubs)) if(0 == (this->flags() & regbase::nosubs))
{ {
markid = ++m_mark_count; markid = ++m_mark_count;
#ifndef BOOST_NO_STD_DISTANCE
if(this->flags() & regbase::save_subexpression_location) if(this->flags() & regbase::save_subexpression_location)
this->m_pdata->m_subs.push_back(std::pair<std::size_t, std::size_t>(std::distance(m_base, m_position) - 2, 0)); this->m_pdata->m_subs.push_back(std::pair<std::size_t, std::size_t>(std::distance(m_base, m_position) - 2, 0));
#else
if(this->flags() & regbase::save_subexpression_location)
this->m_pdata->m_subs.push_back(std::pair<std::size_t, std::size_t>((m_position - m_base) - 2, 0));
#endif
} }
pb->index = markid; pb->index = markid;
const charT* base = ++m_position; const charT* base = ++m_position;
@ -2707,13 +2690,8 @@ option_group_jump:
if(markid > 0) if(markid > 0)
{ {
#ifndef BOOST_NO_STD_DISTANCE
if(this->flags() & regbase::save_subexpression_location) if(this->flags() & regbase::save_subexpression_location)
this->m_pdata->m_subs.at((std::size_t)markid - 1).second = std::distance(m_base, m_position) - 1; this->m_pdata->m_subs.at((std::size_t)markid - 1).second = std::distance(m_base, m_position) - 1;
#else
if(this->flags() & regbase::save_subexpression_location)
this->m_pdata->m_subs.at(markid - 1).second = (m_position - m_base) - 1;
#endif
// //
// allow backrefs to this mark: // allow backrefs to this mark:
// //

View File

@ -24,8 +24,6 @@
#include <locale> #include <locale>
#include <type_traits> #include <type_traits>
#ifndef BOOST_NO_STD_LOCALE
#include <boost/regex/pattern_except.hpp> #include <boost/regex/pattern_except.hpp>
#include <boost/regex/v5/regex_traits_defaults.hpp> #include <boost/regex/v5/regex_traits_defaults.hpp>
@ -160,33 +158,25 @@ struct cpp_regex_traits_base
std::locale m_locale; std::locale m_locale;
std::ctype<charT> const* m_pctype; std::ctype<charT> const* m_pctype;
#ifndef BOOST_NO_STD_MESSAGES
std::messages<charT> const* m_pmessages; std::messages<charT> const* m_pmessages;
#endif
std::collate<charT> const* m_pcollate; std::collate<charT> const* m_pcollate;
bool operator<(const cpp_regex_traits_base& b)const bool operator<(const cpp_regex_traits_base& b)const
{ {
if(m_pctype == b.m_pctype) if(m_pctype == b.m_pctype)
{ {
#ifndef BOOST_NO_STD_MESSAGES
if(m_pmessages == b.m_pmessages) if(m_pmessages == b.m_pmessages)
{ {
return m_pcollate < b.m_pcollate; return m_pcollate < b.m_pcollate;
} }
return m_pmessages < b.m_pmessages; return m_pmessages < b.m_pmessages;
#else
return m_pcollate < b.m_pcollate;
#endif
} }
return m_pctype < b.m_pctype; return m_pctype < b.m_pctype;
} }
bool operator==(const cpp_regex_traits_base& b)const bool operator==(const cpp_regex_traits_base& b)const
{ {
return (m_pctype == b.m_pctype) return (m_pctype == b.m_pctype)
#ifndef BOOST_NO_STD_MESSAGES
&& (m_pmessages == b.m_pmessages) && (m_pmessages == b.m_pmessages)
#endif
&& (m_pcollate == b.m_pcollate); && (m_pcollate == b.m_pcollate);
} }
}; };
@ -197,9 +187,7 @@ std::locale cpp_regex_traits_base<charT>::imbue(const std::locale& l)
std::locale result(m_locale); std::locale result(m_locale);
m_locale = l; m_locale = l;
m_pctype = &std::use_facet<std::ctype<charT>>(l); m_pctype = &std::use_facet<std::ctype<charT>>(l);
#ifndef BOOST_NO_STD_MESSAGES
m_pmessages = std::has_facet<std::messages<charT> >(l) ? &std::use_facet<std::messages<charT> >(l) : 0; m_pmessages = std::has_facet<std::messages<charT> >(l) ? &std::use_facet<std::messages<charT> >(l) : 0;
#endif
m_pcollate = &std::use_facet<std::collate<charT> >(l); m_pcollate = &std::use_facet<std::collate<charT> >(l);
return result; return result;
} }
@ -255,7 +243,6 @@ void cpp_regex_traits_char_layer<charT>::init()
{ {
// we need to start by initialising our syntax map so we know which // we need to start by initialising our syntax map so we know which
// character is used for which purpose: // character is used for which purpose:
#ifndef BOOST_NO_STD_MESSAGES
#ifndef __IBMCPP__ #ifndef __IBMCPP__
typename std::messages<charT>::catalog cat = static_cast<std::messages<char>::catalog>(-1); typename std::messages<charT>::catalog cat = static_cast<std::messages<char>::catalog>(-1);
#else #else
@ -303,7 +290,6 @@ void cpp_regex_traits_char_layer<charT>::init()
} }
else else
{ {
#endif
for(regex_constants::syntax_type i = 1; i < regex_constants::syntax_max; ++i) for(regex_constants::syntax_type i = 1; i < regex_constants::syntax_max; ++i)
{ {
const char* ptr = get_default_syntax(i); const char* ptr = get_default_syntax(i);
@ -313,9 +299,7 @@ void cpp_regex_traits_char_layer<charT>::init()
++ptr; ++ptr;
} }
} }
#ifndef BOOST_NO_STD_MESSAGES
} }
#endif
} }
template <class charT> template <class charT>
@ -971,7 +955,6 @@ namespace BOOST_REGEX_DETAIL_NS {
// we need to start by initialising our syntax map so we know which // we need to start by initialising our syntax map so we know which
// character is used for which purpose: // character is used for which purpose:
std::memset(m_char_map, 0, sizeof(m_char_map)); std::memset(m_char_map, 0, sizeof(m_char_map));
#ifndef BOOST_NO_STD_MESSAGES
#ifndef __IBMCPP__ #ifndef __IBMCPP__
std::messages<char>::catalog cat = static_cast<std::messages<char>::catalog>(-1); std::messages<char>::catalog cat = static_cast<std::messages<char>::catalog>(-1);
#else #else
@ -1018,7 +1001,6 @@ namespace BOOST_REGEX_DETAIL_NS {
} }
else else
{ {
#endif
for (regex_constants::syntax_type j = 1; j < regex_constants::syntax_max; ++j) for (regex_constants::syntax_type j = 1; j < regex_constants::syntax_max; ++j)
{ {
const char* ptr = get_default_syntax(j); const char* ptr = get_default_syntax(j);
@ -1028,9 +1010,7 @@ namespace BOOST_REGEX_DETAIL_NS {
++ptr; ++ptr;
} }
} }
#ifndef BOOST_NO_STD_MESSAGES
} }
#endif
// //
// finish off by calculating our escape types: // finish off by calculating our escape types:
// //
@ -1056,6 +1036,5 @@ namespace BOOST_REGEX_DETAIL_NS {
#pragma warning(pop) #pragma warning(pop)
#endif #endif
#endif
#endif #endif

View File

@ -51,7 +51,7 @@ namespace boost{
extern "C" { extern "C" {
#endif #endif
#if defined(__cplusplus) && !defined(BOOST_NO_STDC_NAMESPACE) #if defined(__cplusplus)
typedef std::ptrdiff_t regoff_t; typedef std::ptrdiff_t regoff_t;
typedef std::size_t regsize_t; typedef std::size_t regsize_t;
#else #else

View File

@ -75,10 +75,8 @@ public:
static const bool value = answer::value; static const bool value = answer::value;
}; };
#ifndef BOOST_NO_INCLASS_MEMBER_INITIALIZATION
template <class I> template <class I>
const bool is_random_access_iterator<I>::value; const bool is_random_access_iterator<I>::value;
#endif
} }