Skip to content

Commit 5732965

Browse files
committed
Do not define boost::make_exception_ptr, as it's defined in Boost.Exception
1 parent 96cd717 commit 5732965

11 files changed

Lines changed: 44 additions & 155 deletions

test/sync/futures/future/get_or_pass.cpp

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@
2626
#pragma warning(disable: 4127) // conditional expression is constant
2727
#endif
2828

29-
namespace boost
30-
{
3129
template <typename T>
3230
struct wrap
3331
{
@@ -37,9 +35,8 @@ struct wrap
3735
};
3836

3937
template <typename T>
40-
exception_ptr make_exception_ptr(T v) {
41-
return copy_exception(wrap<T>(v));
42-
}
38+
boost::exception_ptr make_exception_ptr(T v) {
39+
return boost::copy_exception(wrap<T>(v));
4340
}
4441

4542
void func1(boost::promise<int> p)
@@ -51,7 +48,7 @@ void func1(boost::promise<int> p)
5148
void func2(boost::promise<int> p)
5249
{
5350
boost::this_thread::sleep_for(boost::chrono::milliseconds(500));
54-
p.set_exception(boost::make_exception_ptr(3));
51+
p.set_exception(::make_exception_ptr(3));
5552
}
5653

5754
int j = 0;
@@ -66,7 +63,7 @@ void func3(boost::promise<int&> p)
6663
void func4(boost::promise<int&> p)
6764
{
6865
boost::this_thread::sleep_for(boost::chrono::milliseconds(500));
69-
p.set_exception(boost::make_exception_ptr(3.5));
66+
p.set_exception(::make_exception_ptr(3.5));
7067
}
7168

7269
void func5(boost::promise<void> p)
@@ -78,7 +75,7 @@ void func5(boost::promise<void> p)
7875
void func6(boost::promise<void> p)
7976
{
8077
boost::this_thread::sleep_for(boost::chrono::milliseconds(500));
81-
p.set_exception(boost::make_exception_ptr(4));
78+
p.set_exception(::make_exception_ptr(4));
8279
}
8380

8481

@@ -110,7 +107,7 @@ int main()
110107
#if defined BOOST_THREAD_PROVIDES_SIGNATURE_PACKAGED_TASK && defined(BOOST_THREAD_PROVIDES_VARIADIC_THREAD)
111108
boost::thread(func2, boost::move(p)).detach();
112109
#else
113-
p.set_exception(boost::make_exception_ptr(3));
110+
p.set_exception(::make_exception_ptr(3));
114111
#endif
115112
BOOST_THREAD_LOG << BOOST_THREAD_END_LOG;
116113
try
@@ -159,7 +156,7 @@ int main()
159156
#if defined BOOST_THREAD_PROVIDES_SIGNATURE_PACKAGED_TASK && defined(BOOST_THREAD_PROVIDES_VARIADIC_THREAD)
160157
boost::thread(func4, boost::move(p)).detach();
161158
#else
162-
p.set_exception(boost::make_exception_ptr(3.5));
159+
p.set_exception(::make_exception_ptr(3.5));
163160
#endif
164161
try
165162
{

test/sync/futures/future/get_pass.cpp

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@
3636
#pragma warning(disable: 4127) // conditional expression is constant
3737
#endif
3838

39-
namespace boost
40-
{
4139
template <typename T>
4240
struct wrap
4341
{
@@ -47,9 +45,8 @@ struct wrap
4745
};
4846

4947
template <typename T>
50-
exception_ptr make_exception_ptr(T v) {
51-
return copy_exception(wrap<T>(v));
52-
}
48+
boost::exception_ptr make_exception_ptr(T v) {
49+
return boost::copy_exception(wrap<T>(v));
5350
}
5451

5552
void func1(boost::promise<int> p)
@@ -61,7 +58,7 @@ void func1(boost::promise<int> p)
6158
void func2(boost::promise<int> p)
6259
{
6360
boost::this_thread::sleep_for(boost::chrono::milliseconds(500));
64-
p.set_exception(boost::make_exception_ptr(3));
61+
p.set_exception(::make_exception_ptr(3));
6562
}
6663

6764
int j = 0;
@@ -76,7 +73,7 @@ void func3(boost::promise<int&> p)
7673
void func4(boost::promise<int&> p)
7774
{
7875
boost::this_thread::sleep_for(boost::chrono::milliseconds(500));
79-
p.set_exception(boost::make_exception_ptr(3.5));
76+
p.set_exception(::make_exception_ptr(3.5));
8077
}
8178

8279
void func5(boost::promise<void> p)
@@ -88,7 +85,7 @@ void func5(boost::promise<void> p)
8885
void func6(boost::promise<void> p)
8986
{
9087
boost::this_thread::sleep_for(boost::chrono::milliseconds(500));
91-
p.set_exception(boost::make_exception_ptr(4));
88+
p.set_exception(::make_exception_ptr(4));
9289
}
9390

9491

@@ -120,7 +117,7 @@ int main()
120117
#if defined BOOST_THREAD_PROVIDES_SIGNATURE_PACKAGED_TASK && defined(BOOST_THREAD_PROVIDES_VARIADIC_THREAD)
121118
boost::thread(func2, boost::move(p)).detach();
122119
#else
123-
p.set_exception(boost::make_exception_ptr(3));
120+
p.set_exception(::make_exception_ptr(3));
124121
#endif
125122
BOOST_THREAD_LOG << BOOST_THREAD_END_LOG;
126123
try
@@ -133,7 +130,7 @@ int main()
133130
BOOST_TEST(false);
134131
BOOST_THREAD_LOG << BOOST_THREAD_END_LOG;
135132
}
136-
catch (boost::wrap<int> const& i)
133+
catch (::wrap<int> const& i)
137134
{
138135
BOOST_THREAD_LOG << BOOST_THREAD_END_LOG;
139136
BOOST_TEST(i.value == 3);
@@ -177,15 +174,15 @@ int main()
177174
#if defined BOOST_THREAD_PROVIDES_SIGNATURE_PACKAGED_TASK && defined(BOOST_THREAD_PROVIDES_VARIADIC_THREAD)
178175
boost::thread(func4, boost::move(p)).detach();
179176
#else
180-
p.set_exception(boost::make_exception_ptr(3.5));
177+
p.set_exception(::make_exception_ptr(3.5));
181178
#endif
182179
try
183180
{
184181
BOOST_TEST(f.valid());
185182
BOOST_TEST(f.get() == 3);
186183
BOOST_TEST(false);
187184
}
188-
catch (boost::wrap<double> const& i)
185+
catch (::wrap<double> const& i)
189186
{
190187
BOOST_TEST(i.value == 3.5);
191188
}
@@ -200,7 +197,7 @@ int main()
200197
#if defined BOOST_THREAD_PROVIDES_SIGNATURE_PACKAGED_TASK && defined(BOOST_THREAD_PROVIDES_VARIADIC_THREAD)
201198
boost::thread(func4, boost::move(p)).detach();
202199
#else
203-
p.set_exception(boost::make_exception_ptr(3.5));
200+
p.set_exception(::make_exception_ptr(3.5));
204201
#endif
205202
try
206203
{
@@ -238,15 +235,15 @@ int main()
238235
#if defined BOOST_THREAD_PROVIDES_SIGNATURE_PACKAGED_TASK && defined(BOOST_THREAD_PROVIDES_VARIADIC_THREAD)
239236
boost::thread(func6, boost::move(p)).detach();
240237
#else
241-
p.set_exception(boost::make_exception_ptr(4));
238+
p.set_exception(::make_exception_ptr(4));
242239
#endif
243240
try
244241
{
245242
BOOST_TEST(f.valid());
246243
f.get();
247244
BOOST_TEST(false);
248245
}
249-
catch (boost::wrap<int> const& i)
246+
catch (::wrap<int> const& i)
250247
{
251248
BOOST_TEST(i.value == 4);
252249
}

test/sync/futures/future/wait_for_pass.cpp

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -48,22 +48,6 @@ namespace boost
4848
os << underlying_cast<int>(st) << " ";
4949
return os;
5050
}
51-
template <typename T>
52-
struct wrap
53-
{
54-
wrap(T const& v) :
55-
value(v)
56-
{
57-
}
58-
T value;
59-
60-
};
61-
62-
template <typename T>
63-
exception_ptr make_exception_ptr(T v)
64-
{
65-
return copy_exception(wrap<T> (v));
66-
}
6751
}
6852

6953
void func1(boost::promise<int> p)

test/sync/futures/future/wait_pass.cpp

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -46,22 +46,6 @@ namespace boost
4646
os << underlying_cast<int>(st) << " ";
4747
return os;
4848
}
49-
template <typename T>
50-
struct wrap
51-
{
52-
wrap(T const& v) :
53-
value(v)
54-
{
55-
}
56-
T value;
57-
58-
};
59-
60-
template <typename T>
61-
exception_ptr make_exception_ptr(T v)
62-
{
63-
return copy_exception(wrap<T> (v));
64-
}
6549
}
6650

6751
void func1(boost::promise<int> p)

test/sync/futures/future/wait_until_pass.cpp

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -49,22 +49,6 @@ namespace boost
4949
os << underlying_cast<int>(st) << " ";
5050
return os;
5151
}
52-
template <typename T>
53-
struct wrap
54-
{
55-
wrap(T const& v) :
56-
value(v)
57-
{
58-
}
59-
T value;
60-
61-
};
62-
63-
template <typename T>
64-
exception_ptr make_exception_ptr(T v)
65-
{
66-
return copy_exception(wrap<T> (v));
67-
}
6852
}
6953

7054
void func1(boost::promise<int> p)

test/sync/futures/promise/set_exception_at_thread_exit_pass.cpp

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@
2424
#include <boost/detail/lightweight_test.hpp>
2525
#include <boost/static_assert.hpp>
2626

27-
namespace boost
28-
{
2927
template <typename T>
3028
struct wrap
3129
{
@@ -38,11 +36,10 @@ namespace boost
3836
};
3937

4038
template <typename T>
41-
exception_ptr make_exception_ptr(T v)
39+
boost::exception_ptr make_exception_ptr(T v)
4240
{
43-
return copy_exception(wrap<T> (v));
41+
return boost::copy_exception(wrap<T> (v));
4442
}
45-
}
4643

4744
#if defined BOOST_THREAD_PROVIDES_SIGNATURE_PACKAGED_TASK && defined(BOOST_THREAD_PROVIDES_VARIADIC_THREAD)
4845
void func(boost::promise<int> p)
@@ -51,8 +48,8 @@ boost::promise<int> p;
5148
void func()
5249
#endif
5350
{
54-
//p.set_exception(boost::make_exception_ptr(3));
55-
p.set_exception_at_thread_exit(boost::make_exception_ptr(3));
51+
//p.set_exception(::make_exception_ptr(3));
52+
p.set_exception_at_thread_exit(::make_exception_ptr(3));
5653
}
5754

5855
int main()
@@ -72,7 +69,7 @@ int main()
7269
f.get();
7370
BOOST_TEST(false);
7471
}
75-
catch (boost::wrap<int> i)
72+
catch (::wrap<int> i)
7673
{
7774
BOOST_TEST(i.value == 3);
7875
}
@@ -96,7 +93,7 @@ int main()
9693
f.get();
9794
BOOST_TEST(false);
9895
}
99-
catch (boost::wrap<int> i)
96+
catch (::wrap<int> i)
10097
{
10198
BOOST_TEST(i.value == 3);
10299
}

test/sync/futures/promise/set_exception_pass.cpp

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@
2424
#include <boost/detail/lightweight_test.hpp>
2525
#include <boost/static_assert.hpp>
2626

27-
namespace boost
28-
{
2927
template <typename T>
3028
struct wrap
3129
{
@@ -38,11 +36,10 @@ namespace boost
3836
};
3937

4038
template <typename T>
41-
exception_ptr make_exception_ptr(T v)
39+
boost::exception_ptr make_exception_ptr(T v)
4240
{
43-
return copy_exception(wrap<T> (v));
41+
return boost::copy_exception(wrap<T> (v));
4442
}
45-
}
4643

4744
int main()
4845
{
@@ -51,19 +48,19 @@ int main()
5148
typedef int T;
5249
boost::promise<T> p;
5350
boost::future<T> f = p.get_future();
54-
p.set_exception(boost::make_exception_ptr(3));
51+
p.set_exception(::make_exception_ptr(3));
5552
try
5653
{
5754
f.get();
5855
BOOST_TEST(false);
5956
}
60-
catch (boost::wrap<int> i)
57+
catch (::wrap<int> i)
6158
{
6259
BOOST_TEST(i.value == 3);
6360
}
6461
try
6562
{
66-
p.set_exception(boost::make_exception_ptr(3));
63+
p.set_exception(::make_exception_ptr(3));
6764
BOOST_TEST(false);
6865
}
6966
catch (const boost::future_error& e)
@@ -79,21 +76,21 @@ int main()
7976
typedef int T;
8077
boost::promise<T> p;
8178
boost::future<T> f = p.get_future();
82-
p.set_exception_deferred(boost::make_exception_ptr(3));
79+
p.set_exception_deferred(::make_exception_ptr(3));
8380
BOOST_TEST(!f.is_ready());
8481
p.notify_deferred();
8582
try
8683
{
8784
f.get();
8885
BOOST_TEST(false);
8986
}
90-
catch (boost::wrap<int> i)
87+
catch (::wrap<int> i)
9188
{
9289
BOOST_TEST(i.value == 3);
9390
}
9491
try
9592
{
96-
p.set_exception(boost::make_exception_ptr(3));
93+
p.set_exception(::make_exception_ptr(3));
9794
BOOST_TEST(false);
9895
}
9996
catch (const boost::future_error& e)

0 commit comments

Comments
 (0)