forked from Juniper/contrail-third-party
-
Notifications
You must be signed in to change notification settings - Fork 0
/
boost_1_48_patch2.diff
196 lines (193 loc) · 7.03 KB
/
boost_1_48_patch2.diff
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
diff --git a/third_party/boost_1_48_0/boost/date_time/format_date_parser.hpp b/third_party/boost_1_48_0/boost/date_time/format_date_parser.hpp
index a4a4d0d..517fc0e 100644
--- a/third_party/boost_1_48_0/boost/date_time/format_date_parser.hpp
+++ b/third_party/boost_1_48_0/boost/date_time/format_date_parser.hpp
@@ -68,11 +68,17 @@ fixed_string_to_int(std::istreambuf_iterator<charT>& itr,
if(mr.cache.size() < length) {
return i;
}
- try {
+#ifndef BOOST_NO_EXCEPTIONS
+ try
+#endif
+ {
i = boost::lexical_cast<int_type>(mr.cache);
- }catch(bad_lexical_cast&){
+ }
+#ifndef BOOST_NO_EXCEPTIONS
+ catch(bad_lexical_cast&){
// we want to return -1 if the cast fails so nothing to do here
}
+#endif
return i;
}
diff --git a/third_party/boost_1_48_0/boost/date_time/time_facet.hpp b/third_party/boost_1_48_0/boost/date_time/time_facet.hpp
index d20e7cc..9d98405 100644
--- a/third_party/boost_1_48_0/boost/date_time/time_facet.hpp
+++ b/third_party/boost_1_48_0/boost/date_time/time_facet.hpp
@@ -1005,20 +1005,23 @@ namespace date_time {
char_type cs[3] = { '%', *itr };
string_type s(cs);
match_results mr;
- try {
+#ifndef BOOST_NO_EXCEPTIONS
+ try
+#endif
+ {
t_year = this->m_parser.parse_year(sitr, stream_end, s, mr);
}
+#ifndef BOOST_NO_EXCEPTIONS
catch(std::out_of_range&) { // base class for bad_year exception
if(this->m_sv_parser.match(sitr, stream_end, mr)) {
t = time_type(static_cast<special_values>(mr.current_match));
return sitr;
}
-#ifndef BOOST_NO_EXCEPTIONS
else {
throw; // rethrow bad_year
}
-#endif
}
+#endif
break;
}
case 'B':
@@ -1028,20 +1031,23 @@ namespace date_time {
char_type cs[3] = { '%', *itr };
string_type s(cs);
match_results mr;
- try {
+#ifndef BOOST_NO_EXCEPTIONS
+ try
+#endif
+ {
t_month = this->m_parser.parse_month(sitr, stream_end, s, mr);
}
+#ifndef BOOST_NO_EXCEPTIONS
catch(std::out_of_range&) { // base class for bad_month exception
if(this->m_sv_parser.match(sitr, stream_end, mr)) {
t = time_type(static_cast<special_values>(mr.current_match));
return sitr;
}
-#ifndef BOOST_NO_EXCEPTIONS
else {
throw; // rethrow bad_month
}
-#endif
}
+#endif
// did m_parser already advance sitr to next char?
if(mr.has_remaining()) {
use_current_char = true;
@@ -1057,20 +1063,23 @@ namespace date_time {
string_type s(cs);
match_results mr;
typename date_type::day_of_week_type wd(0);
- try {
+#ifndef BOOST_NO_EXCEPTIONS
+ try
+#endif
+ {
wd = this->m_parser.parse_weekday(sitr, stream_end, s, mr);
}
+#ifndef BOOST_NO_EXCEPTIONS
catch(std::out_of_range&) { // base class for bad_weekday exception
if(this->m_sv_parser.match(sitr, stream_end, mr)) {
t = time_type(static_cast<special_values>(mr.current_match));
return sitr;
}
-#ifndef BOOST_NO_EXCEPTIONS
else {
throw; // rethrow bad_weekday
}
-#endif
}
+#endif
// did m_parser already advance sitr to next char?
if(mr.has_remaining()) {
use_current_char = true;
@@ -1095,21 +1104,24 @@ namespace date_time {
}
case 'd':
{
- try {
+#ifndef BOOST_NO_EXCEPTIONS
+ try
+#endif
+ {
t_day = this->m_parser.parse_day_of_month(sitr, stream_end);
}
+#ifndef BOOST_NO_EXCEPTIONS
catch(std::out_of_range&) { // base class for exception bad_day_of_month
match_results mr;
if(this->m_sv_parser.match(sitr, stream_end, mr)) {
t = time_type(static_cast<special_values>(mr.current_match));
return sitr;
}
-#ifndef BOOST_NO_EXCEPTIONS
else {
throw; // rethrow bad_day_of_month
}
-#endif
}
+#endif
break;
}
// time flags
diff --git a/third_party/boost_1_48_0/boost/lexical_cast.hpp b/third_party/boost_1_48_0/boost/lexical_cast.hpp
index a989b81..49762c6 100644
--- a/third_party/boost_1_48_0/boost/lexical_cast.hpp
+++ b/third_party/boost_1_48_0/boost/lexical_cast.hpp
@@ -1800,7 +1800,10 @@ namespace boost
{
static inline Target lexical_cast_impl(const Source &arg)
{
- try{
+#ifndef BOOST_NO_EXCEPTIONS
+ try
+#endif
+ {
typedef boost::numeric::converter<
Target,
Source,
@@ -1814,10 +1817,14 @@ namespace boost
> Converter ;
return Converter::convert(arg);
- } catch( ::boost::numeric::bad_numeric_cast const& ) {
+ }
+
+#ifndef BOOST_NO_EXCEPTIONS
+ catch( ::boost::numeric::bad_numeric_cast const& ) {
BOOST_LCAST_THROW_BAD_CAST(Source, Target);
}
BOOST_UNREACHABLE_RETURN(static_cast<Target>(0));
+#endif
}
};
@@ -1826,7 +1833,10 @@ namespace boost
{
static inline Target lexical_cast_impl(const Source &arg)
{
- try{
+#ifndef BOOST_NO_EXCEPTIONS
+ try
+#endif
+ {
typedef boost::numeric::converter<
Target,
Source,
@@ -1845,9 +1855,13 @@ namespace boost
} else {
return Converter::convert(arg);
}
- } catch( ::boost::numeric::bad_numeric_cast const& ) {
+ }
+
+#ifndef BOOST_NO_EXCEPTIONS
+ catch( ::boost::numeric::bad_numeric_cast const& ) {
BOOST_LCAST_THROW_BAD_CAST(Source, Target);
}
+#endif
BOOST_UNREACHABLE_RETURN(static_cast<Target>(0));
}
};