-
Notifications
You must be signed in to change notification settings - Fork 45
Expand file tree
/
Copy pathboost_182_json_noexceptions.diff
More file actions
56 lines (54 loc) · 1.59 KB
/
boost_182_json_noexceptions.diff
File metadata and controls
56 lines (54 loc) · 1.59 KB
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
diff --git a/libs/json/include/boost/json/detail/value_to.hpp b/libs/json/include/boost/json/detail/value_to.hpp
index 7cb779e..6df1c9d 100644
--- a/libs/json/include/boost/json/detail/value_to.hpp
+++ b/libs/json/include/boost/json/detail/value_to.hpp
@@ -652,10 +652,13 @@ value_to_impl(
value const& jv,
user_conversion_tag)
{
+#ifndef BOOST_NO_EXCEPTIONS
try
{
+#endif // BOOST_NO_EXCEPTIONS
return {
boost::system::in_place_value, tag_invoke(value_to_tag<T>(), jv)};
+#ifndef BOOST_NO_EXCEPTIONS
}
catch( std::bad_alloc const&)
{
@@ -671,6 +674,7 @@ value_to_impl(
BOOST_JSON_FAIL(ec, error::exception);
return {boost::system::in_place_error, ec};
}
+#endif // BOOST_NO_EXCEPTIONS
}
// no suitable conversion implementation
diff --git a/libs/json/include/boost/json/impl/value.ipp b/libs/json/include/boost/json/impl/value.ipp
index 7460c02..7513b38 100644
--- a/libs/json/include/boost/json/impl/value.ipp
+++ b/libs/json/include/boost/json/impl/value.ipp
@@ -381,7 +381,9 @@ operator>>(
char read_buf[BOOST_JSON_STACK_BUFFER_SIZE / 2];
std::streambuf& buf = *is.rdbuf();
std::ios::iostate err = std::ios::goodbit;
+#ifndef BOOST_NO_EXCEPTIONS
try
+#endif
{
while( true )
{
@@ -437,6 +439,7 @@ operator>>(
break;
}
}
+#ifndef BOOST_NO_EXCEPTIONS
catch(...)
{
try
@@ -450,6 +453,7 @@ operator>>(
if( is.exceptions() & std::ios::badbit )
throw;
}
+#endif
is.setstate(err | std::ios::failbit);
return is;