[ox/std] Add an unlikely label to ox{Return,Throw}Error for C++20 builds
This commit is contained in:
parent
c82b72d8aa
commit
57ad13fc4a
5
deps/ox/src/ox/std/error.hpp
vendored
5
deps/ox/src/ox/std/error.hpp
vendored
@ -104,6 +104,11 @@ constexpr Error toError(const Result<T> &ve) noexcept {
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline void oxIgnoreError(ox::Error) noexcept {}
|
inline void oxIgnoreError(ox::Error) noexcept {}
|
||||||
|
#if __cplusplus >= 202002L
|
||||||
|
#define oxReturnError(x) if (const auto _ox_error = ox::detail::toError(x)) [[unlikely]] return _ox_error
|
||||||
|
#define oxThrowError(x) if (const auto _ox_error = ox::detail::toError(x)) [[unlikely]] throw _ox_error
|
||||||
|
#else
|
||||||
#define oxReturnError(x) if (const auto _ox_error = ox::detail::toError(x)) return _ox_error
|
#define oxReturnError(x) if (const auto _ox_error = ox::detail::toError(x)) return _ox_error
|
||||||
#define oxThrowError(x) if (const auto _ox_error = ox::detail::toError(x)) throw _ox_error
|
#define oxThrowError(x) if (const auto _ox_error = ox::detail::toError(x)) throw _ox_error
|
||||||
|
#endif
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user