Remove more workarounds, start testing standalone mode.

This commit is contained in:
jzmaddock
2020-12-04 12:16:36 +00:00
parent 2b157b4170
commit c902bed6a3
18 changed files with 129 additions and 216 deletions

View File

@ -119,6 +119,9 @@ if ! $(disable-icu)
exe has_icu : has_icu_test.cpp : $(ICU_OPTS) ;
explicit has_icu ;
obj is_legacy_03 : is_legacy_03.cpp ;
explicit is_legacy_03 ;
alias icu_options : : : : [ check-target-builds has_icu : $(ICU_OPTS) : ] ;
SOURCES =

View File

@ -90,6 +90,20 @@
# endif
#endif
/****************************************************************************
*
* Legacy support:
*
*******************************************************************************/
#if defined(BOOST_NO_STD_LOCALE) || defined(BOOST_NO_CXX11_HDR_MUTEX) || defined(BOOST_NO_CXX11_HDR_TYPE_TRAITS) \
|| defined(BOOST_NO_CXX11_HDR_ATOMIC) || defined(BOOST_NO_CXX11_ALLOCATOR) || defined(BOOST_NO_CXX11_SMART_PTR) || defined(BOOST_NO_CXX11_STATIC_ASSERT)
#ifndef BOOST_REGEX_CXX03
# define BOOST_REGEX_CXX03
#endif
#endif
/*****************************************************************************
*
* Boilerplate regex config options:

View File

@ -76,7 +76,11 @@ public:
void raise()const
{
#ifndef BOOST_NO_EXCEPTIONS
#ifndef BOOST_REGEX_STANDALONE
::boost::throw_exception(*this);
#else
throw* this;
#endif
#endif
}
private:
@ -91,7 +95,11 @@ namespace BOOST_REGEX_DETAIL_NS{
inline void BOOST_REGEX_CALL raise_runtime_error(const std::runtime_error& ex)
{
#ifndef BOOST_REGEX_STANDALONE
::boost::throw_exception(ex);
#else
throw ex;
#endif
}
template <class traits>

View File

@ -72,6 +72,11 @@ Accepts UTF-32 code points and forwards them on as UTF-16 code points.
#endif
#include <limits.h> // CHAR_BIT
#ifdef BOOST_REGEX_CXX03
#else
#endif
namespace boost{
namespace detail{

View File

@ -509,8 +509,13 @@ public:
// begin, end, subexpression:
std::pair<const_iterator, const_iterator> subexpression(std::size_t n)const
{
#ifdef BOOST_REGEX_STANDALONE
if (!m_pimpl.get())
throw std::logic_error("Can't access subexpressions in an invalid regex.");
#else
if(!m_pimpl.get())
boost::throw_exception(std::logic_error("Can't access subexpressions in an invalid regex."));
#endif
return m_pimpl->subexpression(n);
}
const_iterator begin()const

View File

@ -245,7 +245,7 @@ protected:
unsigned m_repeater_id; // the state_id of the next repeater
bool m_has_backrefs; // true if there are actually any backrefs
indexed_bit_flag m_backrefs; // bitmask of permitted backrefs
boost::uintmax_t m_bad_repeats; // bitmask of repeats we can't deduce a startmap for;
std::uintmax_t m_bad_repeats; // bitmask of repeats we can't deduce a startmap for;
bool m_has_recursions; // set when we have recursive expressions to fixup
std::vector<unsigned char> m_recursion_checks; // notes which recursions we've followed while analysing this expression
typename traits::char_class_type m_word_mask; // mask used to determine if a character is a word character
@ -1456,7 +1456,7 @@ bool basic_regex_creator<charT, traits>::is_bad_repeat(re_syntax_base* pt)
unsigned state_id = static_cast<re_repeat*>(pt)->state_id;
if(state_id >= sizeof(m_bad_repeats) * CHAR_BIT)
return true; // run out of bits, assume we can't traverse this one.
static const boost::uintmax_t one = 1uL;
static const std::uintmax_t one = 1uL;
return m_bad_repeats & (one << state_id);
}
default:
@ -1476,7 +1476,7 @@ void basic_regex_creator<charT, traits>::set_bad_repeat(re_syntax_base* pt)
case syntax_element_long_set_rep:
{
unsigned state_id = static_cast<re_repeat*>(pt)->state_id;
static const boost::uintmax_t one = 1uL;
static const std::uintmax_t one = 1uL;
if(state_id <= sizeof(m_bad_repeats) * CHAR_BIT)
m_bad_repeats |= (one << state_id);
}

View File

@ -44,19 +44,19 @@ namespace BOOST_REGEX_DETAIL_NS{
#endif
#endif
inline boost::intmax_t umax(std::integral_constant<bool, false> const&)
inline std::intmax_t umax(std::integral_constant<bool, false> const&)
{
// Get out clause here, just in case numeric_limits is unspecialized:
return std::numeric_limits<boost::intmax_t>::is_specialized ? (std::numeric_limits<boost::intmax_t>::max)() : INT_MAX;
return std::numeric_limits<std::intmax_t>::is_specialized ? (std::numeric_limits<std::intmax_t>::max)() : INT_MAX;
}
inline boost::intmax_t umax(std::integral_constant<bool, true> const&)
inline std::intmax_t umax(std::integral_constant<bool, true> const&)
{
return (std::numeric_limits<std::size_t>::max)();
}
inline boost::intmax_t umax()
inline std::intmax_t umax()
{
return umax(std::integral_constant<bool, std::numeric_limits<boost::intmax_t>::digits >= std::numeric_limits<std::size_t>::digits>());
return umax(std::integral_constant<bool, std::numeric_limits<std::intmax_t>::digits >= std::numeric_limits<std::size_t>::digits>());
}
template <class charT, class traits>
@ -911,7 +911,7 @@ escape_type_class_jump:
return false;
}
const charT* pc = m_position;
boost::intmax_t i = this->m_traits.toi(pc, m_end, 10);
std::intmax_t i = this->m_traits.toi(pc, m_end, 10);
if((i < 0) && syn_end)
{
// Check for a named capture, get the leftmost one if there is more than one:
@ -924,7 +924,7 @@ escape_type_class_jump:
pc = m_position;
}
if(negative)
i = 1 + (static_cast<boost::intmax_t>(m_mark_count) - i);
i = 1 + (static_cast<std::intmax_t>(m_mark_count) - i);
if(((i < hash_value_mask) && (i > 0) && (this->m_backrefs.test(i))) || ((i >= hash_value_mask) && (this->m_pdata->get_id(i) > 0) && (this->m_backrefs.test(this->m_pdata->get_id(i)))))
{
m_position = pc;
@ -1151,7 +1151,7 @@ bool basic_regex_parser<charT, traits>::parse_repeat_range(bool isbasic)
// parse a repeat-range:
//
std::size_t min, max;
boost::intmax_t v;
std::intmax_t v;
// skip whitespace:
while((m_position != m_end) && this->m_traits.isctype(*m_position, this->m_mask_space))
++m_position;
@ -1741,19 +1741,19 @@ digraph<charT> basic_regex_parser<charT, traits>::get_next_set_literal(basic_cha
// does a value fit in the specified charT type?
//
template <class charT>
bool valid_value(charT, boost::intmax_t v, const std::integral_constant<bool, true>&)
bool valid_value(charT, std::intmax_t v, const std::integral_constant<bool, true>&)
{
return (v >> (sizeof(charT) * CHAR_BIT)) == 0;
}
template <class charT>
bool valid_value(charT, boost::intmax_t, const std::integral_constant<bool, false>&)
bool valid_value(charT, std::intmax_t, const std::integral_constant<bool, false>&)
{
return true; // v will alsways fit in a charT
}
template <class charT>
bool valid_value(charT c, boost::intmax_t v)
bool valid_value(charT c, std::intmax_t v)
{
return valid_value(c, v, std::integral_constant<bool, (sizeof(charT) < sizeof(boost::intmax_t))>());
return valid_value(c, v, std::integral_constant<bool, (sizeof(charT) < sizeof(std::intmax_t))>());
}
template <class charT, class traits>
@ -1829,10 +1829,10 @@ charT basic_regex_parser<charT, traits>::unescape_character()
fail(regex_constants::error_escape, m_position - m_base, "Missing } in hexadecimal escape sequence.");
return result;
}
boost::intmax_t i = this->m_traits.toi(m_position, m_end, 16);
std::intmax_t i = this->m_traits.toi(m_position, m_end, 16);
if((m_position == m_end)
|| (i < 0)
|| ((std::numeric_limits<charT>::is_specialized) && (i > (boost::intmax_t)(std::numeric_limits<charT>::max)()))
|| ((std::numeric_limits<charT>::is_specialized) && (i > (std::intmax_t)(std::numeric_limits<charT>::max)()))
|| (this->m_traits.syntax_type(*m_position) != regex_constants::syntax_close_brace))
{
// Rewind to start of escape:
@ -1847,7 +1847,7 @@ charT basic_regex_parser<charT, traits>::unescape_character()
else
{
std::ptrdiff_t len = (std::min)(static_cast<std::ptrdiff_t>(2), static_cast<std::ptrdiff_t>(m_end - m_position));
boost::intmax_t i = this->m_traits.toi(m_position, m_position + len, 16);
std::intmax_t i = this->m_traits.toi(m_position, m_position + len, 16);
if((i < 0)
|| !valid_value(charT(0), i))
{
@ -1866,7 +1866,7 @@ charT basic_regex_parser<charT, traits>::unescape_character()
// followed by up to 3 octal digits:
std::ptrdiff_t len = (std::min)(std::distance(m_position, m_end), static_cast<std::ptrdiff_t>(4));
const charT* bp = m_position;
boost::intmax_t val = this->m_traits.toi(bp, bp + 1, 8);
std::intmax_t val = this->m_traits.toi(bp, bp + 1, 8);
if(val != 0)
{
// Rewind to start of escape:
@ -1877,7 +1877,7 @@ charT basic_regex_parser<charT, traits>::unescape_character()
return result;
}
val = this->m_traits.toi(m_position, m_position + len, 8);
if((val < 0) || (val > (boost::intmax_t)(std::numeric_limits<charT>::max)()))
if((val < 0) || (val > (std::intmax_t)(std::numeric_limits<charT>::max)()))
{
// Rewind to start of escape:
--m_position;
@ -1950,7 +1950,7 @@ bool basic_regex_parser<charT, traits>::parse_backref()
{
BOOST_REGEX_ASSERT(m_position != m_end);
const charT* pc = m_position;
boost::intmax_t i = this->m_traits.toi(pc, pc + 1, 10);
std::intmax_t i = this->m_traits.toi(pc, pc + 1, 10);
if((i == 0) || (((this->flags() & regbase::main_option_type) == regbase::perl_syntax_group) && (this->flags() & regbase::no_bk_refs)))
{
// not a backref at all but an octal escape sequence:
@ -2072,7 +2072,7 @@ bool basic_regex_parser<charT, traits>::parse_perl_extension()
int max_mark = m_max_mark;
m_mark_reset = -1;
m_max_mark = m_mark_count;
boost::intmax_t v;
std::intmax_t v;
//
// select the actual extension used:
//
@ -2126,7 +2126,7 @@ insert_recursion:
fail(regex_constants::error_perl_extension, m_position - m_base, "An invalid or unterminated recursive sub-expression.");
return false;
}
if ((std::numeric_limits<boost::intmax_t>::max)() - m_mark_count < v)
if ((std::numeric_limits<std::intmax_t>::max)() - m_mark_count < v)
{
fail(regex_constants::error_perl_extension, m_position - m_base, "An invalid or unterminated recursive sub-expression.");
return false;
@ -2145,7 +2145,7 @@ insert_recursion:
// Oops not a relative recursion at all, but a (?-imsx) group:
goto option_group_jump;
}
v = static_cast<boost::intmax_t>(m_mark_count) + 1 - v;
v = static_cast<std::intmax_t>(m_mark_count) + 1 - v;
if(v <= 0)
{
// Rewind to start of (? sequence:

View File

@ -82,7 +82,7 @@ struct c_regex_traits<char>
typedef std::size_t size_type;
typedef std::string string_type;
struct locale_type{};
typedef boost::uint32_t char_class_type;
typedef std::uint32_t char_class_type;
static size_type length(const char_type* p)
{
@ -127,7 +127,7 @@ struct c_regex_traits<wchar_t>
typedef std::size_t size_type;
typedef std::wstring string_type;
struct locale_type{};
typedef boost::uint32_t char_class_type;
typedef std::uint32_t char_class_type;
static size_type length(const char_type* p)
{

View File

@ -383,29 +383,6 @@ private:
void init();
};
#ifdef BOOST_REGEX_BUGGY_CTYPE_FACET
enum
{
char_class_space=1<<0,
char_class_print=1<<1,
char_class_cntrl=1<<2,
char_class_upper=1<<3,
char_class_lower=1<<4,
char_class_alpha=1<<5,
char_class_digit=1<<6,
char_class_punct=1<<7,
char_class_xdigit=1<<8,
char_class_alnum=char_class_alpha|char_class_digit,
char_class_graph=char_class_alnum|char_class_punct,
char_class_blank=1<<9,
char_class_word=1<<10,
char_class_unicode=1<<11,
char_class_horizontal_space=1<<12,
char_class_vertical_space=1<<13
};
#endif
//
// class cpp_regex_traits_implementation:
// provides pimpl implementation for cpp_regex_traits.
@ -417,13 +394,11 @@ public:
typedef typename cpp_regex_traits<charT>::char_class_type char_class_type;
typedef typename std::ctype<charT>::mask native_mask_type;
typedef typename std::make_unsigned<native_mask_type>::type unsigned_native_mask_type;
#ifndef BOOST_REGEX_BUGGY_CTYPE_FACET
BOOST_STATIC_CONSTANT(char_class_type, mask_blank = 1u << 24);
BOOST_STATIC_CONSTANT(char_class_type, mask_word = 1u << 25);
BOOST_STATIC_CONSTANT(char_class_type, mask_unicode = 1u << 26);
BOOST_STATIC_CONSTANT(char_class_type, mask_horizontal = 1u << 27);
BOOST_STATIC_CONSTANT(char_class_type, mask_vertical = 1u << 28);
#endif
typedef std::basic_string<charT> string_type;
typedef charT char_type;
@ -472,15 +447,8 @@ private:
//
char_class_type lookup_classname_imp(const charT* p1, const charT* p2) const;
void init();
#ifdef BOOST_REGEX_BUGGY_CTYPE_FACET
public:
bool isctype(charT c, char_class_type m)const;
#endif
};
#ifndef BOOST_REGEX_BUGGY_CTYPE_FACET
#if !defined(BOOST_NO_INCLASS_MEMBER_INITIALIZATION)
template <class charT>
typename cpp_regex_traits_implementation<charT>::char_class_type const cpp_regex_traits_implementation<charT>::mask_blank;
template <class charT>
@ -492,9 +460,6 @@ typename cpp_regex_traits_implementation<charT>::char_class_type const cpp_regex
template <class charT>
typename cpp_regex_traits_implementation<charT>::char_class_type const cpp_regex_traits_implementation<charT>::mask_horizontal;
#endif
#endif
template <class charT>
typename cpp_regex_traits_implementation<charT>::string_type
cpp_regex_traits_implementation<charT>::transform_primary(const charT* p1, const charT* p2) const
@ -609,20 +574,10 @@ typename cpp_regex_traits_implementation<charT>::string_type
try{
#endif
result = this->m_pcollate->transform(p1, p2);
//
// Borland's STLPort version returns a NULL-terminated
// string that has garbage at the end - each call to
// std::collate<wchar_t>::transform returns a different string!
// So as a workaround, we'll truncate the string at the first NULL
// which _seems_ to work....
#if BOOST_WORKAROUND(BOOST_BORLANDC, < 0x580)
result.erase(result.find(charT(0)));
#else
//
// some implementations (Dinkumware) append unnecessary trailing \0's:
while((!result.empty()) && (charT(0) == *result.rbegin()))
result.erase(result.size() - 1);
#endif
//
// We may have NULL's used as separators between sections of the collate string,
// an example would be Boost.Locale. We have no way to detect this case via
@ -667,32 +622,10 @@ typename cpp_regex_traits_implementation<charT>::string_type
if(pos != m_custom_collate_names.end())
return pos->second;
}
#if !defined(BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS)\
&& !BOOST_WORKAROUND(BOOST_BORLANDC, <= 0x0551)
std::string name(p1, p2);
#else
std::string name;
const charT* p0 = p1;
while(p0 != p2)
name.append(1, char(*p0++));
#endif
name = lookup_default_collate_name(name);
#if !defined(BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS)\
&& !BOOST_WORKAROUND(BOOST_BORLANDC, <= 0x0551)
if(!name.empty())
return string_type(name.begin(), name.end());
#else
if(!name.empty())
{
string_type result;
typedef std::string::const_iterator iter;
iter b = name.begin();
iter e = name.end();
while(b != e)
result.append(1, charT(*b++));
return result;
}
#endif
if(p2 - p1 == 1)
return string_type(1, *p1);
return string_type();
@ -701,7 +634,6 @@ typename cpp_regex_traits_implementation<charT>::string_type
template <class charT>
void cpp_regex_traits_implementation<charT>::init()
{
#ifndef BOOST_NO_STD_MESSAGES
#ifndef __IBMCPP__
typename std::messages<charT>::catalog cat = static_cast<std::messages<char>::catalog>(-1);
#else
@ -750,7 +682,6 @@ void cpp_regex_traits_implementation<charT>::init()
//
// Custom class names:
//
#ifndef BOOST_REGEX_BUGGY_CTYPE_FACET
static const char_class_type masks[16] =
{
static_cast<unsigned_native_mask_type>(std::ctype<charT>::alnum),
@ -770,27 +701,6 @@ void cpp_regex_traits_implementation<charT>::init()
cpp_regex_traits_implementation<charT>::mask_word,
cpp_regex_traits_implementation<charT>::mask_unicode,
};
#else
static const char_class_type masks[16] =
{
::boost::BOOST_REGEX_DETAIL_NS::char_class_alnum,
::boost::BOOST_REGEX_DETAIL_NS::char_class_alpha,
::boost::BOOST_REGEX_DETAIL_NS::char_class_cntrl,
::boost::BOOST_REGEX_DETAIL_NS::char_class_digit,
::boost::BOOST_REGEX_DETAIL_NS::char_class_graph,
::boost::BOOST_REGEX_DETAIL_NS::char_class_horizontal_space,
::boost::BOOST_REGEX_DETAIL_NS::char_class_lower,
::boost::BOOST_REGEX_DETAIL_NS::char_class_print,
::boost::BOOST_REGEX_DETAIL_NS::char_class_punct,
::boost::BOOST_REGEX_DETAIL_NS::char_class_space,
::boost::BOOST_REGEX_DETAIL_NS::char_class_upper,
::boost::BOOST_REGEX_DETAIL_NS::char_class_vertical_space,
::boost::BOOST_REGEX_DETAIL_NS::char_class_xdigit,
::boost::BOOST_REGEX_DETAIL_NS::char_class_blank,
::boost::BOOST_REGEX_DETAIL_NS::char_class_word,
::boost::BOOST_REGEX_DETAIL_NS::char_class_unicode,
};
#endif
static const string_type null_string;
for(unsigned int j = 0; j <= 13; ++j)
{
@ -799,7 +709,6 @@ void cpp_regex_traits_implementation<charT>::init()
this->m_custom_class_names[s] = masks[j];
}
}
#endif
//
// get the collation format used by m_pcollate:
//
@ -810,7 +719,6 @@ template <class charT>
typename cpp_regex_traits_implementation<charT>::char_class_type
cpp_regex_traits_implementation<charT>::lookup_classname_imp(const charT* p1, const charT* p2) const
{
#ifndef BOOST_REGEX_BUGGY_CTYPE_FACET
static const char_class_type masks[22] =
{
0,
@ -836,33 +744,6 @@ typename cpp_regex_traits_implementation<charT>::char_class_type
static_cast<unsigned_native_mask_type>(std::ctype<char>::alnum) | cpp_regex_traits_implementation<charT>::mask_word,
static_cast<unsigned_native_mask_type>(std::ctype<char>::xdigit),
};
#else
static const char_class_type masks[22] =
{
0,
::boost::BOOST_REGEX_DETAIL_NS::char_class_alnum,
::boost::BOOST_REGEX_DETAIL_NS::char_class_alpha,
::boost::BOOST_REGEX_DETAIL_NS::char_class_blank,
::boost::BOOST_REGEX_DETAIL_NS::char_class_cntrl,
::boost::BOOST_REGEX_DETAIL_NS::char_class_digit,
::boost::BOOST_REGEX_DETAIL_NS::char_class_digit,
::boost::BOOST_REGEX_DETAIL_NS::char_class_graph,
::boost::BOOST_REGEX_DETAIL_NS::char_class_horizontal_space,
::boost::BOOST_REGEX_DETAIL_NS::char_class_lower,
::boost::BOOST_REGEX_DETAIL_NS::char_class_lower,
::boost::BOOST_REGEX_DETAIL_NS::char_class_print,
::boost::BOOST_REGEX_DETAIL_NS::char_class_punct,
::boost::BOOST_REGEX_DETAIL_NS::char_class_space,
::boost::BOOST_REGEX_DETAIL_NS::char_class_space,
::boost::BOOST_REGEX_DETAIL_NS::char_class_upper,
::boost::BOOST_REGEX_DETAIL_NS::char_class_unicode,
::boost::BOOST_REGEX_DETAIL_NS::char_class_upper,
::boost::BOOST_REGEX_DETAIL_NS::char_class_vertical_space,
::boost::BOOST_REGEX_DETAIL_NS::char_class_alnum | ::boost::BOOST_REGEX_DETAIL_NS::char_class_word,
::boost::BOOST_REGEX_DETAIL_NS::char_class_alnum | ::boost::BOOST_REGEX_DETAIL_NS::char_class_word,
::boost::BOOST_REGEX_DETAIL_NS::char_class_xdigit,
};
#endif
if(!m_custom_class_names.empty())
{
typedef typename std::map<std::basic_string<charT>, char_class_type>::const_iterator map_iter;
@ -875,29 +756,6 @@ typename cpp_regex_traits_implementation<charT>::char_class_type
return masks[state_id];
}
#ifdef BOOST_REGEX_BUGGY_CTYPE_FACET
template <class charT>
bool cpp_regex_traits_implementation<charT>::isctype(const charT c, char_class_type mask) const
{
return
((mask & ::boost::BOOST_REGEX_DETAIL_NS::char_class_space) && (this->m_pctype->is(std::ctype<charT>::space, c)))
|| ((mask & ::boost::BOOST_REGEX_DETAIL_NS::char_class_print) && (this->m_pctype->is(std::ctype<charT>::print, c)))
|| ((mask & ::boost::BOOST_REGEX_DETAIL_NS::char_class_cntrl) && (this->m_pctype->is(std::ctype<charT>::cntrl, c)))
|| ((mask & ::boost::BOOST_REGEX_DETAIL_NS::char_class_upper) && (this->m_pctype->is(std::ctype<charT>::upper, c)))
|| ((mask & ::boost::BOOST_REGEX_DETAIL_NS::char_class_lower) && (this->m_pctype->is(std::ctype<charT>::lower, c)))
|| ((mask & ::boost::BOOST_REGEX_DETAIL_NS::char_class_alpha) && (this->m_pctype->is(std::ctype<charT>::alpha, c)))
|| ((mask & ::boost::BOOST_REGEX_DETAIL_NS::char_class_digit) && (this->m_pctype->is(std::ctype<charT>::digit, c)))
|| ((mask & ::boost::BOOST_REGEX_DETAIL_NS::char_class_punct) && (this->m_pctype->is(std::ctype<charT>::punct, c)))
|| ((mask & ::boost::BOOST_REGEX_DETAIL_NS::char_class_xdigit) && (this->m_pctype->is(std::ctype<charT>::xdigit, c)))
|| ((mask & ::boost::BOOST_REGEX_DETAIL_NS::char_class_blank) && (this->m_pctype->is(std::ctype<charT>::space, c)) && !::boost::BOOST_REGEX_DETAIL_NS::is_separator(c))
|| ((mask & ::boost::BOOST_REGEX_DETAIL_NS::char_class_word) && (c == '_'))
|| ((mask & ::boost::BOOST_REGEX_DETAIL_NS::char_class_unicode) && ::boost::BOOST_REGEX_DETAIL_NS::is_extended(c))
|| ((mask & ::boost::BOOST_REGEX_DETAIL_NS::char_class_vertical_space) && (is_separator(c) || (c == '\v')))
|| ((mask & ::boost::BOOST_REGEX_DETAIL_NS::char_class_horizontal_space) && this->m_pctype->is(std::ctype<charT>::space, c) && !(is_separator(c) || (c == '\v')));
}
#endif
template <class charT>
inline std::shared_ptr<const cpp_regex_traits_implementation<charT> > create_cpp_regex_traits(const std::locale& l)
{
@ -974,7 +832,6 @@ public:
}
bool isctype(charT c, char_class_type f) const
{
#ifndef BOOST_REGEX_BUGGY_CTYPE_FACET
typedef typename std::ctype<charT>::mask ctype_mask;
static const ctype_mask mask_base =
@ -1022,9 +879,6 @@ public:
}
#endif
return false;
#else
return m_pimpl->isctype(c, f);
#endif
}
std::intmax_t toi(const charT*& p1, const charT* p2, int radix)const;
int value(charT c, int radix)const

View File

@ -27,21 +27,21 @@ namespace BOOST_REGEX_DETAIL_NS{
class indexed_bit_flag
{
boost::uint64_t low_mask;
std::uint64_t low_mask;
std::set<std::size_t> mask_set;
public:
indexed_bit_flag() : low_mask(0) {}
void set(std::size_t i)
{
if (i < std::numeric_limits<boost::uint64_t>::digits - 1)
low_mask |= static_cast<boost::uint64_t>(1u) << i;
if (i < std::numeric_limits<std::uint64_t>::digits - 1)
low_mask |= static_cast<std::uint64_t>(1u) << i;
else
mask_set.insert(i);
}
bool test(std::size_t i)
{
if (i < std::numeric_limits<boost::uint64_t>::digits - 1)
return low_mask & static_cast<boost::uint64_t>(1u) << i ? true : false;
if (i < std::numeric_limits<std::uint64_t>::digits - 1)
return low_mask & static_cast<std::uint64_t>(1u) << i ? true : false;
else
return mask_set.find(i) != mask_set.end();
}

View File

@ -551,7 +551,11 @@ private:
static void raise_logic_error()
{
std::logic_error e("Attempt to access an uninitialized boost::match_results<> class.");
#ifndef BOOST_REGEX_STANDALONE
boost::throw_exception(e);
#else
throw e;
#endif
}

View File

@ -53,7 +53,11 @@ inline void verify_options(boost::regex_constants::syntax_option_type, match_fl
if ((mf & match_extra) && (mf & match_posix))
{
std::logic_error msg("Usage Error: Can't mix regular expression captures with POSIX matching rules");
#ifndef BOOST_REGEX_STANDALONE
throw_exception(msg);
#else
throw msg;
#endif
}
}
//

View File

@ -61,7 +61,11 @@ void perl_matcher<BidiIterator, Allocator, traits>::construct_init(const basic_r
{
// precondition failure: e is not a valid regex.
std::invalid_argument ex("Invalid regular expression object");
#ifndef BOOST_REGEX_STANDALONE
boost::throw_exception(ex);
#else
throw e;
#endif
}
pstate = 0;
m_match_flags = f;

View File

@ -87,7 +87,7 @@ struct default_wrapper : public BaseT
{
return (char_type(c & 0x7f) == c) ? get_default_escape_syntax_type(static_cast<char>(c)) : ::boost::regex_constants::escape_type_identity;
}
boost::intmax_t toi(const char_type*& p1, const char_type* p2, int radix)const
std::intmax_t toi(const char_type*& p1, const char_type* p2, int radix)const
{
return ::boost::BOOST_REGEX_DETAIL_NS::global_toi(p1, p2, radix, *this);
}

View File

@ -70,9 +70,15 @@ inline void pointer_construct(T* p, const T& t)
*
****************************************************************************/
#if defined(BOOST_WORKAROUND)
#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) && defined(__STDC_WANT_SECURE_LIB__) && __STDC_WANT_SECURE_LIB__
#define BOOST_REGEX_HAS_STRCPY_S
#endif
#endif
#ifdef __cplusplus
namespace boost{ namespace BOOST_REGEX_DETAIL_NS{
#if defined(BOOST_WORKAROUND) && BOOST_WORKAROUND(BOOST_MSVC,>=1400) && defined(__STDC_WANT_SECURE_LIB__) && __STDC_WANT_SECURE_LIB__
#if defined(BOOST_REGEX_HAS_STRCPY_S)
// use safe versions of strcpy etc:
using ::strcpy_s;

View File

@ -67,8 +67,8 @@ namespace BOOST_REGEX_DETAIL_NS{
//
// start by typedeffing the types we'll need:
//
typedef ::boost::uint32_t lcid_type; // placeholder for LCID.
typedef ::std::shared_ptr<void> cat_type; // placeholder for dll HANDLE.
typedef std::uint32_t lcid_type; // placeholder for LCID.
typedef std::shared_ptr<void> cat_type; // placeholder for dll HANDLE.
//
// then add wrappers around the actual Win32 API's (ie implementation hiding):
@ -99,9 +99,9 @@ char w32_toupper(char c, lcid_type);
#ifndef BOOST_NO_WREGEX
wchar_t w32_toupper(wchar_t c, lcid_type);
#endif
bool w32_is(lcid_type, boost::uint32_t mask, char c);
bool w32_is(lcid_type, std::uint32_t mask, char c);
#ifndef BOOST_NO_WREGEX
bool w32_is(lcid_type, boost::uint32_t mask, wchar_t c);
bool w32_is(lcid_type, std::uint32_t mask, wchar_t c);
#endif
//
// class w32_regex_traits_base:
@ -158,7 +158,7 @@ public:
{
return ::boost::BOOST_REGEX_DETAIL_NS::w32_tolower(c, this->m_locale);
}
bool isctype(boost::uint32_t mask, charT c)const
bool isctype(std::uint32_t mask, charT c)const
{
return ::boost::BOOST_REGEX_DETAIL_NS::w32_is(this->m_locale, mask, c);
}
@ -255,7 +255,7 @@ public:
{
return m_lower_map[static_cast<unsigned char>(c)];
}
bool isctype(boost::uint32_t mask, char c)const
bool isctype(std::uint32_t mask, char c)const
{
return m_type_map[static_cast<unsigned char>(c)] & mask;
}
@ -263,7 +263,7 @@ public:
private:
regex_constants::syntax_type m_char_map[1u << CHAR_BIT];
char m_lower_map[1u << CHAR_BIT];
boost::uint16_t m_type_map[1u << CHAR_BIT];
std::uint16_t m_type_map[1u << CHAR_BIT];
template <class U>
void init();
};
@ -529,7 +529,7 @@ public:
typedef std::size_t size_type;
typedef std::basic_string<char_type> string_type;
typedef ::boost::BOOST_REGEX_DETAIL_NS::lcid_type locale_type;
typedef boost::uint_least32_t char_class_type;
typedef std::uint_least32_t char_class_type;
struct boost_extensions_tag{};
@ -601,7 +601,7 @@ public:
return true;
return false;
}
boost::intmax_t toi(const charT*& p1, const charT* p2, int radix)const
std::intmax_t toi(const charT*& p1, const charT* p2, int radix)const
{
return ::boost::BOOST_REGEX_DETAIL_NS::global_toi(p1, p2, radix, *this);
}
@ -1134,7 +1134,7 @@ namespace BOOST_REGEX_DETAIL_NS {
return result[0];
}
#endif
inline bool w32_is(lcid_type idx, boost::uint32_t m, char c)
inline bool w32_is(lcid_type idx, std::uint32_t m, char c)
{
WORD mask;
#ifndef BOOST_NO_ANSI_APIS
@ -1158,7 +1158,7 @@ namespace BOOST_REGEX_DETAIL_NS {
}
#ifndef BOOST_NO_WREGEX
inline bool w32_is(lcid_type idx, boost::uint32_t m, wchar_t c)
inline bool w32_is(lcid_type idx, std::uint32_t m, wchar_t c)
{
WORD mask;
if (::GetStringTypeExW(idx, CT_CTYPE1, &c, 1, &mask) && (mask & m & w32_regex_traits_implementation<wchar_t>::mask_base))

View File

@ -103,24 +103,29 @@ test-suite regex
[ regex-test wide_posix_api_check_cpp
: c_compiler_checks/wide_posix_api_check.cpp ]
[ run pathology/bad_expression_test.cpp
../build//boost_regex
[ run pathology/bad_expression_test.cpp : : :
[ check-target-builds ../build//is_legacy_03 : : <source>../build//boost_regex ]
]
[ run pathology/recursion_test.cpp
../build//boost_regex
[ run pathology/recursion_test.cpp : : :
[ check-target-builds ../build//is_legacy_03 : : <source>../build//boost_regex ]
]
[ run named_subexpressions/named_subexpressions_test.cpp
../build//boost_regex
[ run named_subexpressions/named_subexpressions_test.cpp : : :
[ check-target-builds ../build//is_legacy_03 : : <source>../build//boost_regex ]
]
[ run unicode/unicode_iterator_test.cpp ../build//boost_regex : : : release <define>TEST_UTF8 : unicode_iterator_test_utf8 ]
[ run unicode/unicode_iterator_test.cpp ../build//boost_regex : : : release <define>TEST_UTF16 : unicode_iterator_test_utf16 ]
[ run unicode/unicode_iterator_test.cpp : : :
[ check-target-builds ../build//is_legacy_03 : : <source>../build//boost_regex ]
release <define>TEST_UTF8 : unicode_iterator_test_utf8 ]
[ run unicode/unicode_iterator_test.cpp : : :
[ check-target-builds ../build//is_legacy_03 : : <source>../build//boost_regex ]
release <define>TEST_UTF16 : unicode_iterator_test_utf16 ]
[ run static_mutex/static_mutex_test.cpp
../../thread/build//boost_thread ../build//boost_regex
]
[ run object_cache/object_cache_test.cpp ../build//boost_regex
[ run object_cache/object_cache_test.cpp : : :
[ check-target-builds ../build//is_legacy_03 : : <source>../build//boost_regex ]
]
[ run config_info/regex_config_info.cpp
@ -140,21 +145,33 @@ test-suite regex
: : : <test-info>always_show_run_output : test_collate_info ]
[ link concepts/concept_check.cpp ../build//boost_regex ]
[ link concepts/icu_concept_check.cpp ../build//boost_regex ]
[ link concepts/range_concept_check.cpp ../build//boost_regex ]
[ run concepts/test_bug_11988.cpp ../build//boost_regex ]
[ link concepts/concept_check.cpp :
[ check-target-builds ../build//is_legacy_03 : : <source>../build//boost_regex ]
]
[ link concepts/concept_check.cpp :
<define>BOOST_REGEX_STANDALONE [ check-target-builds ../build//is_legacy_03 : : <source>../build//boost_regex ] : standalone_concept_check
]
[ link concepts/icu_concept_check.cpp :
[ check-target-builds ../build//is_legacy_03 : : <source>../build//boost_regex ]
]
[ link concepts/range_concept_check.cpp :
[ check-target-builds ../build//is_legacy_03 : : <source>../build//boost_regex ]
]
[ run concepts/test_bug_11988.cpp : : :
[ check-target-builds ../build//is_legacy_03 : : <source>../build//boost_regex ]
]
[ run
# sources
captures/captures_test.cpp
captures//boost_regex_extra ../build//icu_options
../build//icu_options
: # additional args
: # test-files
: # requirements
<threading>multi
<define>BOOST_REGEX_MATCH_EXTRA=1
<define>BOOST_REGEX_NO_LIB=1
[ check-target-builds ../build//is_legacy_03 : : <source>../build//boost_regex ]
: # test name
captures_test
]

View File

@ -9,6 +9,7 @@
*
*/
#include <boost/regex.hpp>
#include <boost/config.hpp>
#if defined(BOOST_MSVC)
@ -22,18 +23,11 @@
#pragma warning(disable:1418 981 983 595 383)
#endif
#include <boost/regex.hpp>
#include <boost/detail/workaround.hpp>
#if !BOOST_WORKAROUND(_MSC_VER, < 1310) && !defined(BOOST_NO_MEMBER_TEMPLATES) && !defined(__IBMCPP__) && !BOOST_WORKAROUND(__GNUC__, < 3)
#include <boost/regex/concepts.hpp>
#endif
int main()
{
// VC6 and VC7 can't cope with the iterator architypes,
// don't bother testing as it doesn't work:
#if !BOOST_WORKAROUND(_MSC_VER, < 1310) && !defined(BOOST_NO_MEMBER_TEMPLATES) && !defined(__IBMCPP__) && !BOOST_WORKAROUND(__GNUC__, < 3)
boost::function_requires<
boost::RegexTraitsConcept<
boost::regex_traits<char>
@ -53,7 +47,6 @@ int main()
>();
#endif
#endif
#if !BOOST_WORKAROUND(BOOST_BORLANDC, < 0x560)
boost::function_requires<
boost::BoostRegexConcept<
boost::basic_regex<char, boost::c_regex_traits<char> >
@ -66,7 +59,6 @@ int main()
>
>();
#endif
#endif
#if defined(_WIN32) && !defined(BOOST_REGEX_NO_W32)
boost::function_requires<
boost::BoostRegexConcept<
@ -90,15 +82,12 @@ int main()
regex_traits_tester_type1
>
>();
#if !defined(__MWERKS__) && !defined(__SUNPRO_CC) // MWCW tries to instantiate std::basic_string<boost::char_architype>, not sure whose bug this is....
typedef boost::basic_regex<boost::char_architype, boost::regex_traits_architype<boost::char_architype> > regex_traits_tester_type2;
boost::function_requires<
boost::BaseRegexConcept<
regex_traits_tester_type2
>
>();
#endif // __MWERKS__
#endif
return 0;
}