Skip to content

Commit

Permalink
Merge pull request #100 from boostorg/git_issue_80
Browse files Browse the repository at this point in the history
Suppress msvc warnings.
  • Loading branch information
jzmaddock authored Jan 22, 2020
2 parents 70c3ffa + bc160a5 commit 574fad6
Show file tree
Hide file tree
Showing 19 changed files with 156 additions and 41 deletions.
5 changes: 4 additions & 1 deletion include/boost/regex/pattern_except.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,16 @@ namespace boost{
#ifdef BOOST_MSVC
#pragma warning(push)
#pragma warning(disable : 4275)
#if BOOST_MSVC >= 1800
#pragma warning(disable : 26812)
#endif
#endif
class BOOST_REGEX_DECL regex_error : public std::runtime_error
{
public:
explicit regex_error(const std::string& s, regex_constants::error_type err = regex_constants::error_unknown, std::ptrdiff_t pos = 0);
explicit regex_error(regex_constants::error_type err);
~regex_error() throw();
~regex_error() BOOST_NOEXCEPT_OR_NOTHROW;
regex_constants::error_type code()const
{ return m_error_code; }
std::ptrdiff_t position()const
Expand Down
7 changes: 7 additions & 0 deletions include/boost/regex/pending/object_cache.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ class object_cache
friend struct data;
};

#ifdef BOOST_MSVC
#pragma warning(push)
#pragma warning(disable: 4702)
#endif
template <class Key, class Object>
boost::shared_ptr<Object const> object_cache<Key, Object>::get(const Key& k, size_type l_max_cache_size)
{
Expand All @@ -80,6 +84,9 @@ boost::shared_ptr<Object const> object_cache<Key, Object>::get(const Key& k, siz
return do_get(k, l_max_cache_size);
#endif
}
#ifdef BOOST_MSVC
#pragma warning(pop)
#endif

template <class Key, class Object>
boost::shared_ptr<Object const> object_cache<Key, Object>::do_get(const Key& k, size_type l_max_cache_size)
Expand Down
14 changes: 12 additions & 2 deletions include/boost/regex/v4/basic_regex.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,19 @@ struct regex_data : public named_subexpressions

regex_data(const ::boost::shared_ptr<
::boost::regex_traits_wrapper<traits> >& t)
: m_ptraits(t), m_expression(0), m_expression_len(0), m_disable_match_any(false) {}
: 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),
#if !defined(BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX) && !(defined(BOOST_MSVC) && (BOOST_MSVC < 1900))
m_startmap{ 0 },
#endif
m_can_be_null(0), m_word_mask(0), m_has_recursions(false), m_disable_match_any(false) {}
regex_data()
: m_ptraits(new ::boost::regex_traits_wrapper<traits>()), m_expression(0), m_expression_len(0), m_disable_match_any(false) {}
: 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),
#if !defined(BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX) && !(defined(BOOST_MSVC) && (BOOST_MSVC < 1900))
m_startmap{ 0 },
#endif
m_can_be_null(0), m_word_mask(0), m_has_recursions(false), m_disable_match_any(false) {}

::boost::shared_ptr<
::boost::regex_traits_wrapper<traits>
Expand Down
10 changes: 9 additions & 1 deletion include/boost/regex/v4/basic_regex_creator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,8 @@ class basic_regex_creator

template <class charT, class traits>
basic_regex_creator<charT, traits>::basic_regex_creator(regex_data<charT, traits>* data)
: m_pdata(data), m_traits(*(data->m_ptraits)), m_last_state(0), m_repeater_id(0), m_has_backrefs(false), m_has_recursions(false)
: m_pdata(data), m_traits(*(data->m_ptraits)), m_last_state(0), m_icase(false), m_repeater_id(0),
m_has_backrefs(false), m_bad_repeats(0), m_has_recursions(false), m_word_mask(0), m_mask_space(0), m_lower_mask(0), m_upper_mask(0), m_alpha_mask(0)
{
m_pdata->m_data.clear();
m_pdata->m_status = ::boost::regex_constants::error_ok;
Expand Down Expand Up @@ -1514,13 +1515,20 @@ void basic_regex_creator<charT, traits>::probe_leading_repeat(re_syntax_base* st
state = state->next.p;
continue;
}
#ifdef BOOST_MSVC
# pragma warning(push)
#pragma warning(disable:6011)
#endif
if((static_cast<re_brace*>(state)->index == -1)
|| (static_cast<re_brace*>(state)->index == -2))
{
// skip past the zero width assertion:
state = static_cast<const re_jump*>(state->next.p)->alt.p->next.p;
continue;
}
#ifdef BOOST_MSVC
# pragma warning(pop)
#endif
if(static_cast<re_brace*>(state)->index == -3)
{
// Have to skip the leading jump state:
Expand Down
28 changes: 25 additions & 3 deletions include/boost/regex/v4/basic_regex_parser.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
#ifdef BOOST_MSVC
#pragma warning(push)
#pragma warning(disable: 4103)
#if BOOST_MSVC >= 1800
#pragma warning(disable: 26812)
#endif
#endif
#ifdef BOOST_HAS_ABI_HEADERS
# include BOOST_ABI_PREFIX
Expand Down Expand Up @@ -124,7 +127,8 @@ class basic_regex_parser : public basic_regex_creator<charT, traits>

template <class charT, class traits>
basic_regex_parser<charT, traits>::basic_regex_parser(regex_data<charT, traits>* data)
: basic_regex_creator<charT, traits>(data), m_mark_count(0), m_mark_reset(-1), m_max_mark(0), m_paren_start(0), m_alt_insert_point(0), m_has_case_change(false), m_recursion_count(0)
: basic_regex_creator<charT, traits>(data), m_parser_proc(), m_base(0), m_end(0), m_position(0),
m_mark_count(0), m_mark_reset(-1), m_max_mark(0), m_paren_start(0), m_alt_insert_point(0), m_has_case_change(false), m_recursion_count(0)
{
}

Expand Down Expand Up @@ -321,6 +325,12 @@ bool basic_regex_parser<charT, traits>::parse_basic()
return true;
}

#ifdef BOOST_MSVC
# pragma warning(push)
#if BOOST_MSVC >= 1800
#pragma warning(disable:26812)
#endif
#endif
template <class charT, class traits>
bool basic_regex_parser<charT, traits>::parse_extended()
{
Expand Down Expand Up @@ -409,6 +419,9 @@ bool basic_regex_parser<charT, traits>::parse_extended()
return result;
}
#ifdef BOOST_MSVC
# pragma warning(pop)
#endif
#ifdef BOOST_MSVC
#pragma warning(pop)
#endif

Expand Down Expand Up @@ -911,7 +924,7 @@ bool basic_regex_parser<charT, traits>::parse_extended_escape()
pc = m_position;
}
if(negative)
i = 1 + m_mark_count - i;
i = 1 + (static_cast<boost::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;
Expand Down Expand Up @@ -2132,7 +2145,7 @@ bool basic_regex_parser<charT, traits>::parse_perl_extension()
// Oops not a relative recursion at all, but a (?-imsx) group:
goto option_group_jump;
}
v = m_mark_count + 1 - v;
v = static_cast<boost::intmax_t>(m_mark_count) + 1 - v;
if(v <= 0)
{
// Rewind to start of (? sequence:
Expand Down Expand Up @@ -2746,6 +2759,12 @@ bool basic_regex_parser<charT, traits>::match_verb(const char* verb)
return true;
}

#ifdef BOOST_MSVC
# pragma warning(push)
#if BOOST_MSVC >= 1800
#pragma warning(disable:26812)
#endif
#endif
template <class charT, class traits>
bool basic_regex_parser<charT, traits>::parse_perl_verb()
{
Expand Down Expand Up @@ -2914,6 +2933,9 @@ bool basic_regex_parser<charT, traits>::parse_perl_verb()
fail(regex_constants::error_perl_extension, m_position - m_base);
return false;
}
#ifdef BOOST_MSVC
# pragma warning(pop)
#endif

template <class charT, class traits>
bool basic_regex_parser<charT, traits>::add_emacs_code(bool negate)
Expand Down
2 changes: 1 addition & 1 deletion include/boost/regex/v4/cpp_regex_traits.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ template <class charT>
struct cpp_regex_traits_base
{
cpp_regex_traits_base(const std::locale& l)
{ imbue(l); }
{ (void)imbue(l); }
std::locale imbue(const std::locale& l);

std::locale m_locale;
Expand Down
12 changes: 12 additions & 0 deletions include/boost/regex/v4/match_flags.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@ namespace boost{
namespace regex_constants{
#endif

#ifdef BOOST_MSVC
#pragma warning(push)
#if BOOST_MSVC >= 1800
#pragma warning(disable : 26812)
#endif
#endif

typedef enum _match_flags
{
match_default = 0,
Expand Down Expand Up @@ -143,6 +150,11 @@ using regex_constants::format_no_copy;
using regex_constants::format_first_only;
/*using regex_constants::format_is_if;*/

#ifdef BOOST_MSVC
#pragma warning(pop)
#endif


} /* namespace boost */
#endif /* __cplusplus */
#endif /* include guard */
Expand Down
2 changes: 1 addition & 1 deletion include/boost/regex/v4/match_results.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ class match_results
// See https://svn.boost.org/trac/boost/ticket/3632.
//
match_results(const match_results& m)
: m_subs(m.m_subs), m_named_subs(m.m_named_subs), m_last_closed_paren(m.m_last_closed_paren), m_is_singular(m.m_is_singular)
: m_subs(m.m_subs), m_base(), m_null(), m_named_subs(m.m_named_subs), m_last_closed_paren(m.m_last_closed_paren), m_is_singular(m.m_is_singular)
{
if(!m_is_singular)
{
Expand Down
42 changes: 26 additions & 16 deletions include/boost/regex/v4/perl_matcher.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@

#ifdef BOOST_MSVC
# pragma warning(push)
#pragma warning(disable : 4251)
#if BOOST_MSVC < 1700
# pragma warning(disable : 4231)
#endif
# if BOOST_MSVC < 1600
# pragma warning(disable : 4660)
# endif
#if BOOST_MSVC < 1910
#pragma warning(disable:4800)
#endif
Expand Down Expand Up @@ -341,6 +348,12 @@ enum saved_state_type
saved_state_count = 14
};

#ifdef BOOST_MSVC
# pragma warning(push)
#if BOOST_MSVC >= 1800
#pragma warning(disable:26495)
#endif
#endif
template <class Results>
struct recursion_info
{
Expand All @@ -352,16 +365,8 @@ struct recursion_info
repeater_count<iterator>* repeater_stack;
iterator location_of_start;
};

#ifdef BOOST_MSVC
#pragma warning(push)
#pragma warning(disable : 4251)
#if BOOST_MSVC < 1700
# pragma warning(disable : 4231)
#endif
# if BOOST_MSVC < 1600
# pragma warning(disable : 4660)
# endif
# pragma warning(pop)
#endif

template <class BidiIterator, class Allocator, class traits>
Expand Down Expand Up @@ -578,6 +583,12 @@ class perl_matcher
unsigned m_recursions;
#endif

#ifdef BOOST_MSVC
# pragma warning(push)
#if BOOST_MSVC >= 1800
#pragma warning(disable:26495)
#endif
#endif
// these operations aren't allowed, so are declared private,
// bodies are provided to keep explicit-instantiation requests happy:
perl_matcher& operator=(const perl_matcher&)
Expand All @@ -586,14 +597,17 @@ class perl_matcher
}
perl_matcher(const perl_matcher& that)
: m_result(that.m_result), re(that.re), traits_inst(that.traits_inst), rep_obj(0) {}
};

#ifdef BOOST_MSVC
#pragma warning(pop)
# pragma warning(pop)
#endif
};

} // namespace BOOST_REGEX_DETAIL_NS

#ifdef BOOST_MSVC
# pragma warning(pop)
#endif

#ifdef BOOST_MSVC
#pragma warning(push)
#pragma warning(disable: 4103)
Expand All @@ -607,10 +621,6 @@ class perl_matcher

} // namespace boost

#ifdef BOOST_MSVC
# pragma warning(pop)
#endif

//
// include the implementation of perl_matcher:
//
Expand Down
12 changes: 11 additions & 1 deletion include/boost/regex/v4/perl_matcher_common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
#ifdef BOOST_MSVC
#pragma warning(push)
#pragma warning(disable: 4103)
#if BOOST_MSVC >= 1800
#pragma warning(disable: 26812)
#endif
#endif
#ifdef BOOST_HAS_ABI_HEADERS
# include BOOST_ABI_PREFIX
Expand All @@ -44,7 +47,11 @@
namespace boost{
namespace BOOST_REGEX_DETAIL_NS{

template <class BidiIterator, class Allocator, class traits>
#ifdef BOOST_MSVC
# pragma warning(push)
#pragma warning(disable:26812)
#endif
template <class BidiIterator, class Allocator, class traits>
void perl_matcher<BidiIterator, Allocator, traits>::construct_init(const basic_regex<char_type, traits>& e, match_flag_type f)
{
typedef typename regex_iterator_traits<BidiIterator>::iterator_category category;
Expand Down Expand Up @@ -94,6 +101,9 @@ void perl_matcher<BidiIterator, Allocator, traits>::construct_init(const basic_r
if(e.get_data().m_disable_match_any)
m_match_flags &= regex_constants::match_not_any;
}
#ifdef BOOST_MSVC
# pragma warning(pop)
#endif

template <class BidiIterator, class Allocator, class traits>
void perl_matcher<BidiIterator, Allocator, traits>::estimate_max_state_count(std::random_access_iterator_tag*)
Expand Down
7 changes: 7 additions & 0 deletions include/boost/regex/v4/regex_format.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@ struct trivial_format_traits
}
};

#ifdef BOOST_MSVC
# pragma warning(push)
#pragma warning(disable:26812)
#endif
template <class OutputIterator, class Results, class traits, class ForwardIter>
class basic_regex_formatter
{
Expand Down Expand Up @@ -203,6 +207,9 @@ class basic_regex_formatter
basic_regex_formatter(const basic_regex_formatter&);
basic_regex_formatter& operator=(const basic_regex_formatter&);
};
#ifdef BOOST_MSVC
# pragma warning(pop)
#endif

template <class OutputIterator, class Results, class traits, class ForwardIter>
OutputIterator basic_regex_formatter<OutputIterator, Results, traits, ForwardIter>::format(ForwardIter p1, ForwardIter p2, match_flag_type f)
Expand Down
8 changes: 4 additions & 4 deletions include/boost/regex/v4/regex_token_iterator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,16 +67,16 @@ class regex_token_iterator_implementation

public:
regex_token_iterator_implementation(const regex_type* p, BidirectionalIterator last, int sub, match_flag_type f)
: end(last), re(*p), flags(f){ subs.push_back(sub); }
: end(last), re(*p), flags(f), N(0){ subs.push_back(sub); }
regex_token_iterator_implementation(const regex_type* p, BidirectionalIterator last, const std::vector<int>& v, match_flag_type f)
: end(last), re(*p), flags(f), subs(v){}
: end(last), re(*p), flags(f), N(0), subs(v){}
#if !BOOST_WORKAROUND(__HP_aCC, < 60700)
#if (BOOST_WORKAROUND(__BORLANDC__, >= 0x560) && BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x570)))\
|| BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003)) \
|| BOOST_WORKAROUND(__HP_aCC, < 60700)
template <class T>
regex_token_iterator_implementation(const regex_type* p, BidirectionalIterator last, const T& submatches, match_flag_type f)
: end(last), re(*p), flags(f)
: end(last), re(*p), flags(f), N(0)
{
// assert that T really is an array:
BOOST_STATIC_ASSERT(::boost::is_array<T>::value);
Expand All @@ -89,7 +89,7 @@ class regex_token_iterator_implementation
#else
template <std::size_t CN>
regex_token_iterator_implementation(const regex_type* p, BidirectionalIterator last, const int (&submatches)[CN], match_flag_type f)
: end(last), re(*p), flags(f)
: end(last), re(*p), flags(f), N(0)
{
for(std::size_t i = 0; i < CN; ++i)
{
Expand Down
Loading

0 comments on commit 574fad6

Please sign in to comment.