forked from boostorg/regex
Changed assert's to BOOST_ASSERT's.
Made array sizes explicit to fix MWCW problems. [SVN r26723]
This commit is contained in:
@ -509,7 +509,7 @@ struct BaseRegexConcept
|
||||
ignore_unused_variable_warning(ti4);
|
||||
regex_token_iterator_type ti5(m_in, m_in, e, subs, m_mft);
|
||||
ignore_unused_variable_warning(ti5);
|
||||
static const int i_array[] = { 1, 2, 3, };
|
||||
static const int i_array[3] = { 1, 2, 3, };
|
||||
regex_token_iterator_type ti6(m_in, m_in, e, i_array);
|
||||
ignore_unused_variable_warning(ti6);
|
||||
regex_token_iterator_type ti7(m_in, m_in, e, i_array, m_mft);
|
||||
|
@ -12,10 +12,10 @@
|
||||
#ifndef BOOST_DETAIL_ALLOCATOR_HPP
|
||||
#define BOOST_DETAIL_ALLOCATOR_HPP
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <cstdlib>
|
||||
#include <new>
|
||||
#include <assert.h>
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/assert.hpp>
|
||||
#if defined(BOOST_NO_STDC_NAMESPACE)
|
||||
namespace std{
|
||||
using ::ptrdiff_t;
|
||||
@ -133,11 +133,11 @@ public:
|
||||
void deallocate(pointer p, size_type n)
|
||||
{
|
||||
#ifdef BOOST_HAVE_SGI_ALLOCATOR
|
||||
assert( (p == 0) == (n == 0) );
|
||||
BOOST_ASSERT( (p == 0) == (n == 0) );
|
||||
if (p != 0)
|
||||
alloc_type::deallocate((void*)p, n);
|
||||
#else
|
||||
assert( (p == 0) == (n == 0) );
|
||||
BOOST_ASSERT( (p == 0) == (n == 0) );
|
||||
if (p != 0)
|
||||
::operator delete((void*)p);
|
||||
#endif
|
||||
@ -204,11 +204,11 @@ public:
|
||||
void deallocate(pointer p, size_type n)
|
||||
{
|
||||
#ifdef BOOST_HAVE_SGI_ALLOCATOR
|
||||
assert( (p == 0) == (n == 0) );
|
||||
BOOST_ASSERT( (p == 0) == (n == 0) );
|
||||
if (p != 0)
|
||||
alloc_type::deallocate((void*)p, n);
|
||||
#else
|
||||
assert( (p == 0) == (n == 0) );
|
||||
BOOST_ASSERT( (p == 0) == (n == 0) );
|
||||
if (p != 0)
|
||||
::operator delete((void*)p);
|
||||
#endif
|
||||
@ -252,7 +252,7 @@ public:
|
||||
|
||||
void deallocate(pointer p, size_type n)
|
||||
{
|
||||
assert( (p == 0) == (n == 0) );
|
||||
BOOST_ASSERT( (p == 0) == (n == 0) );
|
||||
if (p != 0)
|
||||
static_cast<base_type*>(this)->deallocate((void*)p, n * sizeof(value_type));
|
||||
}
|
||||
|
@ -522,7 +522,7 @@ private:
|
||||
}
|
||||
// we now need to remove a few of the leftmost bits, but how many depends
|
||||
// upon how many extra bytes we've extracted:
|
||||
static const boost::uint32_t masks[] =
|
||||
static const boost::uint32_t masks[4] =
|
||||
{
|
||||
0x7Fu,
|
||||
0x7FFu,
|
||||
|
@ -453,32 +453,32 @@ public:
|
||||
//
|
||||
const re_detail::re_syntax_base* get_first_state()const
|
||||
{
|
||||
assert(0 != m_pimpl.get());
|
||||
BOOST_ASSERT(0 != m_pimpl.get());
|
||||
return m_pimpl->get_first_state();
|
||||
}
|
||||
unsigned get_restart_type()const
|
||||
{
|
||||
assert(0 != m_pimpl.get());
|
||||
BOOST_ASSERT(0 != m_pimpl.get());
|
||||
return m_pimpl->get_restart_type();
|
||||
}
|
||||
const unsigned char* get_map()const
|
||||
{
|
||||
assert(0 != m_pimpl.get());
|
||||
BOOST_ASSERT(0 != m_pimpl.get());
|
||||
return m_pimpl->get_map();
|
||||
}
|
||||
const ::boost::regex_traits_wrapper<traits>& get_traits()const
|
||||
{
|
||||
assert(0 != m_pimpl.get());
|
||||
BOOST_ASSERT(0 != m_pimpl.get());
|
||||
return m_pimpl->get_traits();
|
||||
}
|
||||
bool can_be_null()const
|
||||
{
|
||||
assert(0 != m_pimpl.get());
|
||||
BOOST_ASSERT(0 != m_pimpl.get());
|
||||
return m_pimpl->can_be_null();
|
||||
}
|
||||
const re_detail::regex_data<charT, traits>& get_data()const
|
||||
{
|
||||
assert(0 != m_pimpl.get());
|
||||
BOOST_ASSERT(0 != m_pimpl.get());
|
||||
return m_pimpl->get_data();
|
||||
}
|
||||
|
||||
|
@ -246,9 +246,9 @@ basic_regex_creator<charT, traits>::basic_regex_creator(regex_data<charT, traits
|
||||
m_pdata->m_status = ::boost::regex_constants::error_ok;
|
||||
static const charT w = 'w';
|
||||
static const charT s = 's';
|
||||
static const charT l[] = { 'l', 'o', 'w', 'e', 'r', };
|
||||
static const charT u[] = { 'u', 'p', 'p', 'e', 'r', };
|
||||
static const charT a[] = { 'a', 'l', 'p', 'h', 'a', };
|
||||
static const charT l[5] = { 'l', 'o', 'w', 'e', 'r', };
|
||||
static const charT u[5] = { 'u', 'p', 'p', 'e', 'r', };
|
||||
static const charT a[5] = { 'a', 'l', 'p', 'h', 'a', };
|
||||
m_word_mask = m_traits.lookup_classname(&w, &w +1);
|
||||
m_mask_space = m_traits.lookup_classname(&s, &s +1);
|
||||
m_lower_mask = m_traits.lookup_classname(l, l + 5);
|
||||
@ -538,7 +538,7 @@ re_syntax_base* basic_regex_creator<charT, traits>::append_set(
|
||||
}
|
||||
for(unsigned i = 0; i < (1u << CHAR_BIT); ++i)
|
||||
{
|
||||
charT c3[] = { static_cast<charT>(i), charT(0), };
|
||||
charT c3[2] = { static_cast<charT>(i), charT(0), };
|
||||
string_type s3 = this->m_traits.transform(c3, c3 +1);
|
||||
if((s1 <= s3) && (s3 <= s2))
|
||||
result->_map[i] = true;
|
||||
|
@ -1848,7 +1848,7 @@ bool basic_regex_parser<charT, traits>::add_emacs_code(bool negate)
|
||||
if(negate)
|
||||
char_set.negate();
|
||||
|
||||
static const charT s_punct[] = { 'p', 'u', 'n', 'c', 't', };
|
||||
static const charT s_punct[5] = { 'p', 'u', 'n', 'c', 't', };
|
||||
|
||||
switch(*m_position)
|
||||
{
|
||||
|
@ -665,7 +665,7 @@ void cpp_regex_traits_implementation<charT>::init()
|
||||
// Custom class names:
|
||||
//
|
||||
#ifndef BOOST_REGEX_BUGGY_CTYPE_FACET
|
||||
static const char_class_type masks[] =
|
||||
static const char_class_type masks[14] =
|
||||
{
|
||||
std::ctype<charT>::alnum,
|
||||
std::ctype<charT>::alpha,
|
||||
@ -683,7 +683,7 @@ void cpp_regex_traits_implementation<charT>::init()
|
||||
cpp_regex_traits_implementation<charT>::mask_unicode,
|
||||
};
|
||||
#else
|
||||
static const char_class_type masks[] =
|
||||
static const char_class_type masks[14] =
|
||||
{
|
||||
::boost::re_detail::char_class_alnum,
|
||||
::boost::re_detail::char_class_alpha,
|
||||
@ -721,7 +721,7 @@ 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[] =
|
||||
static const char_class_type masks[20] =
|
||||
{
|
||||
0,
|
||||
std::ctype<char>::alnum,
|
||||
@ -745,7 +745,7 @@ typename cpp_regex_traits_implementation<charT>::char_class_type
|
||||
std::ctype<char>::xdigit,
|
||||
};
|
||||
#else
|
||||
static const char_class_type masks[] =
|
||||
static const char_class_type masks[20] =
|
||||
{
|
||||
0,
|
||||
::boost::re_detail::char_class_alnum,
|
||||
@ -777,7 +777,7 @@ typename cpp_regex_traits_implementation<charT>::char_class_type
|
||||
return pos->second;
|
||||
}
|
||||
std::size_t id = 1 + re_detail::get_default_class_id(p1, p2);
|
||||
assert(id < sizeof(masks) / sizeof(masks[0]));
|
||||
BOOST_ASSERT(id < sizeof(masks) / sizeof(masks[0]));
|
||||
return masks[id];
|
||||
}
|
||||
|
||||
|
@ -24,6 +24,7 @@
|
||||
#ifndef BOOST_REGEX_CONFIG_HPP
|
||||
#include <boost/regex/config.hpp>
|
||||
#endif
|
||||
#include <boost/assert.hpp>
|
||||
|
||||
#ifndef BOOST_REGEX_NO_FILEITER
|
||||
|
||||
@ -239,8 +240,8 @@ public:
|
||||
mapfile_iterator& operator = (const mapfile_iterator& i);
|
||||
char operator* ()const
|
||||
{
|
||||
assert(node >= file->_first);
|
||||
assert(node < file->_last);
|
||||
BOOST_ASSERT(node >= file->_first);
|
||||
BOOST_ASSERT(node < file->_last);
|
||||
return file ? *(*node + sizeof(int) + offset) : char(0);
|
||||
}
|
||||
char operator[] (long off)const
|
||||
|
@ -153,7 +153,7 @@ public:
|
||||
string_type format(const string_type& fmt,
|
||||
match_flag_type flags = format_default) const
|
||||
{
|
||||
return regex_format<BidiIterator, char_type>(*this, fmt, flags);
|
||||
return ::boost::regex_format(*this, fmt, flags);
|
||||
}
|
||||
// format with locale:
|
||||
template <class OutputIterator, class RegexT>
|
||||
@ -208,7 +208,7 @@ public:
|
||||
// private access functions:
|
||||
void BOOST_REGEX_CALL set_second(BidiIterator i)
|
||||
{
|
||||
assert(m_subs.size() > 2);
|
||||
BOOST_ASSERT(m_subs.size() > 2);
|
||||
m_subs[2].second = i;
|
||||
m_subs[2].matched = true;
|
||||
m_subs[0].first = i;
|
||||
@ -221,7 +221,7 @@ public:
|
||||
void BOOST_REGEX_CALL set_second(BidiIterator i, size_type pos, bool m = true)
|
||||
{
|
||||
pos += 2;
|
||||
assert(m_subs.size() > pos);
|
||||
BOOST_ASSERT(m_subs.size() > pos);
|
||||
m_subs[pos].second = i;
|
||||
m_subs[pos].matched = m;
|
||||
if(pos == 2)
|
||||
@ -274,7 +274,7 @@ public:
|
||||
}
|
||||
void BOOST_REGEX_CALL set_first(BidiIterator i, size_type pos)
|
||||
{
|
||||
assert(pos+2 < m_subs.size());
|
||||
BOOST_ASSERT(pos+2 < m_subs.size());
|
||||
if(pos)
|
||||
m_subs[pos+2].first = i;
|
||||
else
|
||||
|
@ -97,7 +97,7 @@ struct save_state_init
|
||||
*end = reinterpret_cast<saved_state*>(reinterpret_cast<char*>(*base)+BOOST_REGEX_BLOCKSIZE);
|
||||
--(*end);
|
||||
(void) new (*end)saved_state(0);
|
||||
assert(*end > *base);
|
||||
BOOST_ASSERT(*end > *base);
|
||||
}
|
||||
~save_state_init()
|
||||
{
|
||||
@ -195,7 +195,7 @@ void perl_matcher<BidiIterator, Allocator, traits>::extend_stack()
|
||||
template <class BidiIterator, class Allocator, class traits>
|
||||
inline void perl_matcher<BidiIterator, Allocator, traits>::push_matched_paren(int index, const sub_match<BidiIterator>& sub)
|
||||
{
|
||||
assert(index);
|
||||
BOOST_ASSERT(index);
|
||||
saved_matched_paren<BidiIterator>* pmp = static_cast<saved_matched_paren<BidiIterator>*>(m_backup_state);
|
||||
--pmp;
|
||||
if(pmp < m_stack_base)
|
||||
@ -388,7 +388,7 @@ bool perl_matcher<BidiIterator, Allocator, traits>::match_startmark()
|
||||
}
|
||||
default:
|
||||
{
|
||||
assert(index > 0);
|
||||
BOOST_ASSERT(index > 0);
|
||||
if((m_match_flags & match_nosubs) == 0)
|
||||
{
|
||||
push_matched_paren(index, (*m_presult)[index]);
|
||||
@ -634,7 +634,7 @@ bool perl_matcher<BidiIterator, Allocator, traits>::match_char_repeat()
|
||||
#pragma option push -w-8008 -w-8066 -w-8004
|
||||
#endif
|
||||
const re_repeat* rep = static_cast<const re_repeat*>(pstate);
|
||||
assert(1 == static_cast<const re_literal*>(rep->next.p)->length);
|
||||
BOOST_ASSERT(1 == static_cast<const re_literal*>(rep->next.p)->length);
|
||||
const char_type what = *reinterpret_cast<const char_type*>(static_cast<const re_literal*>(rep->next.p) + 1);
|
||||
std::size_t count = 0;
|
||||
//
|
||||
@ -982,15 +982,15 @@ bool perl_matcher<BidiIterator, Allocator, traits>::unwind_greedy_single_repeat(
|
||||
|
||||
const re_repeat* rep = pmp->rep;
|
||||
std::size_t count = pmp->count;
|
||||
assert(rep->next.p != 0);
|
||||
assert(rep->alt.p != 0);
|
||||
BOOST_ASSERT(rep->next.p != 0);
|
||||
BOOST_ASSERT(rep->alt.p != 0);
|
||||
|
||||
count -= rep->min;
|
||||
|
||||
if((m_match_flags & match_partial) && (position == last))
|
||||
m_has_partial_match = true;
|
||||
|
||||
assert(count);
|
||||
BOOST_ASSERT(count);
|
||||
position = pmp->last_position;
|
||||
|
||||
// backtrack till we can skip out:
|
||||
@ -1031,12 +1031,12 @@ bool perl_matcher<BidiIterator, Allocator, traits>::unwind_slow_dot_repeat(bool
|
||||
|
||||
const re_repeat* rep = pmp->rep;
|
||||
std::size_t count = pmp->count;
|
||||
assert(rep->type == syntax_element_dot_rep);
|
||||
assert(rep->next.p != 0);
|
||||
assert(rep->alt.p != 0);
|
||||
assert(rep->next.p->type == syntax_element_wild);
|
||||
BOOST_ASSERT(rep->type == syntax_element_dot_rep);
|
||||
BOOST_ASSERT(rep->next.p != 0);
|
||||
BOOST_ASSERT(rep->alt.p != 0);
|
||||
BOOST_ASSERT(rep->next.p->type == syntax_element_wild);
|
||||
|
||||
assert(count < rep->max);
|
||||
BOOST_ASSERT(count < rep->max);
|
||||
pstate = rep->next.p;
|
||||
position = pmp->last_position;
|
||||
|
||||
@ -1094,7 +1094,7 @@ bool perl_matcher<BidiIterator, Allocator, traits>::unwind_fast_dot_repeat(bool
|
||||
const re_repeat* rep = pmp->rep;
|
||||
std::size_t count = pmp->count;
|
||||
|
||||
assert(count < rep->max);
|
||||
BOOST_ASSERT(count < rep->max);
|
||||
position = pmp->last_position;
|
||||
if(position != last)
|
||||
{
|
||||
@ -1149,11 +1149,11 @@ bool perl_matcher<BidiIterator, Allocator, traits>::unwind_char_repeat(bool r)
|
||||
const char_type what = *reinterpret_cast<const char_type*>(static_cast<const re_literal*>(pstate) + 1);
|
||||
position = pmp->last_position;
|
||||
|
||||
assert(rep->type == syntax_element_char_rep);
|
||||
assert(rep->next.p != 0);
|
||||
assert(rep->alt.p != 0);
|
||||
assert(rep->next.p->type == syntax_element_literal);
|
||||
assert(count < rep->max);
|
||||
BOOST_ASSERT(rep->type == syntax_element_char_rep);
|
||||
BOOST_ASSERT(rep->next.p != 0);
|
||||
BOOST_ASSERT(rep->alt.p != 0);
|
||||
BOOST_ASSERT(rep->next.p->type == syntax_element_literal);
|
||||
BOOST_ASSERT(count < rep->max);
|
||||
|
||||
if(position != last)
|
||||
{
|
||||
@ -1213,11 +1213,11 @@ bool perl_matcher<BidiIterator, Allocator, traits>::unwind_short_set_repeat(bool
|
||||
const unsigned char* map = static_cast<const re_set*>(rep->next.p)->_map;
|
||||
position = pmp->last_position;
|
||||
|
||||
assert(rep->type == syntax_element_short_set_rep);
|
||||
assert(rep->next.p != 0);
|
||||
assert(rep->alt.p != 0);
|
||||
assert(rep->next.p->type == syntax_element_set);
|
||||
assert(count < rep->max);
|
||||
BOOST_ASSERT(rep->type == syntax_element_short_set_rep);
|
||||
BOOST_ASSERT(rep->next.p != 0);
|
||||
BOOST_ASSERT(rep->alt.p != 0);
|
||||
BOOST_ASSERT(rep->next.p->type == syntax_element_set);
|
||||
BOOST_ASSERT(count < rep->max);
|
||||
|
||||
if(position != last)
|
||||
{
|
||||
@ -1278,11 +1278,11 @@ bool perl_matcher<BidiIterator, Allocator, traits>::unwind_long_set_repeat(bool
|
||||
const re_set_long<mask_type>* set = static_cast<const re_set_long<mask_type>*>(pstate);
|
||||
position = pmp->last_position;
|
||||
|
||||
assert(rep->type == syntax_element_long_set_rep);
|
||||
assert(rep->next.p != 0);
|
||||
assert(rep->alt.p != 0);
|
||||
assert(rep->next.p->type == syntax_element_long_set);
|
||||
assert(count < rep->max);
|
||||
BOOST_ASSERT(rep->type == syntax_element_long_set_rep);
|
||||
BOOST_ASSERT(rep->next.p != 0);
|
||||
BOOST_ASSERT(rep->alt.p != 0);
|
||||
BOOST_ASSERT(rep->next.p->type == syntax_element_long_set);
|
||||
BOOST_ASSERT(count < rep->max);
|
||||
|
||||
if(position != last)
|
||||
{
|
||||
|
@ -195,7 +195,7 @@ bool perl_matcher<BidiIterator, Allocator, traits>::match_startmark()
|
||||
}
|
||||
default:
|
||||
{
|
||||
assert(index > 0);
|
||||
BOOST_ASSERT(index > 0);
|
||||
if((m_match_flags & match_nosubs) == 0)
|
||||
{
|
||||
backup_subex<BidiIterator> sub(*m_presult, index);
|
||||
@ -499,7 +499,7 @@ bool perl_matcher<BidiIterator, Allocator, traits>::match_char_repeat()
|
||||
#pragma option push -w-8008 -w-8066 -w-8004
|
||||
#endif
|
||||
const re_repeat* rep = static_cast<const re_repeat*>(pstate);
|
||||
assert(1 == static_cast<const re_literal*>(rep->next.p)->length);
|
||||
BOOST_ASSERT(1 == static_cast<const re_literal*>(rep->next.p)->length);
|
||||
const char_type what = *reinterpret_cast<const char_type*>(static_cast<const re_literal*>(rep->next.p) + 1);
|
||||
unsigned count = 0;
|
||||
//
|
||||
|
@ -465,7 +465,7 @@ w32_regex_traits_implementation<charT>::w32_regex_traits_implementation(::boost:
|
||||
//
|
||||
// Custom class names:
|
||||
//
|
||||
static const char_class_type masks[] =
|
||||
static const char_class_type masks[14] =
|
||||
{
|
||||
0x0104u, // C1_ALPHA | C1_DIGIT
|
||||
0x0100u, // C1_ALPHA
|
||||
@ -500,7 +500,7 @@ template <class charT>
|
||||
typename w32_regex_traits_implementation<charT>::char_class_type
|
||||
w32_regex_traits_implementation<charT>::lookup_classname_imp(const charT* p1, const charT* p2) const
|
||||
{
|
||||
static const char_class_type masks[] =
|
||||
static const char_class_type masks[20] =
|
||||
{
|
||||
0,
|
||||
0x0104u, // C1_ALPHA | C1_DIGIT
|
||||
@ -531,7 +531,7 @@ typename w32_regex_traits_implementation<charT>::char_class_type
|
||||
return pos->second;
|
||||
}
|
||||
std::size_t id = 1 + re_detail::get_default_class_id(p1, p2);
|
||||
assert(id < sizeof(masks) / sizeof(masks[0]));
|
||||
BOOST_ASSERT(id < sizeof(masks) / sizeof(masks[0]));
|
||||
return masks[id];
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user