mirror of
https://github.com/ceph/ceph
synced 2025-04-01 00:26:47 +00:00
crimson: fix non-standard C++ constructs in errorator.h
Fixing use patterns accepted by gcc, but frowned upon by Clang: Put noexcept specifier after attributes specifiers (as per the C++ standard $11.3.5) Limit the use of a not-completely-defined class names to within function bodies, per the standard ("A class is considered a completely-defined object type (or complete type) at the closing } of the class-specifier. Within the class member-specification, the class is regarded as complete within function bodies, default arguments, noexcept-specifiers, and default member initializers (including such things in nested classes). Otherwise it is regarded as incomplete within its own class member-specification.") Signed-off-by: Ronen Friedman <rfriedma@redhat.com>
This commit is contained in:
parent
12aafcd769
commit
f81054d5ce
@ -79,8 +79,8 @@ public:
|
|||||||
template <class ErrorT, ErrorT ErrorV>
|
template <class ErrorT, ErrorT ErrorV>
|
||||||
struct unthrowable_wrapper : error_t<unthrowable_wrapper<ErrorT, ErrorV>> {
|
struct unthrowable_wrapper : error_t<unthrowable_wrapper<ErrorT, ErrorV>> {
|
||||||
unthrowable_wrapper(const unthrowable_wrapper&) = delete;
|
unthrowable_wrapper(const unthrowable_wrapper&) = delete;
|
||||||
static const unthrowable_wrapper instance;
|
|
||||||
[[nodiscard]] static const auto& make() {
|
[[nodiscard]] static const auto& make() {
|
||||||
|
static constexpr unthrowable_wrapper instance{};
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -118,13 +118,11 @@ private:
|
|||||||
return carrier_instance;
|
return carrier_instance;
|
||||||
}
|
}
|
||||||
static const auto& from_exception_ptr(std::exception_ptr) {
|
static const auto& from_exception_ptr(std::exception_ptr) {
|
||||||
return instance;
|
return make();
|
||||||
}
|
}
|
||||||
|
|
||||||
friend class error_t<unthrowable_wrapper<ErrorT, ErrorV>>;
|
friend class error_t<unthrowable_wrapper<ErrorT, ErrorV>>;
|
||||||
};
|
};
|
||||||
template <class ErrorT, ErrorT ErrorV>
|
|
||||||
const inline unthrowable_wrapper<ErrorT, ErrorV> unthrowable_wrapper<ErrorT, ErrorV>::instance{};
|
|
||||||
|
|
||||||
template <class ErrorT, ErrorT ErrorV>
|
template <class ErrorT, ErrorT ErrorV>
|
||||||
std::exception_ptr unthrowable_wrapper<ErrorT, ErrorV>::carrier_instance = \
|
std::exception_ptr unthrowable_wrapper<ErrorT, ErrorV>::carrier_instance = \
|
||||||
@ -481,7 +479,7 @@ private:
|
|||||||
return this->then_wrapped(
|
return this->then_wrapped(
|
||||||
[ valfunc = std::forward<ValueFuncT>(valfunc),
|
[ valfunc = std::forward<ValueFuncT>(valfunc),
|
||||||
errfunc = std::forward<ErrorVisitorT>(errfunc)
|
errfunc = std::forward<ErrorVisitorT>(errfunc)
|
||||||
] (auto&& future) mutable [[gnu::always_inline]] noexcept {
|
] (auto&& future) mutable noexcept [[gnu::always_inline]] {
|
||||||
if (__builtin_expect(future.failed(), false)) {
|
if (__builtin_expect(future.failed(), false)) {
|
||||||
return _safe_then_handle_errors<futurator_t>(
|
return _safe_then_handle_errors<futurator_t>(
|
||||||
std::move(future), std::forward<ErrorVisitorT>(errfunc));
|
std::move(future), std::forward<ErrorVisitorT>(errfunc));
|
||||||
@ -530,7 +528,7 @@ private:
|
|||||||
|
|
||||||
return this->then_wrapped(
|
return this->then_wrapped(
|
||||||
[ func = std::forward<FuncT>(func)
|
[ func = std::forward<FuncT>(func)
|
||||||
] (auto&& future) mutable [[gnu::always_inline]] noexcept {
|
] (auto&& future) mutable noexcept [[gnu::always_inline]] {
|
||||||
return futurator_t::apply(std::forward<FuncT>(func)).safe_then(
|
return futurator_t::apply(std::forward<FuncT>(func)).safe_then(
|
||||||
[future = std::forward<decltype(future)>(future)]() mutable {
|
[future = std::forward<decltype(future)>(future)]() mutable {
|
||||||
return std::move(future);
|
return std::move(future);
|
||||||
@ -574,7 +572,7 @@ private:
|
|||||||
typename return_errorator_t::template futurize<::seastar::future<ValuesT...>>;
|
typename return_errorator_t::template futurize<::seastar::future<ValuesT...>>;
|
||||||
return this->then_wrapped(
|
return this->then_wrapped(
|
||||||
[ errfunc = std::forward<ErrorVisitorT>(errfunc)
|
[ errfunc = std::forward<ErrorVisitorT>(errfunc)
|
||||||
] (auto&& future) mutable [[gnu::always_inline]] noexcept {
|
] (auto&& future) mutable noexcept [[gnu::always_inline]] {
|
||||||
if (__builtin_expect(future.failed(), false)) {
|
if (__builtin_expect(future.failed(), false)) {
|
||||||
return _safe_then_handle_errors<futurator_t>(
|
return _safe_then_handle_errors<futurator_t>(
|
||||||
std::move(future), std::forward<ErrorVisitorT>(errfunc));
|
std::move(future), std::forward<ErrorVisitorT>(errfunc));
|
||||||
|
Loading…
Reference in New Issue
Block a user