Skip to content

Commit 2d6c0e7

Browse files
committedOct 2, 2015
[libcxx] Attempt to fix __throw_future_error in C++03
Summary: Hi Marshall, Could you please test this patch and see if you run into the same linker errors we talked about? I can't reproduce on linux or OS X. Hopefully you can't find any problems and we can fix the C++03 bot. Reviewers: mclow.lists Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D13337 llvm-svn: 249192
1 parent 06e338b commit 2d6c0e7

File tree

1 file changed

+30
-31
lines changed

1 file changed

+30
-31
lines changed
 

‎libcxx/include/future

+30-31
Original file line numberDiff line numberDiff line change
@@ -512,9 +512,8 @@ public:
512512
virtual ~future_error() _NOEXCEPT;
513513
};
514514

515-
template <future_errc _Ev>
516-
_LIBCPP_ALWAYS_INLINE
517-
void __throw_future_error()
515+
inline _LIBCPP_ALWAYS_INLINE
516+
void __throw_future_error(future_errc _Ev)
518517
{
519518
#ifndef _LIBCPP_NO_EXCEPTIONS
520519
throw future_error(make_error_code(_Ev));
@@ -657,7 +656,7 @@ __assoc_state<_Rp>::set_value(_Arg& __arg)
657656
{
658657
unique_lock<mutex> __lk(this->__mut_);
659658
if (this->__has_value())
660-
__throw_future_error<future_errc::promise_already_satisfied>();
659+
__throw_future_error(future_errc::promise_already_satisfied);
661660
::new(&__value_) _Rp(_VSTD::forward<_Arg>(__arg));
662661
this->__state_ |= base::__constructed | base::ready;
663662
__cv_.notify_all();
@@ -674,7 +673,7 @@ __assoc_state<_Rp>::set_value_at_thread_exit(_Arg& __arg)
674673
{
675674
unique_lock<mutex> __lk(this->__mut_);
676675
if (this->__has_value())
677-
__throw_future_error<future_errc::promise_already_satisfied>();
676+
__throw_future_error(future_errc::promise_already_satisfied);
678677
::new(&__value_) _Rp(_VSTD::forward<_Arg>(__arg));
679678
this->__state_ |= base::__constructed;
680679
__thread_local_data()->__make_ready_at_thread_exit(this);
@@ -733,7 +732,7 @@ __assoc_state<_Rp&>::set_value(_Rp& __arg)
733732
{
734733
unique_lock<mutex> __lk(this->__mut_);
735734
if (this->__has_value())
736-
__throw_future_error<future_errc::promise_already_satisfied>();
735+
__throw_future_error(future_errc::promise_already_satisfied);
737736
__value_ = _VSTD::addressof(__arg);
738737
this->__state_ |= base::__constructed | base::ready;
739738
__cv_.notify_all();
@@ -745,7 +744,7 @@ __assoc_state<_Rp&>::set_value_at_thread_exit(_Rp& __arg)
745744
{
746745
unique_lock<mutex> __lk(this->__mut_);
747746
if (this->__has_value())
748-
__throw_future_error<future_errc::promise_already_satisfied>();
747+
__throw_future_error(future_errc::promise_already_satisfied);
749748
__value_ = _VSTD::addressof(__arg);
750749
this->__state_ |= base::__constructed;
751750
__thread_local_data()->__make_ready_at_thread_exit(this);
@@ -1142,7 +1141,7 @@ future<_Rp>::future(__assoc_state<_Rp>* __state)
11421141
: __state_(__state)
11431142
{
11441143
if (__state_->__has_future_attached())
1145-
__throw_future_error<future_errc::future_already_retrieved>();
1144+
__throw_future_error(future_errc::future_already_retrieved);
11461145
__state_->__add_shared();
11471146
__state_->__set_future_attached();
11481147
}
@@ -1244,7 +1243,7 @@ future<_Rp&>::future(__assoc_state<_Rp&>* __state)
12441243
: __state_(__state)
12451244
{
12461245
if (__state_->__has_future_attached())
1247-
__throw_future_error<future_errc::future_already_retrieved>();
1246+
__throw_future_error(future_errc::future_already_retrieved);
12481247
__state_->__add_shared();
12491248
__state_->__set_future_attached();
12501249
}
@@ -1445,7 +1444,7 @@ future<_Rp>
14451444
promise<_Rp>::get_future()
14461445
{
14471446
if (__state_ == nullptr)
1448-
__throw_future_error<future_errc::no_state>();
1447+
__throw_future_error(future_errc::no_state);
14491448
return future<_Rp>(__state_);
14501449
}
14511450

@@ -1454,7 +1453,7 @@ void
14541453
promise<_Rp>::set_value(const _Rp& __r)
14551454
{
14561455
if (__state_ == nullptr)
1457-
__throw_future_error<future_errc::no_state>();
1456+
__throw_future_error(future_errc::no_state);
14581457
__state_->set_value(__r);
14591458
}
14601459

@@ -1465,7 +1464,7 @@ void
14651464
promise<_Rp>::set_value(_Rp&& __r)
14661465
{
14671466
if (__state_ == nullptr)
1468-
__throw_future_error<future_errc::no_state>();
1467+
__throw_future_error(future_errc::no_state);
14691468
__state_->set_value(_VSTD::move(__r));
14701469
}
14711470

@@ -1476,7 +1475,7 @@ void
14761475
promise<_Rp>::set_exception(exception_ptr __p)
14771476
{
14781477
if (__state_ == nullptr)
1479-
__throw_future_error<future_errc::no_state>();
1478+
__throw_future_error(future_errc::no_state);
14801479
__state_->set_exception(__p);
14811480
}
14821481

@@ -1485,7 +1484,7 @@ void
14851484
promise<_Rp>::set_value_at_thread_exit(const _Rp& __r)
14861485
{
14871486
if (__state_ == nullptr)
1488-
__throw_future_error<future_errc::no_state>();
1487+
__throw_future_error(future_errc::no_state);
14891488
__state_->set_value_at_thread_exit(__r);
14901489
}
14911490

@@ -1496,7 +1495,7 @@ void
14961495
promise<_Rp>::set_value_at_thread_exit(_Rp&& __r)
14971496
{
14981497
if (__state_ == nullptr)
1499-
__throw_future_error<future_errc::no_state>();
1498+
__throw_future_error(future_errc::no_state);
15001499
__state_->set_value_at_thread_exit(_VSTD::move(__r));
15011500
}
15021501

@@ -1507,7 +1506,7 @@ void
15071506
promise<_Rp>::set_exception_at_thread_exit(exception_ptr __p)
15081507
{
15091508
if (__state_ == nullptr)
1510-
__throw_future_error<future_errc::no_state>();
1509+
__throw_future_error(future_errc::no_state);
15111510
__state_->set_exception_at_thread_exit(__p);
15121511
}
15131512

@@ -1605,7 +1604,7 @@ future<_Rp&>
16051604
promise<_Rp&>::get_future()
16061605
{
16071606
if (__state_ == nullptr)
1608-
__throw_future_error<future_errc::no_state>();
1607+
__throw_future_error(future_errc::no_state);
16091608
return future<_Rp&>(__state_);
16101609
}
16111610

@@ -1614,7 +1613,7 @@ void
16141613
promise<_Rp&>::set_value(_Rp& __r)
16151614
{
16161615
if (__state_ == nullptr)
1617-
__throw_future_error<future_errc::no_state>();
1616+
__throw_future_error(future_errc::no_state);
16181617
__state_->set_value(__r);
16191618
}
16201619

@@ -1623,7 +1622,7 @@ void
16231622
promise<_Rp&>::set_exception(exception_ptr __p)
16241623
{
16251624
if (__state_ == nullptr)
1626-
__throw_future_error<future_errc::no_state>();
1625+
__throw_future_error(future_errc::no_state);
16271626
__state_->set_exception(__p);
16281627
}
16291628

@@ -1632,7 +1631,7 @@ void
16321631
promise<_Rp&>::set_value_at_thread_exit(_Rp& __r)
16331632
{
16341633
if (__state_ == nullptr)
1635-
__throw_future_error<future_errc::no_state>();
1634+
__throw_future_error(future_errc::no_state);
16361635
__state_->set_value_at_thread_exit(__r);
16371636
}
16381637

@@ -1641,7 +1640,7 @@ void
16411640
promise<_Rp&>::set_exception_at_thread_exit(exception_ptr __p)
16421641
{
16431642
if (__state_ == nullptr)
1644-
__throw_future_error<future_errc::no_state>();
1643+
__throw_future_error(future_errc::no_state);
16451644
__state_->set_exception_at_thread_exit(__p);
16461645
}
16471646

@@ -2063,9 +2062,9 @@ void
20632062
packaged_task<_Rp(_ArgTypes...)>::operator()(_ArgTypes... __args)
20642063
{
20652064
if (__p_.__state_ == nullptr)
2066-
__throw_future_error<future_errc::no_state>();
2065+
__throw_future_error(future_errc::no_state);
20672066
if (__p_.__state_->__has_value())
2068-
__throw_future_error<future_errc::promise_already_satisfied>();
2067+
__throw_future_error(future_errc::promise_already_satisfied);
20692068
#ifndef _LIBCPP_NO_EXCEPTIONS
20702069
try
20712070
{
@@ -2085,9 +2084,9 @@ void
20852084
packaged_task<_Rp(_ArgTypes...)>::make_ready_at_thread_exit(_ArgTypes... __args)
20862085
{
20872086
if (__p_.__state_ == nullptr)
2088-
__throw_future_error<future_errc::no_state>();
2087+
__throw_future_error(future_errc::no_state);
20892088
if (__p_.__state_->__has_value())
2090-
__throw_future_error<future_errc::promise_already_satisfied>();
2089+
__throw_future_error(future_errc::promise_already_satisfied);
20912090
#ifndef _LIBCPP_NO_EXCEPTIONS
20922091
try
20932092
{
@@ -2107,7 +2106,7 @@ void
21072106
packaged_task<_Rp(_ArgTypes...)>::reset()
21082107
{
21092108
if (!valid())
2110-
__throw_future_error<future_errc::no_state>();
2109+
__throw_future_error(future_errc::no_state);
21112110
__p_ = promise<result_type>();
21122111
}
21132112

@@ -2192,9 +2191,9 @@ void
21922191
packaged_task<void(_ArgTypes...)>::operator()(_ArgTypes... __args)
21932192
{
21942193
if (__p_.__state_ == nullptr)
2195-
__throw_future_error<future_errc::no_state>();
2194+
__throw_future_error(future_errc::no_state);
21962195
if (__p_.__state_->__has_value())
2197-
__throw_future_error<future_errc::promise_already_satisfied>();
2196+
__throw_future_error(future_errc::promise_already_satisfied);
21982197
#ifndef _LIBCPP_NO_EXCEPTIONS
21992198
try
22002199
{
@@ -2215,9 +2214,9 @@ void
22152214
packaged_task<void(_ArgTypes...)>::make_ready_at_thread_exit(_ArgTypes... __args)
22162215
{
22172216
if (__p_.__state_ == nullptr)
2218-
__throw_future_error<future_errc::no_state>();
2217+
__throw_future_error(future_errc::no_state);
22192218
if (__p_.__state_->__has_value())
2220-
__throw_future_error<future_errc::promise_already_satisfied>();
2219+
__throw_future_error(future_errc::promise_already_satisfied);
22212220
#ifndef _LIBCPP_NO_EXCEPTIONS
22222221
try
22232222
{
@@ -2238,7 +2237,7 @@ void
22382237
packaged_task<void(_ArgTypes...)>::reset()
22392238
{
22402239
if (!valid())
2241-
__throw_future_error<future_errc::no_state>();
2240+
__throw_future_error(future_errc::no_state);
22422241
__p_ = promise<result_type>();
22432242
}
22442243

0 commit comments

Comments
 (0)
Please sign in to comment.