Skip to content

Commit 574fad6

Browse files
authored
Merge pull request boostorg#100 from boostorg/git_issue_80
Suppress msvc warnings.
2 parents 70c3ffa + bc160a5 commit 574fad6

19 files changed

+156
-41
lines changed

include/boost/regex/pattern_except.hpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,16 @@ namespace boost{
4343
#ifdef BOOST_MSVC
4444
#pragma warning(push)
4545
#pragma warning(disable : 4275)
46+
#if BOOST_MSVC >= 1800
47+
#pragma warning(disable : 26812)
48+
#endif
4649
#endif
4750
class BOOST_REGEX_DECL regex_error : public std::runtime_error
4851
{
4952
public:
5053
explicit regex_error(const std::string& s, regex_constants::error_type err = regex_constants::error_unknown, std::ptrdiff_t pos = 0);
5154
explicit regex_error(regex_constants::error_type err);
52-
~regex_error() throw();
55+
~regex_error() BOOST_NOEXCEPT_OR_NOTHROW;
5356
regex_constants::error_type code()const
5457
{ return m_error_code; }
5558
std::ptrdiff_t position()const

include/boost/regex/pending/object_cache.hpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@ class object_cache
5757
friend struct data;
5858
};
5959

60+
#ifdef BOOST_MSVC
61+
#pragma warning(push)
62+
#pragma warning(disable: 4702)
63+
#endif
6064
template <class Key, class Object>
6165
boost::shared_ptr<Object const> object_cache<Key, Object>::get(const Key& k, size_type l_max_cache_size)
6266
{
@@ -80,6 +84,9 @@ boost::shared_ptr<Object const> object_cache<Key, Object>::get(const Key& k, siz
8084
return do_get(k, l_max_cache_size);
8185
#endif
8286
}
87+
#ifdef BOOST_MSVC
88+
#pragma warning(pop)
89+
#endif
8390

8491
template <class Key, class Object>
8592
boost::shared_ptr<Object const> object_cache<Key, Object>::do_get(const Key& k, size_type l_max_cache_size)

include/boost/regex/v4/basic_regex.hpp

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,9 +171,19 @@ struct regex_data : public named_subexpressions
171171

172172
regex_data(const ::boost::shared_ptr<
173173
::boost::regex_traits_wrapper<traits> >& t)
174-
: m_ptraits(t), m_expression(0), m_expression_len(0), m_disable_match_any(false) {}
174+
: m_ptraits(t), m_flags(0), m_status(0), m_expression(0), m_expression_len(0),
175+
m_mark_count(0), m_first_state(0), m_restart_type(0),
176+
#if !defined(BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX) && !(defined(BOOST_MSVC) && (BOOST_MSVC < 1900))
177+
m_startmap{ 0 },
178+
#endif
179+
m_can_be_null(0), m_word_mask(0), m_has_recursions(false), m_disable_match_any(false) {}
175180
regex_data()
176-
: m_ptraits(new ::boost::regex_traits_wrapper<traits>()), m_expression(0), m_expression_len(0), m_disable_match_any(false) {}
181+
: m_ptraits(new ::boost::regex_traits_wrapper<traits>()), m_flags(0), m_status(0), m_expression(0), m_expression_len(0),
182+
m_mark_count(0), m_first_state(0), m_restart_type(0),
183+
#if !defined(BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX) && !(defined(BOOST_MSVC) && (BOOST_MSVC < 1900))
184+
m_startmap{ 0 },
185+
#endif
186+
m_can_be_null(0), m_word_mask(0), m_has_recursions(false), m_disable_match_any(false) {}
177187

178188
::boost::shared_ptr<
179189
::boost::regex_traits_wrapper<traits>

include/boost/regex/v4/basic_regex_creator.hpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,8 @@ class basic_regex_creator
269269

270270
template <class charT, class traits>
271271
basic_regex_creator<charT, traits>::basic_regex_creator(regex_data<charT, traits>* data)
272-
: m_pdata(data), m_traits(*(data->m_ptraits)), m_last_state(0), m_repeater_id(0), m_has_backrefs(false), m_has_recursions(false)
272+
: m_pdata(data), m_traits(*(data->m_ptraits)), m_last_state(0), m_icase(false), m_repeater_id(0),
273+
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)
273274
{
274275
m_pdata->m_data.clear();
275276
m_pdata->m_status = ::boost::regex_constants::error_ok;
@@ -1514,13 +1515,20 @@ void basic_regex_creator<charT, traits>::probe_leading_repeat(re_syntax_base* st
15141515
state = state->next.p;
15151516
continue;
15161517
}
1518+
#ifdef BOOST_MSVC
1519+
# pragma warning(push)
1520+
#pragma warning(disable:6011)
1521+
#endif
15171522
if((static_cast<re_brace*>(state)->index == -1)
15181523
|| (static_cast<re_brace*>(state)->index == -2))
15191524
{
15201525
// skip past the zero width assertion:
15211526
state = static_cast<const re_jump*>(state->next.p)->alt.p->next.p;
15221527
continue;
15231528
}
1529+
#ifdef BOOST_MSVC
1530+
# pragma warning(pop)
1531+
#endif
15241532
if(static_cast<re_brace*>(state)->index == -3)
15251533
{
15261534
// Have to skip the leading jump state:

include/boost/regex/v4/basic_regex_parser.hpp

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@
2222
#ifdef BOOST_MSVC
2323
#pragma warning(push)
2424
#pragma warning(disable: 4103)
25+
#if BOOST_MSVC >= 1800
26+
#pragma warning(disable: 26812)
27+
#endif
2528
#endif
2629
#ifdef BOOST_HAS_ABI_HEADERS
2730
# include BOOST_ABI_PREFIX
@@ -124,7 +127,8 @@ class basic_regex_parser : public basic_regex_creator<charT, traits>
124127

125128
template <class charT, class traits>
126129
basic_regex_parser<charT, traits>::basic_regex_parser(regex_data<charT, traits>* data)
127-
: 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)
130+
: basic_regex_creator<charT, traits>(data), m_parser_proc(), m_base(0), m_end(0), m_position(0),
131+
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)
128132
{
129133
}
130134

@@ -321,6 +325,12 @@ bool basic_regex_parser<charT, traits>::parse_basic()
321325
return true;
322326
}
323327

328+
#ifdef BOOST_MSVC
329+
# pragma warning(push)
330+
#if BOOST_MSVC >= 1800
331+
#pragma warning(disable:26812)
332+
#endif
333+
#endif
324334
template <class charT, class traits>
325335
bool basic_regex_parser<charT, traits>::parse_extended()
326336
{
@@ -409,6 +419,9 @@ bool basic_regex_parser<charT, traits>::parse_extended()
409419
return result;
410420
}
411421
#ifdef BOOST_MSVC
422+
# pragma warning(pop)
423+
#endif
424+
#ifdef BOOST_MSVC
412425
#pragma warning(pop)
413426
#endif
414427

@@ -911,7 +924,7 @@ bool basic_regex_parser<charT, traits>::parse_extended_escape()
911924
pc = m_position;
912925
}
913926
if(negative)
914-
i = 1 + m_mark_count - i;
927+
i = 1 + (static_cast<boost::intmax_t>(m_mark_count) - i);
915928
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)))))
916929
{
917930
m_position = pc;
@@ -2132,7 +2145,7 @@ bool basic_regex_parser<charT, traits>::parse_perl_extension()
21322145
// Oops not a relative recursion at all, but a (?-imsx) group:
21332146
goto option_group_jump;
21342147
}
2135-
v = m_mark_count + 1 - v;
2148+
v = static_cast<boost::intmax_t>(m_mark_count) + 1 - v;
21362149
if(v <= 0)
21372150
{
21382151
// Rewind to start of (? sequence:
@@ -2746,6 +2759,12 @@ bool basic_regex_parser<charT, traits>::match_verb(const char* verb)
27462759
return true;
27472760
}
27482761

2762+
#ifdef BOOST_MSVC
2763+
# pragma warning(push)
2764+
#if BOOST_MSVC >= 1800
2765+
#pragma warning(disable:26812)
2766+
#endif
2767+
#endif
27492768
template <class charT, class traits>
27502769
bool basic_regex_parser<charT, traits>::parse_perl_verb()
27512770
{
@@ -2914,6 +2933,9 @@ bool basic_regex_parser<charT, traits>::parse_perl_verb()
29142933
fail(regex_constants::error_perl_extension, m_position - m_base);
29152934
return false;
29162935
}
2936+
#ifdef BOOST_MSVC
2937+
# pragma warning(pop)
2938+
#endif
29172939

29182940
template <class charT, class traits>
29192941
bool basic_regex_parser<charT, traits>::add_emacs_code(bool negate)

include/boost/regex/v4/cpp_regex_traits.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ template <class charT>
174174
struct cpp_regex_traits_base
175175
{
176176
cpp_regex_traits_base(const std::locale& l)
177-
{ imbue(l); }
177+
{ (void)imbue(l); }
178178
std::locale imbue(const std::locale& l);
179179

180180
std::locale m_locale;

include/boost/regex/v4/match_flags.hpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,13 @@ namespace boost{
2828
namespace regex_constants{
2929
#endif
3030

31+
#ifdef BOOST_MSVC
32+
#pragma warning(push)
33+
#if BOOST_MSVC >= 1800
34+
#pragma warning(disable : 26812)
35+
#endif
36+
#endif
37+
3138
typedef enum _match_flags
3239
{
3340
match_default = 0,
@@ -143,6 +150,11 @@ using regex_constants::format_no_copy;
143150
using regex_constants::format_first_only;
144151
/*using regex_constants::format_is_if;*/
145152

153+
#ifdef BOOST_MSVC
154+
#pragma warning(pop)
155+
#endif
156+
157+
146158
} /* namespace boost */
147159
#endif /* __cplusplus */
148160
#endif /* include guard */

include/boost/regex/v4/match_results.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ class match_results
9595
// See https://svn.boost.org/trac/boost/ticket/3632.
9696
//
9797
match_results(const match_results& m)
98-
: 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)
98+
: 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)
9999
{
100100
if(!m_is_singular)
101101
{

include/boost/regex/v4/perl_matcher.hpp

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,13 @@
2727

2828
#ifdef BOOST_MSVC
2929
# pragma warning(push)
30+
#pragma warning(disable : 4251)
31+
#if BOOST_MSVC < 1700
32+
# pragma warning(disable : 4231)
33+
#endif
34+
# if BOOST_MSVC < 1600
35+
# pragma warning(disable : 4660)
36+
# endif
3037
#if BOOST_MSVC < 1910
3138
#pragma warning(disable:4800)
3239
#endif
@@ -341,6 +348,12 @@ enum saved_state_type
341348
saved_state_count = 14
342349
};
343350

351+
#ifdef BOOST_MSVC
352+
# pragma warning(push)
353+
#if BOOST_MSVC >= 1800
354+
#pragma warning(disable:26495)
355+
#endif
356+
#endif
344357
template <class Results>
345358
struct recursion_info
346359
{
@@ -352,16 +365,8 @@ struct recursion_info
352365
repeater_count<iterator>* repeater_stack;
353366
iterator location_of_start;
354367
};
355-
356368
#ifdef BOOST_MSVC
357-
#pragma warning(push)
358-
#pragma warning(disable : 4251)
359-
#if BOOST_MSVC < 1700
360-
# pragma warning(disable : 4231)
361-
#endif
362-
# if BOOST_MSVC < 1600
363-
# pragma warning(disable : 4660)
364-
# endif
369+
# pragma warning(pop)
365370
#endif
366371

367372
template <class BidiIterator, class Allocator, class traits>
@@ -578,6 +583,12 @@ class perl_matcher
578583
unsigned m_recursions;
579584
#endif
580585

586+
#ifdef BOOST_MSVC
587+
# pragma warning(push)
588+
#if BOOST_MSVC >= 1800
589+
#pragma warning(disable:26495)
590+
#endif
591+
#endif
581592
// these operations aren't allowed, so are declared private,
582593
// bodies are provided to keep explicit-instantiation requests happy:
583594
perl_matcher& operator=(const perl_matcher&)
@@ -586,14 +597,17 @@ class perl_matcher
586597
}
587598
perl_matcher(const perl_matcher& that)
588599
: m_result(that.m_result), re(that.re), traits_inst(that.traits_inst), rep_obj(0) {}
589-
};
590-
591600
#ifdef BOOST_MSVC
592-
#pragma warning(pop)
601+
# pragma warning(pop)
593602
#endif
603+
};
594604

595605
} // namespace BOOST_REGEX_DETAIL_NS
596606

607+
#ifdef BOOST_MSVC
608+
# pragma warning(pop)
609+
#endif
610+
597611
#ifdef BOOST_MSVC
598612
#pragma warning(push)
599613
#pragma warning(disable: 4103)
@@ -607,10 +621,6 @@ class perl_matcher
607621

608622
} // namespace boost
609623

610-
#ifdef BOOST_MSVC
611-
# pragma warning(pop)
612-
#endif
613-
614624
//
615625
// include the implementation of perl_matcher:
616626
//

include/boost/regex/v4/perl_matcher_common.hpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@
2323
#ifdef BOOST_MSVC
2424
#pragma warning(push)
2525
#pragma warning(disable: 4103)
26+
#if BOOST_MSVC >= 1800
27+
#pragma warning(disable: 26812)
28+
#endif
2629
#endif
2730
#ifdef BOOST_HAS_ABI_HEADERS
2831
# include BOOST_ABI_PREFIX
@@ -44,7 +47,11 @@
4447
namespace boost{
4548
namespace BOOST_REGEX_DETAIL_NS{
4649

47-
template <class BidiIterator, class Allocator, class traits>
50+
#ifdef BOOST_MSVC
51+
# pragma warning(push)
52+
#pragma warning(disable:26812)
53+
#endif
54+
template <class BidiIterator, class Allocator, class traits>
4855
void perl_matcher<BidiIterator, Allocator, traits>::construct_init(const basic_regex<char_type, traits>& e, match_flag_type f)
4956
{
5057
typedef typename regex_iterator_traits<BidiIterator>::iterator_category category;
@@ -94,6 +101,9 @@ void perl_matcher<BidiIterator, Allocator, traits>::construct_init(const basic_r
94101
if(e.get_data().m_disable_match_any)
95102
m_match_flags &= regex_constants::match_not_any;
96103
}
104+
#ifdef BOOST_MSVC
105+
# pragma warning(pop)
106+
#endif
97107

98108
template <class BidiIterator, class Allocator, class traits>
99109
void perl_matcher<BidiIterator, Allocator, traits>::estimate_max_state_count(std::random_access_iterator_tag*)

0 commit comments

Comments
 (0)