mirror of
https://github.com/Naios/continuable.git
synced 2025-12-06 16:56:44 +08:00
Rename CONTINUABLE_WITH_EXCEPTIONS -> CONTINUABLE_HAS_EXCEPTIONS
* Since this is automatically defined
This commit is contained in:
parent
88aebb422b
commit
09f9da3e0e
@ -44,9 +44,9 @@
|
|||||||
#include <continuable/detail/types.hpp>
|
#include <continuable/detail/types.hpp>
|
||||||
#include <continuable/detail/util.hpp>
|
#include <continuable/detail/util.hpp>
|
||||||
|
|
||||||
#if defined(CONTINUABLE_WITH_EXCEPTIONS)
|
#if defined(CONTINUABLE_HAS_EXCEPTIONS)
|
||||||
#include <exception>
|
#include <exception>
|
||||||
#endif // CONTINUABLE_WITH_EXCEPTIONS
|
#endif // CONTINUABLE_HAS_EXCEPTIONS
|
||||||
|
|
||||||
namespace cti {
|
namespace cti {
|
||||||
namespace detail {
|
namespace detail {
|
||||||
@ -96,12 +96,12 @@ public:
|
|||||||
return trait_t::unwrap(std::move(result_));
|
return trait_t::unwrap(std::move(result_));
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(CONTINUABLE_WITH_EXCEPTIONS)
|
#if defined(CONTINUABLE_HAS_EXCEPTIONS)
|
||||||
std::rethrow_exception(result_.get_exception());
|
std::rethrow_exception(result_.get_exception());
|
||||||
#else // CONTINUABLE_WITH_EXCEPTIONS
|
#else // CONTINUABLE_HAS_EXCEPTIONS
|
||||||
// Returning error types in await isn't supported as of now
|
// Returning error types in await isn't supported as of now
|
||||||
util::trap();
|
util::trap();
|
||||||
#endif // CONTINUABLE_WITH_EXCEPTIONS
|
#endif // CONTINUABLE_HAS_EXCEPTIONS
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@ -41,9 +41,9 @@
|
|||||||
#include <continuable/detail/types.hpp>
|
#include <continuable/detail/types.hpp>
|
||||||
#include <continuable/detail/util.hpp>
|
#include <continuable/detail/util.hpp>
|
||||||
|
|
||||||
#if defined(CONTINUABLE_WITH_EXCEPTIONS)
|
#if defined(CONTINUABLE_HAS_EXCEPTIONS)
|
||||||
#include <exception>
|
#include <exception>
|
||||||
#endif // CONTINUABLE_WITH_EXCEPTIONS
|
#endif // CONTINUABLE_HAS_EXCEPTIONS
|
||||||
|
|
||||||
namespace cti {
|
namespace cti {
|
||||||
namespace detail {
|
namespace detail {
|
||||||
@ -135,7 +135,7 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#if defined(CONTINUABLE_WITH_EXCEPTIONS)
|
#if defined(CONTINUABLE_HAS_EXCEPTIONS)
|
||||||
#define CONTINUABLE_BLOCK_TRY_BEGIN try {
|
#define CONTINUABLE_BLOCK_TRY_BEGIN try {
|
||||||
#define CONTINUABLE_BLOCK_TRY_END \
|
#define CONTINUABLE_BLOCK_TRY_END \
|
||||||
} \
|
} \
|
||||||
@ -144,10 +144,10 @@ public:
|
|||||||
types::dispatch_error_tag{}, std::current_exception()); \
|
types::dispatch_error_tag{}, std::current_exception()); \
|
||||||
}
|
}
|
||||||
|
|
||||||
#else // CONTINUABLE_WITH_EXCEPTIONS
|
#else // CONTINUABLE_HAS_EXCEPTIONS
|
||||||
#define CONTINUABLE_BLOCK_TRY_BEGIN {
|
#define CONTINUABLE_BLOCK_TRY_BEGIN {
|
||||||
#define CONTINUABLE_BLOCK_TRY_END }
|
#define CONTINUABLE_BLOCK_TRY_END }
|
||||||
#endif // CONTINUABLE_WITH_EXCEPTIONS
|
#endif // CONTINUABLE_HAS_EXCEPTIONS
|
||||||
|
|
||||||
/// Invokes the given callable object with the given arguments while
|
/// Invokes the given callable object with the given arguments while
|
||||||
/// marking the operation as non exceptional.
|
/// marking the operation as non exceptional.
|
||||||
|
|||||||
@ -82,12 +82,12 @@
|
|||||||
#define CONTINUABLE_HAS_EXPERIMENTAL_COROUTINE
|
#define CONTINUABLE_HAS_EXPERIMENTAL_COROUTINE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/// Define CONTINUABLE_WITH_EXCEPTIONS when exceptions are used
|
/// Define CONTINUABLE_HAS_EXCEPTIONS when exceptions are used
|
||||||
#if !defined(CONTINUABLE_WITH_CUSTOM_ERROR_TYPE) && \
|
#if !defined(CONTINUABLE_WITH_CUSTOM_ERROR_TYPE) && \
|
||||||
!defined(CONTINUABLE_WITH_NO_EXCEPTIONS)
|
!defined(CONTINUABLE_WITH_NO_EXCEPTIONS)
|
||||||
#define CONTINUABLE_WITH_EXCEPTIONS 1
|
#define CONTINUABLE_HAS_EXCEPTIONS 1
|
||||||
#else
|
#else
|
||||||
#undef CONTINUABLE_WITH_EXCEPTIONS
|
#undef CONTINUABLE_HAS_EXCEPTIONS
|
||||||
#endif
|
#endif
|
||||||
// clang-format on
|
// clang-format on
|
||||||
|
|
||||||
|
|||||||
@ -149,7 +149,7 @@ void assert_async_binary_exception_validation(V&& validator, C&& continuable,
|
|||||||
ASSERT_FALSE(*called);
|
ASSERT_FALSE(*called);
|
||||||
*called = true;
|
*called = true;
|
||||||
|
|
||||||
#if defined(CONTINUABLE_WITH_EXCEPTIONS)
|
#if defined(CONTINUABLE_HAS_EXCEPTIONS)
|
||||||
try {
|
try {
|
||||||
std::rethrow_exception(error);
|
std::rethrow_exception(error);
|
||||||
} catch (std::decay_t<decltype(expected)>& exception) {
|
} catch (std::decay_t<decltype(expected)>& exception) {
|
||||||
|
|||||||
@ -96,7 +96,7 @@ public:
|
|||||||
|
|
||||||
/// Resolves the promise through the exception
|
/// Resolves the promise through the exception
|
||||||
void operator()(types::dispatch_error_tag, types::error_type error) {
|
void operator()(types::dispatch_error_tag, types::error_type error) {
|
||||||
#if defined(CONTINUABLE_WITH_EXCEPTIONS)
|
#if defined(CONTINUABLE_HAS_EXCEPTIONS)
|
||||||
promise_.set_exception(error);
|
promise_.set_exception(error);
|
||||||
#else
|
#else
|
||||||
(void)error;
|
(void)error;
|
||||||
@ -105,7 +105,7 @@ public:
|
|||||||
// to a std::promise. Handle the error first in order
|
// to a std::promise. Handle the error first in order
|
||||||
// to prevent this trap!
|
// to prevent this trap!
|
||||||
util::trap();
|
util::trap();
|
||||||
#endif // CONTINUABLE_WITH_EXCEPTIONS
|
#endif // CONTINUABLE_HAS_EXCEPTIONS
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns the future from the promise
|
/// Returns the future from the promise
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user