Browse Source

兼容clang 8.0,简单的测试范例通过

tags/v2.9.7
tearshark 4 years ago
parent
commit
03579c95fa
4 changed files with 16 additions and 0 deletions
  1. 2
    0
      librf/src/def.h
  2. 3
    0
      librf/src/promise.h
  3. 8
    0
      librf/src/promise.inl
  4. 3
    0
      librf/src/scheduler.cpp

+ 2
- 0
librf/src/def.h View File

@@ -9,8 +9,10 @@
#include <deque>
#include <mutex>
#include <map>
#include <list>
#include <unordered_map>
#include <optional>
#include <thread>
#include <assert.h>

+ 3
- 0
librf/src/promise.h View File

@@ -26,6 +26,9 @@ namespace resumef
suspend_on_initial initial_suspend() noexcept;
suspend_on_final final_suspend() noexcept;
void set_exception(std::exception_ptr e);
#ifdef __clang__
void unhandled_exception();
#endif
future_type get_return_object();
void cancellation_requested();
};

+ 8
- 0
librf/src/promise.inl View File

@@ -60,6 +60,14 @@ namespace resumef
_state->set_exception(std::move(e));
}

#ifdef __clang__
template <typename _Ty>
inline void promise_impl_t<_Ty>::unhandled_exception()
{
std::terminate();
}
#endif

template <typename _Ty>
inline future_t<_Ty> promise_impl_t<_Ty>::get_return_object()
{

+ 3
- 0
librf/src/scheduler.cpp View File

@@ -27,6 +27,9 @@ namespace resumef
{
if (classname)
{
#if __clang__
#define sprintf_s sprintf
#endif
sprintf_s(sz_future_error_buffer, "%s, code=%s", classname, future_error_string[(size_t)(fe)]);
return sz_future_error_buffer;
}

Loading…
Cancel
Save