aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp
diff options
context:
space:
mode:
authorarcadia-devtools <arcadia-devtools@yandex-team.ru>2022-04-02 01:14:13 +0300
committerarcadia-devtools <arcadia-devtools@yandex-team.ru>2022-04-02 01:14:13 +0300
commit6754a6a379c0522676071b52818018c46b0a8e58 (patch)
tree7106cb31d3cd22eb6a7bb4bbde47ae23cd9f4027 /library/cpp
parent24e1d4fe6d126ac368719f6a98bb4192739adb05 (diff)
downloadydb-6754a6a379c0522676071b52818018c46b0a8e58.tar.gz
intermediate changes
ref:4f6264c5be27540a15fdefdc0e4084f35b9f7f44
Diffstat (limited to 'library/cpp')
-rw-r--r--library/cpp/ipv6_address/ipv6_address.cpp5
-rw-r--r--library/cpp/ipv6_address/ipv6_address.h1
-rw-r--r--library/cpp/threading/future/core/future-inl.h30
-rw-r--r--library/cpp/threading/future/core/future.cpp6
4 files changed, 28 insertions, 14 deletions
diff --git a/library/cpp/ipv6_address/ipv6_address.cpp b/library/cpp/ipv6_address/ipv6_address.cpp
index be8fcbae13..b23534b74f 100644
--- a/library/cpp/ipv6_address/ipv6_address.cpp
+++ b/library/cpp/ipv6_address/ipv6_address.cpp
@@ -110,6 +110,11 @@ TIpv6Address TIpv6Address::FromString(TStringBuf str, bool& ok) noexcept {
}
}
+TIpv6Address TIpv6Address::FromString(TStringBuf str) noexcept {
+ bool ok = false;
+ return TIpv6Address::FromString(str, ok);
+}
+
TString TIpv6Address::ToString(bool* ok) const noexcept {
return ToString(true, ok);
}
diff --git a/library/cpp/ipv6_address/ipv6_address.h b/library/cpp/ipv6_address/ipv6_address.h
index 1d7eb0b65f..a6ca43a843 100644
--- a/library/cpp/ipv6_address/ipv6_address.h
+++ b/library/cpp/ipv6_address/ipv6_address.h
@@ -61,6 +61,7 @@ public:
explicit TIpv6Address(const in_addr& addr);
static TIpv6Address FromString(TStringBuf srcStr, bool& ok) noexcept;
+ static TIpv6Address FromString(TStringBuf str) noexcept;
constexpr bool IsNull() const noexcept {
return Ip == 0;
diff --git a/library/cpp/threading/future/core/future-inl.h b/library/cpp/threading/future/core/future-inl.h
index 5fd4296a93..d04fd54e29 100644
--- a/library/cpp/threading/future/core/future-inl.h
+++ b/library/cpp/threading/future/core/future-inl.h
@@ -16,6 +16,8 @@ namespace NThreading {
////////////////////////////////////////////////////////////////////////////////
+ [[noreturn]] void ThrowFutureException(TStringBuf message, const TSourceLocation& source);
+
enum class TError {
Error
};
@@ -48,11 +50,11 @@ namespace NThreading {
int state = AtomicGet(State);
if (Y_UNLIKELY(state == NotReady)) {
if (timeout == TDuration::Zero()) {
- ythrow TFutureException() << "value not set";
+ ::NThreading::NImpl::ThrowFutureException("value not set"sv, __LOCATION__);
}
if (!Wait(timeout)) {
- ythrow TFutureException() << "wait timeout";
+ ::NThreading::NImpl::ThrowFutureException("wait timeout"sv, __LOCATION__);
}
state = AtomicGet(State);
@@ -65,11 +67,11 @@ namespace NThreading {
break;
case ValueRead:
if (acquireState != ValueRead) {
- ythrow TFutureException() << "value being read";
+ ::NThreading::NImpl::ThrowFutureException("value being read"sv, __LOCATION__);
}
break;
case ValueMoved:
- ythrow TFutureException() << "value was moved";
+ ::NThreading::NImpl::ThrowFutureException("value was moved"sv, __LOCATION__);
default:
Y_ASSERT(state == ValueSet);
}
@@ -129,7 +131,7 @@ namespace NThreading {
void SetValue(TT&& value) {
bool success = TrySetValue(std::forward<TT>(value));
if (Y_UNLIKELY(!success)) {
- ythrow TFutureException() << "value already set";
+ ::NThreading::NImpl::ThrowFutureException("value already set"sv, __LOCATION__);
}
}
@@ -169,7 +171,7 @@ namespace NThreading {
void SetException(std::exception_ptr e) {
bool success = TrySetException(std::move(e));
if (Y_UNLIKELY(!success)) {
- ythrow TFutureException() << "value already set";
+ ::NThreading::NImpl::ThrowFutureException("value already set"sv, __LOCATION__);
}
}
@@ -300,11 +302,11 @@ namespace NThreading {
int state = AtomicGet(State);
if (Y_UNLIKELY(state == NotReady)) {
if (timeout == TDuration::Zero()) {
- ythrow TFutureException() << "value not set";
+ ::NThreading::NImpl::ThrowFutureException("value not set"sv, __LOCATION__);
}
if (!Wait(timeout)) {
- ythrow TFutureException() << "wait timeout";
+ ::NThreading::NImpl::ThrowFutureException("wait timeout"sv, __LOCATION__);
}
state = AtomicGet(State);
@@ -318,7 +320,7 @@ namespace NThreading {
void SetValue() {
bool success = TrySetValue();
if (Y_UNLIKELY(!success)) {
- ythrow TFutureException() << "value already set";
+ ::NThreading::NImpl::ThrowFutureException("value already set"sv, __LOCATION__);
}
}
@@ -355,7 +357,7 @@ namespace NThreading {
void SetException(std::exception_ptr e) {
bool success = TrySetException(std::move(e));
if (Y_UNLIKELY(!success)) {
- ythrow TFutureException() << "value already set";
+ ::NThreading::NImpl::ThrowFutureException("value already set"sv, __LOCATION__);
}
}
@@ -649,7 +651,7 @@ namespace NThreading {
template <typename T>
inline void TFuture<T>::EnsureInitialized() const {
if (!State) {
- ythrow TFutureException() << "state not initialized";
+ ::NThreading::NImpl::ThrowFutureException("state not initialized"sv, __LOCATION__);
}
}
@@ -751,7 +753,7 @@ namespace NThreading {
inline void TFuture<void>::EnsureInitialized() const {
if (!State) {
- ythrow TFutureException() << "state not initialized";
+ ::NThreading::NImpl::ThrowFutureException("state not initialized"sv, __LOCATION__);
}
}
@@ -858,7 +860,7 @@ namespace NThreading {
template <typename T>
inline void TPromise<T>::EnsureInitialized() const {
if (!State) {
- ythrow TFutureException() << "state not initialized";
+ ::NThreading::NImpl::ThrowFutureException("state not initialized"sv, __LOCATION__);
}
}
@@ -932,7 +934,7 @@ namespace NThreading {
inline void TPromise<void>::EnsureInitialized() const {
if (!State) {
- ythrow TFutureException() << "state not initialized";
+ ::NThreading::NImpl::ThrowFutureException("state not initialized"sv, __LOCATION__);
}
}
diff --git a/library/cpp/threading/future/core/future.cpp b/library/cpp/threading/future/core/future.cpp
index 3243afcb40..809369d843 100644
--- a/library/cpp/threading/future/core/future.cpp
+++ b/library/cpp/threading/future/core/future.cpp
@@ -1 +1,7 @@
#include "future.h"
+
+namespace NThreading::NImpl {
+ [[noreturn]] void ThrowFutureException(TStringBuf message, const TSourceLocation& source) {
+ throw source + TFutureException() << message;
+ }
+}