Mostly cgg warning suppression, plus some gcc 2.95 workarounds.

[SVN r20462]
This commit is contained in:
John Maddock
2003-10-23 12:40:47 +00:00
parent f7eb12d9c7
commit 9215a04042
8 changed files with 60 additions and 21 deletions

View File

@ -195,7 +195,9 @@ unsigned int BOOST_REGEX_CALL reg_expression<charT, traits, Allocator>::parse_in
unsigned int result = traits_inst.syntax_type((traits_size_type)(traits_uchar_type)*(base+1));
if((result == traits_type::syntax_colon) && ((first-base) == 5))
{
return traits_inst.syntax_type((traits_size_type)(traits_uchar_type)*(base+2));
unsigned type = traits_inst.syntax_type((traits_size_type)(traits_uchar_type)*(base+2));
if((type == traits_type::syntax_left_word) || (type == traits_type::syntax_right_word))
return type;
}
return ((result == traits_type::syntax_colon) || (result == traits_type::syntax_dot) || (result == traits_type::syntax_equal)) ? result : 0;
}

View File

@ -90,7 +90,7 @@ struct save_state_init
*base = static_cast<saved_state*>(get_mem_block());
*end = reinterpret_cast<saved_state*>(reinterpret_cast<char*>(*base)+BOOST_REGEX_BLOCKSIZE);
--(*end);
new (*end)saved_state(0);
(void) new (*end)saved_state(0);
assert(*end > *base);
}
~save_state_init()
@ -175,7 +175,7 @@ void perl_matcher<BidiIterator, Allocator, traits, Allocator2>::extend_stack()
backup_state = reinterpret_cast<saved_state*>(reinterpret_cast<char*>(stack_base)+BOOST_REGEX_BLOCKSIZE);
saved_extra_block* block = static_cast<saved_extra_block*>(backup_state);
--block;
new (block) saved_extra_block(m_stack_base, m_backup_state);
(void) new (block) saved_extra_block(m_stack_base, m_backup_state);
m_stack_base = stack_base;
m_backup_state = block;
}
@ -195,7 +195,7 @@ inline void perl_matcher<BidiIterator, Allocator, traits, Allocator2>::push_matc
pmp = static_cast<saved_matched_paren<BidiIterator>*>(m_backup_state);
--pmp;
}
new (pmp)saved_matched_paren<BidiIterator>(index, sub);
(void) new (pmp)saved_matched_paren<BidiIterator>(index, sub);
m_backup_state = pmp;
}
@ -210,7 +210,7 @@ inline void perl_matcher<BidiIterator, Allocator, traits, Allocator2>::push_recu
pmp = m_backup_state;
--pmp;
}
new (pmp)saved_state(saved_type_recurse);
(void) new (pmp)saved_state(saved_type_recurse);
m_backup_state = pmp;
}
@ -225,7 +225,7 @@ inline void perl_matcher<BidiIterator, Allocator, traits, Allocator2>::push_asse
pmp = static_cast<saved_assertion<BidiIterator>*>(m_backup_state);
--pmp;
}
new (pmp)saved_assertion<BidiIterator>(positive, ps, position);
(void) new (pmp)saved_assertion<BidiIterator>(positive, ps, position);
m_backup_state = pmp;
}
@ -240,7 +240,7 @@ inline void perl_matcher<BidiIterator, Allocator, traits, Allocator2>::push_alt(
pmp = static_cast<saved_position<BidiIterator>*>(m_backup_state);
--pmp;
}
new (pmp)saved_position<BidiIterator>(ps, position, saved_state_alt);
(void) new (pmp)saved_position<BidiIterator>(ps, position, saved_state_alt);
m_backup_state = pmp;
}
@ -255,7 +255,7 @@ inline void perl_matcher<BidiIterator, Allocator, traits, Allocator2>::push_non_
pmp = static_cast<saved_position<BidiIterator>*>(m_backup_state);
--pmp;
}
new (pmp)saved_position<BidiIterator>(ps, position, saved_state_non_greedy_long_repeat);
(void) new (pmp)saved_position<BidiIterator>(ps, position, saved_state_non_greedy_long_repeat);
m_backup_state = pmp;
}
@ -270,7 +270,7 @@ inline void perl_matcher<BidiIterator, Allocator, traits, Allocator2>::push_repe
pmp = static_cast<saved_repeater<BidiIterator>*>(m_backup_state);
--pmp;
}
new (pmp)saved_repeater<BidiIterator>(i, s, position);
(void) new (pmp)saved_repeater<BidiIterator>(i, s, position);
m_backup_state = pmp;
}
@ -285,7 +285,7 @@ inline void perl_matcher<BidiIterator, Allocator, traits, Allocator2>::push_sing
pmp = static_cast<saved_single_repeat<BidiIterator>*>(m_backup_state);
--pmp;
}
new (pmp)saved_single_repeat<BidiIterator>(c, r, last_position, id);
(void) new (pmp)saved_single_repeat<BidiIterator>(c, r, last_position, id);
m_backup_state = pmp;
}

View File

@ -66,11 +66,25 @@ bool BOOST_REGEX_CALL re_maybe_set_member(charT c,
} // namespace re_detail
template <class traits>
struct is_big_char
{
typedef typename traits::uchar_type traits_uchar_type;
typedef typename traits::size_type traits_size_type;
static bool test(char)
{ return false; }
static bool test(unsigned char)
{ return false; }
static bool test(signed char)
{ return false; }
template <class charT> static bool test(charT c)
{ return (traits_size_type)(traits_uchar_type)c >= 256; }
};
template <class charT, class traits, class Allocator>
inline bool BOOST_REGEX_CALL reg_expression<charT, traits, Allocator>::can_start(charT c, const unsigned char* _map, unsigned char mask, const re_detail::_wide_type&)
{
if((traits_size_type)(traits_uchar_type)c >= 256)
if(is_big_char<traits>::test(c))
return true;
return BOOST_REGEX_MAKE_BOOL(_map[(traits_uchar_type)c] & mask);
}
@ -209,7 +223,9 @@ unsigned int BOOST_REGEX_CALL reg_expression<charT, traits, Allocator>::parse_in
unsigned int result = traits_inst.syntax_type((traits_size_type)(traits_uchar_type)*(base+1));
if((result == traits_type::syntax_colon) && ((first-base) == 5))
{
return traits_inst.syntax_type((traits_size_type)(traits_uchar_type)*(base+2));
unsigned type = traits_inst.syntax_type((traits_size_type)(traits_uchar_type)*(base+2));
if((type == traits_type::syntax_left_word) || (type == traits_type::syntax_right_word))
return type;
}
return ((result == traits_type::syntax_colon) || (result == traits_type::syntax_dot) || (result == traits_type::syntax_equal)) ? result : 0;
}

View File

@ -562,7 +562,7 @@ struct BOOST_REGEX_DECL cpp_regex_traits_base : public regex_traits_base
char_class_digit = std::ctype_base::digit,
char_class_graph = std::ctype_base::graph,
char_class_lower = std::ctype_base::lower,
char_class_print = std::ctype_base::print,
char_class_print = 0,//std::ctype_base::print,
char_class_punct = std::ctype_base::punct,
char_class_space = std::ctype_base::space,
char_class_upper = std::ctype_base::upper,

View File

@ -271,6 +271,7 @@ operator + (const sub_match<RandomAccessIterator>& m,
result.reserve(s.size() + m.length() + 1);
return result.append(m.first, m.second).append(s);
}
#if !(defined(__GNUC__) && defined(BOOST_NO_STD_LOCALE))
template <class RandomAccessIterator>
inline std::basic_string<typename re_detail::regex_iterator_traits<RandomAccessIterator>::value_type>
operator + (typename re_detail::regex_iterator_traits<RandomAccessIterator>::value_type const* s,
@ -289,6 +290,23 @@ operator + (const sub_match<RandomAccessIterator>& m,
result.reserve(std::char_traits<typename re_detail::regex_iterator_traits<RandomAccessIterator>::value_type>::length(s) + m.length() + 1);
return result.append(m.first, m.second).append(s);
}
#else
// worwaround versions:
template <class RandomAccessIterator>
inline std::basic_string<typename re_detail::regex_iterator_traits<RandomAccessIterator>::value_type>
operator + (typename re_detail::regex_iterator_traits<RandomAccessIterator>::value_type const* s,
const sub_match<RandomAccessIterator>& m)
{
return s + m.str();
}
template <class RandomAccessIterator>
inline std::basic_string<typename re_detail::regex_iterator_traits<RandomAccessIterator>::value_type>
operator + (const sub_match<RandomAccessIterator>& m,
typename re_detail::regex_iterator_traits<RandomAccessIterator>::value_type const * s)
{
return m.str() + s;
}
#endif
template <class RandomAccessIterator>
inline std::basic_string<typename re_detail::regex_iterator_traits<RandomAccessIterator>::value_type>
operator + (typename re_detail::regex_iterator_traits<RandomAccessIterator>::value_type const& s,

View File

@ -155,11 +155,11 @@ parser_buf<charT, traits>::seekpos(pos_type sp, ::std::ios_base::openmode which)
{
if(which & ::std::ios_base::out)
return pos_type(off_type(-1));
std::ptrdiff_t size = this->egptr() - this->eback();
off_type size = this->egptr() - this->eback();
charT* g = this->eback();
if(sp <= size)
if(off_type(sp) <= size)
{
this->setg(g, g + ::std::streamsize(sp), g + size);
this->setg(g, g + off_type(sp), g + size);
}
return pos_type(off_type(-1));
}
@ -234,7 +234,7 @@ message_data<char>::message_data(const std::locale& l, std::string regex_message
#endif
for(std::size_t j = 0; j < s.size(); ++j)
{
syntax_map[s[j]] = (unsigned char)(i);
syntax_map[(unsigned char)s[j]] = (unsigned char)(i);
}
}
@ -640,7 +640,11 @@ message_data<wchar_t>::message_data(const std::locale& l, const std::string& reg
#endif
for(unsigned int j = 0; j < s.size(); ++j)
{
#if defined(WCHAR_MIN) && (WCHAR_MIN == 0)
if(s[j] <= UCHAR_MAX)
#else
if((s[j] <= UCHAR_MAX) && (s[j] >= 0))
#endif
syntax_[s[j]] = static_cast<unsigned char>(i);
else
{

View File

@ -123,7 +123,7 @@ BOOST_REGEX_DECL void BOOST_REGEX_CALL put_mem_block(void* p)
#else
mem_block_cache block_cache = { 0, };
mem_block_cache block_cache = { 0, 0, };
BOOST_REGEX_DECL void* BOOST_REGEX_CALL get_mem_block()
{

View File

@ -28,7 +28,7 @@ int main()
typedef boost::bidirectional_iterator_archetype<char> iterator_type;
typedef boost::input_iterator_archetype<char> input_iterator_type;
input_iterator_type i, j;
#if!defined(BOOST_NO_MEMBER_TEMPLATES) && !defined(__IBMCPP__)
#if!defined(BOOST_NO_MEMBER_TEMPLATES) && !defined(__IBMCPP__) && !BOOST_WORKAROUND(__GNUC__, < 3)
boost::regex r(i, j);
r.assign(i, j);
#else
@ -62,7 +62,6 @@ int main()
boost::regex_token_iterator<iterator_type>
>
>();
#endif
#endif
//
// verify basic_regex member functions:
@ -81,7 +80,7 @@ int main()
r.assign(s, boost::regex::perl);
r.assign(c_exp, c_exp+1);
r.assign(c_exp, c_exp+1, boost::regex::perl);
#endif
return 0;
}