diff options
author | anelyubin <anelyubin@yandex-team.ru> | 2022-02-10 16:49:40 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:49:40 +0300 |
commit | 9dac44a55ede6f682527e82880847f99bd7b2d93 (patch) | |
tree | 5d5cb817648f650d76cf1076100726fd9b8448e8 | |
parent | 8d333d5e773f6b0ef31e7b3c92339af7e71413f6 (diff) | |
download | ydb-9dac44a55ede6f682527e82880847f99bd7b2d93.tar.gz |
Restoring authorship annotation for <anelyubin@yandex-team.ru>. Commit 2 of 2.
34 files changed, 232 insertions, 232 deletions
diff --git a/library/cpp/containers/comptrie/comptrie_trie.h b/library/cpp/containers/comptrie/comptrie_trie.h index e4ce94a6e9..40ec1e52b3 100644 --- a/library/cpp/containers/comptrie/comptrie_trie.h +++ b/library/cpp/containers/comptrie/comptrie_trie.h @@ -233,7 +233,7 @@ template <class T, class D, class S> TCompactTrie<T, D, S>::TCompactTrie(const char* d, size_t len, TPacker packer) : Packer(packer) { - Init(d, len, packer); + Init(d, len, packer); } template <class T, class D, class S> diff --git a/library/cpp/getopt/small/last_getopt_handlers.h b/library/cpp/getopt/small/last_getopt_handlers.h index 1728aef015..d35456ef34 100644 --- a/library/cpp/getopt/small/last_getopt_handlers.h +++ b/library/cpp/getopt/small/last_getopt_handlers.h @@ -18,7 +18,7 @@ namespace NLastGetopt { template <class TpFunc> struct TOptKVHandler; - [[noreturn]] void PrintUsageAndExit(const TOptsParser* parser); - [[noreturn]] void PrintVersionAndExit(const TOptsParser* parser); + [[noreturn]] void PrintUsageAndExit(const TOptsParser* parser); + [[noreturn]] void PrintVersionAndExit(const TOptsParser* parser); [[noreturn]] void PrintShortVersionAndExit(const TString& appName); } diff --git a/library/cpp/http/server/http.cpp b/library/cpp/http/server/http.cpp index 05da4d9f97..128583bdd7 100644 --- a/library/cpp/http/server/http.cpp +++ b/library/cpp/http/server/http.cpp @@ -397,15 +397,15 @@ public: Requests->Start(Options_.nThreads, Options_.MaxQueueSize); } - TImpl(THttpServer* parent, ICallBack* cb, TMtpQueueRef mainWorkers, TMtpQueueRef failWorkers, const TOptions& options_) + TImpl(THttpServer* parent, ICallBack* cb, TMtpQueueRef mainWorkers, TMtpQueueRef failWorkers, const TOptions& options_) : Requests(mainWorkers) - , FailRequests(failWorkers) - , Options_(options_) - , Cb_(cb) - , Parent_(parent) - { - } - + , FailRequests(failWorkers) + , Options_(options_) + , Cb_(cb) + , Parent_(parent) + { + } + TImpl(THttpServer* parent, ICallBack* cb, const TOptions& options, IThreadFactory* factory) : TImpl( parent, @@ -413,8 +413,8 @@ public: MakeThreadPool<TSimpleThreadPool>(factory, options.UseElasticQueues, cb, options.RequestsThreadName), MakeThreadPool<TThreadPool>(factory, options.UseElasticQueues, nullptr, options.FailRequestsThreadName), options) { - } - + } + ~TImpl() { try { Stop(); @@ -446,8 +446,8 @@ public: TPipeHandle ListenWakeupReadFd; TPipeHandle ListenWakeupWriteFd; TSystemEvent ListenStartEvent; - TMtpQueueRef Requests; - TMtpQueueRef FailRequests; + TMtpQueueRef Requests; + TMtpQueueRef FailRequests; TAtomic ConnectionCount = 0; THolder<TSocketPoller> Poller; THolder<TConnections> Connections; @@ -487,11 +487,11 @@ THttpServer::THttpServer(ICallBack* cb, const TOptions& options, IThreadFactory* { } -THttpServer::THttpServer(ICallBack* cb, TMtpQueueRef mainWorkers, TMtpQueueRef failWorkers, const TOptions& options) - : Impl_(new TImpl(this, cb, mainWorkers, failWorkers, options)) -{ -} - +THttpServer::THttpServer(ICallBack* cb, TMtpQueueRef mainWorkers, TMtpQueueRef failWorkers, const TOptions& options) + : Impl_(new TImpl(this, cb, mainWorkers, failWorkers, options)) +{ +} + THttpServer::~THttpServer() { } diff --git a/library/cpp/http/server/http.h b/library/cpp/http/server/http.h index 274f9c2d02..b292d38f27 100644 --- a/library/cpp/http/server/http.h +++ b/library/cpp/http/server/http.h @@ -65,7 +65,7 @@ public: typedef TSimpleSharedPtr<IThreadPool> TMtpQueueRef; THttpServer(ICallBack* cb, const TOptions& options = TOptions(), IThreadFactory* pool = nullptr); - THttpServer(ICallBack* cb, TMtpQueueRef mainWorkers, TMtpQueueRef failWorkers, const TOptions& options = TOptions()); + THttpServer(ICallBack* cb, TMtpQueueRef mainWorkers, TMtpQueueRef failWorkers, const TOptions& options = TOptions()); virtual ~THttpServer(); bool Start(); diff --git a/library/cpp/monlib/encode/encoder_state.h b/library/cpp/monlib/encode/encoder_state.h index 64c9fea6cb..e6a098f404 100644 --- a/library/cpp/monlib/encode/encoder_state.h +++ b/library/cpp/monlib/encode/encoder_state.h @@ -31,7 +31,7 @@ namespace NMonitoring { return !operator==(rhs); } - [[noreturn]] inline void ThrowInvalid(TStringBuf message) const { + [[noreturn]] inline void ThrowInvalid(TStringBuf message) const { ythrow yexception() << "invalid encoder state: " << ToStr() << ", " << message; } diff --git a/library/cpp/openssl/ya.make b/library/cpp/openssl/ya.make index b0d489a630..7c10963e26 100644 --- a/library/cpp/openssl/ya.make +++ b/library/cpp/openssl/ya.make @@ -1,8 +1,8 @@ RECURSE( big_integer big_integer/ut - crypto - crypto/ut + crypto + crypto/ut holders holders/ut io diff --git a/library/cpp/protobuf/util/simple_reflection.h b/library/cpp/protobuf/util/simple_reflection.h index e39b0416d6..61e877a787 100644 --- a/library/cpp/protobuf/util/simple_reflection.h +++ b/library/cpp/protobuf/util/simple_reflection.h @@ -104,7 +104,7 @@ namespace NProtoBuf { return *Msg.GetReflection(); } - [[noreturn]] void RaiseUnknown() const { + [[noreturn]] void RaiseUnknown() const { ythrow yexception() << "Unknown field cpp-type: " << (size_t)CppType(); } diff --git a/util/draft/matrix.h b/util/draft/matrix.h index 15cb0f7fb4..154d00b35e 100644 --- a/util/draft/matrix.h +++ b/util/draft/matrix.h @@ -92,7 +92,7 @@ public: } void Zero() { - memset((void*)Arr, 0, M * N * sizeof(T)); + memset((void*)Arr, 0, M * N * sizeof(T)); } void Fill(T value) { diff --git a/util/generic/bitops.h b/util/generic/bitops.h index 7dedd06efe..2db15fc59b 100644 --- a/util/generic/bitops.h +++ b/util/generic/bitops.h @@ -4,7 +4,7 @@ #include "typelist.h" #include <util/system/compiler.h> -#include <util/system/yassert.h> +#include <util/system/yassert.h> #ifdef _MSC_VER #include <intrin.h> @@ -98,7 +98,7 @@ namespace NBitOps { Y_ASSERT(value); // because __builtin_ctz* have undefined result for zero. return __builtin_ctzl(value); } - + inline unsigned CountTrailingZeroBitsImpl(unsigned long long value) noexcept { Y_ASSERT(value); // because __builtin_ctz* have undefined result for zero. return __builtin_ctzll(value); @@ -113,7 +113,7 @@ namespace NBitOps { value >>= 1; ++result; } - + return result; } #endif @@ -210,7 +210,7 @@ static inline T FastClp2(T t) noexcept { Y_ASSERT(t > 0); using TCvt = typename ::TUnsignedInts::template TSelectBy<TSizeOfPredicate<sizeof(T)>::template TResult>::type; return 1 + ::NBitOps::NPrivate::TClp2Helper<sizeof(TCvt) * 4, T>::Calc(static_cast<TCvt>(t)); -} +} /** * Check if integer is a power of 2. diff --git a/util/generic/fastqueue.h b/util/generic/fastqueue.h index c67947b102..1fee5b86f6 100644 --- a/util/generic/fastqueue.h +++ b/util/generic/fastqueue.h @@ -1,54 +1,54 @@ -#pragma once - -#include <util/memory/smallobj.h> +#pragma once + +#include <util/memory/smallobj.h> #include "ptr.h" - -template <class T> -class TFastQueue { - struct THelper: public TObjectFromPool<THelper>, public TIntrusiveListItem<THelper> { - inline THelper(const T& t) - : Obj(t) - { - } - - T Obj; - }; - -public: - inline TFastQueue() - : Pool_(TDefaultAllocator::Instance()) - , Size_(0) - { - } - - inline void Push(const T& t) { - Queue_.PushFront(new (&Pool_) THelper(t)); - ++Size_; - } - - inline T Pop() { + +template <class T> +class TFastQueue { + struct THelper: public TObjectFromPool<THelper>, public TIntrusiveListItem<THelper> { + inline THelper(const T& t) + : Obj(t) + { + } + + T Obj; + }; + +public: + inline TFastQueue() + : Pool_(TDefaultAllocator::Instance()) + , Size_(0) + { + } + + inline void Push(const T& t) { + Queue_.PushFront(new (&Pool_) THelper(t)); + ++Size_; + } + + inline T Pop() { Y_ASSERT(!this->Empty()); - - THolder<THelper> tmp(Queue_.PopBack()); - --Size_; - - return tmp->Obj; - } - + + THolder<THelper> tmp(Queue_.PopBack()); + --Size_; + + return tmp->Obj; + } + inline size_t Size() const noexcept { - return Size_; - } - + return Size_; + } + Y_PURE_FUNCTION inline bool Empty() const noexcept { - return !this->Size(); - } - + return !this->Size(); + } + inline explicit operator bool() const noexcept { return !this->Empty(); } -private: - typename THelper::TPool Pool_; - TIntrusiveListWithAutoDelete<THelper, TDelete> Queue_; - size_t Size_; -}; +private: + typename THelper::TPool Pool_; + TIntrusiveListWithAutoDelete<THelper, TDelete> Queue_; + size_t Size_; +}; diff --git a/util/generic/strbuf.h b/util/generic/strbuf.h index b37f7c9406..70b9360d58 100644 --- a/util/generic/strbuf.h +++ b/util/generic/strbuf.h @@ -393,7 +393,7 @@ public: return NextTokTemplate(delim, tok); } - bool NextTok(TdSelf delim, TdSelf& tok) { + bool NextTok(TdSelf delim, TdSelf& tok) { return NextTokTemplate(delim, tok); } @@ -401,7 +401,7 @@ public: return RNextTokTemplate(delim, tok); } - bool RNextTok(TdSelf delim, TdSelf& tok) { + bool RNextTok(TdSelf delim, TdSelf& tok) { return RNextTokTemplate(delim, tok); } @@ -425,11 +425,11 @@ public: return RNextTokTemplate(delim); } - TdSelf NextTok(TdSelf delim) { + TdSelf NextTok(TdSelf delim) { return NextTokTemplate(delim); } - TdSelf RNextTok(TdSelf delim) { + TdSelf RNextTok(TdSelf delim) { return RNextTokTemplate(delim); } diff --git a/util/generic/utility.cpp b/util/generic/utility.cpp index 0c40777882..e1ed101c76 100644 --- a/util/generic/utility.cpp +++ b/util/generic/utility.cpp @@ -1,4 +1,4 @@ -#include "utility.h" +#include "utility.h" #ifdef _MSC_VER #include <Windows.h> diff --git a/util/generic/xrange.cpp b/util/generic/xrange.cpp index 0182779829..74ee8a40fe 100644 --- a/util/generic/xrange.cpp +++ b/util/generic/xrange.cpp @@ -1 +1 @@ -#include "xrange.h" +#include "xrange.h" diff --git a/util/generic/xrange.h b/util/generic/xrange.h index 0544bea31a..5fc8c82912 100644 --- a/util/generic/xrange.h +++ b/util/generic/xrange.h @@ -1,37 +1,37 @@ -#pragma once - +#pragma once + #include "typetraits.h" #include "utility.h" -#include <util/system/yassert.h> +#include <util/system/yassert.h> #include <iterator> - -/** @file - * Some similar for python xrange(): https://docs.python.org/2/library/functions.html#xrange - * Discussion: https://clubs.at.yandex-team.ru/arcadia/6124 - * - * Example usage: - * for (auto i: xrange(MyVector.size())) { // instead for (size_t i = 0; i < MyVector.size(); ++i) - * DoSomething(i, MyVector[i]); - * } + +/** @file + * Some similar for python xrange(): https://docs.python.org/2/library/functions.html#xrange + * Discussion: https://clubs.at.yandex-team.ru/arcadia/6124 + * + * Example usage: + * for (auto i: xrange(MyVector.size())) { // instead for (size_t i = 0; i < MyVector.size(); ++i) + * DoSomething(i, MyVector[i]); + * } * * TVector<int> arithmeticSeq = xrange(10); // instead: TVector<int> arithmeticSeq; for(size_t i = 0; i < 10; ++i) { arithmeticSeq.push_back(i); } * - */ - -namespace NPrivate { - template <typename T> + */ + +namespace NPrivate { + template <typename T> class TSimpleXRange { using TDiff = decltype(T() - T()); - public: + public: constexpr TSimpleXRange(T start, T finish) noexcept : Start(start) , Finish(Max(start, finish)) { - } - + } + class TIterator { - public: + public: using value_type = T; using difference_type = TDiff; using pointer = const T*; @@ -39,26 +39,26 @@ namespace NPrivate { using iterator_category = std::random_access_iterator_tag; constexpr TIterator(T value) noexcept - : Value(value) - { - } - + : Value(value) + { + } + constexpr T operator*() const noexcept { - return Value; - } - + return Value; + } + constexpr bool operator!=(const TIterator& other) const noexcept { - return Value != other.Value; - } - + return Value != other.Value; + } + constexpr bool operator==(const TIterator& other) const noexcept { return Value == other.Value; } TIterator& operator++() noexcept { - ++Value; + ++Value; return *this; - } + } TIterator& operator--() noexcept { --Value; @@ -95,21 +95,21 @@ namespace NPrivate { return Value < b.Value; } - private: - T Value; - }; - + private: + T Value; + }; + using value_type = T; using iterator = TIterator; using const_iterator = TIterator; constexpr TIterator begin() const noexcept { - return TIterator(Start); - } - + return TIterator(Start); + } + constexpr TIterator end() const noexcept { - return TIterator(Finish); - } + return TIterator(Finish); + } constexpr T size() const noexcept { return Finish - Start; @@ -120,11 +120,11 @@ namespace NPrivate { return Container(begin(), end()); } - private: - T Start; - T Finish; - }; - + private: + T Start; + T Finish; + }; + template <typename T> class TSteppedXRange { using TDiff = decltype(T() - T()); @@ -244,7 +244,7 @@ namespace NPrivate { }; } - + /** * generate arithmetic progression that starts at start with certain step and stop at finish (not including) * @@ -255,14 +255,14 @@ constexpr ::NPrivate::TSteppedXRange<T> xrange(T start, T finish, decltype(T() - return {start, finish, step}; } -/// generate sequence [start; finish) -template <typename T> +/// generate sequence [start; finish) +template <typename T> constexpr ::NPrivate::TSimpleXRange<T> xrange(T start, T finish) noexcept { return {start, finish}; -} - -/// generate sequence [0; finish) -template <typename T> +} + +/// generate sequence [0; finish) +template <typename T> constexpr auto xrange(T finish) noexcept -> decltype(xrange(T(), finish)) { - return xrange(T(), finish); -} + return xrange(T(), finish); +} diff --git a/util/generic/xrange_ut.cpp b/util/generic/xrange_ut.cpp index 41ba8812a9..8106da03e7 100644 --- a/util/generic/xrange_ut.cpp +++ b/util/generic/xrange_ut.cpp @@ -5,31 +5,31 @@ #include "vector.h" #include <library/cpp/testing/unittest/registar.h> #include <util/string/builder.h> - + Y_UNIT_TEST_SUITE(XRange) { - void TestXRangeImpl(size_t begin, size_t end) { - size_t count = 0; - size_t sum = 0; - size_t first = 42; - bool firstInited = false; - size_t last = 0; - + void TestXRangeImpl(size_t begin, size_t end) { + size_t count = 0; + size_t sum = 0; + size_t first = 42; + bool firstInited = false; + size_t last = 0; + for (auto i : xrange(begin, end)) { ++count; - sum += i; - last = i; - if (!firstInited) { - first = i; - firstInited = true; - } - } - - UNIT_ASSERT_VALUES_EQUAL(count, end - begin); - UNIT_ASSERT_VALUES_EQUAL(first, begin); - UNIT_ASSERT_VALUES_EQUAL(last, end - 1); - UNIT_ASSERT_VALUES_EQUAL(sum, count * (first + last) / 2); - } - + sum += i; + last = i; + if (!firstInited) { + first = i; + firstInited = true; + } + } + + UNIT_ASSERT_VALUES_EQUAL(count, end - begin); + UNIT_ASSERT_VALUES_EQUAL(first, begin); + UNIT_ASSERT_VALUES_EQUAL(last, end - 1); + UNIT_ASSERT_VALUES_EQUAL(sum, count * (first + last) / 2); + } + void TestSteppedXRangeImpl(int begin, int end, int step, const TVector<int>& expected) { size_t expInd = 0; for (auto i : xrange(begin, end, step)) { @@ -41,9 +41,9 @@ Y_UNIT_TEST_SUITE(XRange) { } Y_UNIT_TEST(IncrementWorks) { - TestXRangeImpl(0, 10); - TestXRangeImpl(10, 20); - } + TestXRangeImpl(0, 10); + TestXRangeImpl(10, 20); + } Y_UNIT_TEST(DecrementWorks) { TestSteppedXRangeImpl(10, 0, -1, {10, 9, 8, 7, 6, 5, 4, 3, 2, 1}); @@ -214,4 +214,4 @@ Y_UNIT_TEST_SUITE(XRange) { UNIT_ASSERT_VALUES_EQUAL(5, *it); } } -} +} diff --git a/util/generic/yexception.h b/util/generic/yexception.h index f094c1c0ee..b0c604e8c4 100644 --- a/util/generic/yexception.h +++ b/util/generic/yexception.h @@ -148,7 +148,7 @@ namespace NPrivate { TStringBuf Message; }; - [[noreturn]] void ThrowYException(const TSimpleExceptionMessage& sm); + [[noreturn]] void ThrowYException(const TSimpleExceptionMessage& sm); [[noreturn]] void ThrowYExceptionWithBacktrace(const TSimpleExceptionMessage& sm); } diff --git a/util/string/cast.cpp b/util/string/cast.cpp index e26ac086d1..aa1e65a8e9 100644 --- a/util/string/cast.cpp +++ b/util/string/cast.cpp @@ -322,7 +322,7 @@ namespace { }; template <class TChar> - [[noreturn]] static Y_NO_INLINE void ThrowParseError(EParseStatus status, const TChar* data, size_t len, const TChar* pos) { + [[noreturn]] static Y_NO_INLINE void ThrowParseError(EParseStatus status, const TChar* data, size_t len, const TChar* pos) { Y_ASSERT(status != PS_OK); typedef TBasicString<TChar> TStringType; diff --git a/util/system/compiler.cpp b/util/system/compiler.cpp index 243e0240a4..d4b3cca0af 100644 --- a/util/system/compiler.cpp +++ b/util/system/compiler.cpp @@ -1,7 +1,7 @@ #include "compiler.h" #include <cstdlib> -[[noreturn]] Y_HIDDEN void _YandexAbort() { +[[noreturn]] Y_HIDDEN void _YandexAbort() { std::abort(); } diff --git a/util/system/compiler.h b/util/system/compiler.h index 1b93c3aa84..b373edcc46 100644 --- a/util/system/compiler.h +++ b/util/system/compiler.h @@ -237,9 +237,9 @@ constexpr Y_FORCE_INLINE int Y_UNUSED(Types&&...) { #define Y_ASSUME(condition) Y_UNUSED(condition) #endif -#ifdef __cplusplus -[[noreturn]] -#endif +#ifdef __cplusplus +[[noreturn]] +#endif Y_HIDDEN void _YandexAbort(); diff --git a/util/system/filemap.cpp b/util/system/filemap.cpp index 6c8b3a627c..7454a4cb94 100644 --- a/util/system/filemap.cpp +++ b/util/system/filemap.cpp @@ -103,7 +103,7 @@ static int ModeToMmapProt(TMemoryMapCommon::EOpenMode mode) { #endif // maybe we should move this function to another .cpp file to avoid unwanted optimization? -void NPrivate::Precharge(const void* data, size_t dataSize, size_t off, size_t size) { +void NPrivate::Precharge(const void* data, size_t dataSize, size_t off, size_t size) { if (off > dataSize) { assert(false); return; @@ -118,7 +118,7 @@ void NPrivate::Precharge(const void* data, size_t dataSize, size_t off, size_t s return; } - volatile const char *c = (const char*)data + off, *e = c + size; + volatile const char *c = (const char*)data + off, *e = c + size; for (; c < e; c += 512) { *c; } @@ -262,7 +262,7 @@ public: } NSan::Unpoison(result.Ptr, result.Size); if (Mode_ & oPrecharge) { - NPrivate::Precharge(result.Ptr, result.Size, 0, result.Size); + NPrivate::Precharge(result.Ptr, result.Size, 0, result.Size); } return result; @@ -526,7 +526,7 @@ TFileMap::~TFileMap() { } void TFileMap::Precharge(size_t pos, size_t size) const { - NPrivate::Precharge(Ptr(), MappedSize(), pos, size); + NPrivate::Precharge(Ptr(), MappedSize(), pos, size); } TMappedAllocation::TMappedAllocation(size_t size, bool shared, void* addr) diff --git a/util/system/filemap.h b/util/system/filemap.h index ce396f3c5a..11be64bff4 100644 --- a/util/system/filemap.h +++ b/util/system/filemap.h @@ -14,11 +14,11 @@ #include <new> #include <cstdio> -namespace NPrivate { - // NB: use TFileMap::Precharge() and TFileMappedArray::Prechage() - void Precharge(const void* data, size_t dataSize, size_t offset, size_t size); -} - +namespace NPrivate { + // NB: use TFileMap::Precharge() and TFileMappedArray::Prechage() + void Precharge(const void* data, size_t dataSize, size_t offset, size_t size); +} + struct TMemoryMapCommon { struct TMapResult { inline size_t MappedSize() const noexcept { diff --git a/util/system/guard.h b/util/system/guard.h index fe95ae5e76..efc091d5f8 100644 --- a/util/system/guard.h +++ b/util/system/guard.h @@ -13,13 +13,13 @@ struct TCommonLockOps { } }; -template <class T> +template <class T> struct TTryLockOps: public TCommonLockOps<T> { static inline bool TryAcquire(T* t) noexcept { - return t->TryAcquire(); - } -}; - + return t->TryAcquire(); + } +}; + //must be used with great care template <class TOps> struct TInverseLockOps: public TOps { @@ -115,7 +115,7 @@ static inline TGuard<T> Guard(const T& t) { */ template <class T, class TOps = TCommonLockOps<T>> using TInverseGuard = TGuard<T, TInverseLockOps<TOps>>; - + template <class T, class TOps> static inline TInverseGuard<T, TOps> Unguard(const TGuard<T, TOps>& guard) { return {guard.GetMutex()}; @@ -127,16 +127,16 @@ static inline TInverseGuard<T> Unguard(const T& mutex) { } template <class T, class TOps = TTryLockOps<T>> -class TTryGuard: public TNonCopyable { +class TTryGuard: public TNonCopyable { public: inline TTryGuard(const T& t) noexcept { Init(&t); } - + inline TTryGuard(const T* t) noexcept { Init(t); } - + inline TTryGuard(TTryGuard&& g) noexcept : T_(g.T_) { @@ -146,18 +146,18 @@ public: inline ~TTryGuard() { Release(); } - + inline void Release() noexcept { if (WasAcquired()) { TOps::Release(T_); T_ = nullptr; - } + } } - + inline bool WasAcquired() const noexcept { return T_ != nullptr; } - + explicit inline operator bool() const noexcept { return WasAcquired(); } @@ -168,9 +168,9 @@ private: T* tMutable = const_cast<T*>(t); if (TOps::TryAcquire(tMutable)) { T_ = tMutable; - } + } } - + private: T* T_; -}; +}; diff --git a/util/system/guard_ut.cpp b/util/system/guard_ut.cpp index a2202c226a..404ede99ab 100644 --- a/util/system/guard_ut.cpp +++ b/util/system/guard_ut.cpp @@ -29,14 +29,14 @@ struct TTestGuard: public TTestBase { void Release() { guarded = false; } - bool TryAcquire() { - if (guarded) { - return false; - } else { - guarded = true; - return true; - } - } + bool TryAcquire() { + if (guarded) { + return false; + } else { + guarded = true; + return true; + } + } bool guarded; }; @@ -111,24 +111,24 @@ struct TTestGuard: public TTestBase { } UNIT_ASSERT(!checker.guarded); } - - void TestTryGuard() { - TGuardChecker checker; - - UNIT_ASSERT(!checker.guarded); - { - TTryGuard<TGuardChecker> guard(checker); - UNIT_ASSERT(checker.guarded); + + void TestTryGuard() { + TGuardChecker checker; + + UNIT_ASSERT(!checker.guarded); + { + TTryGuard<TGuardChecker> guard(checker); + UNIT_ASSERT(checker.guarded); UNIT_ASSERT(guard.WasAcquired()); { - TTryGuard<TGuardChecker> guard2(checker); - UNIT_ASSERT(checker.guarded); + TTryGuard<TGuardChecker> guard2(checker); + UNIT_ASSERT(checker.guarded); UNIT_ASSERT(!guard2.WasAcquired()); - } - UNIT_ASSERT(checker.guarded); - } - UNIT_ASSERT(!checker.guarded); - } + } + UNIT_ASSERT(checker.guarded); + } + UNIT_ASSERT(!checker.guarded); + } void TestTryReadGuard() { TRWMutex mutex; diff --git a/util/system/spinlock.h b/util/system/spinlock.h index 283277a28d..af2630890a 100644 --- a/util/system/spinlock.h +++ b/util/system/spinlock.h @@ -117,9 +117,9 @@ struct TCommonLockOps<TAtomic> { } static inline bool TryAcquire(TAtomic* v) noexcept { - return AtomicTryLock(v); - } - + return AtomicTryLock(v); + } + static inline void Release(TAtomic* v) noexcept { ReleaseAdaptiveLock(v); } diff --git a/util/system/yassert.h b/util/system/yassert.h index 03d5b89c0f..529823440c 100644 --- a/util/system/yassert.h +++ b/util/system/yassert.h @@ -91,7 +91,7 @@ inline void YaDebugBreak() { namespace NPrivate { /// method should not be used directly - [[noreturn]] void Panic(const TStaticBuf& file, int line, const char* function, const char* expr, const char* format, ...) noexcept Y_PRINTF_FORMAT(5, 6); + [[noreturn]] void Panic(const TStaticBuf& file, int line, const char* function, const char* expr, const char* format, ...) noexcept Y_PRINTF_FORMAT(5, 6); } /// Assert that does not depend on NDEBUG macro and outputs message like printf diff --git a/util/thread/pool.cpp b/util/thread/pool.cpp index b733f72a57..05fad02e9b 100644 --- a/util/thread/pool.cpp +++ b/util/thread/pool.cpp @@ -11,7 +11,7 @@ #include <util/generic/yexception.h> #include <util/generic/ylimits.h> #include <util/generic/singleton.h> -#include <util/generic/fastqueue.h> +#include <util/generic/fastqueue.h> #include <util/stream/output.h> #include <util/string/builder.h> diff --git a/ydb/core/tablet_flat/util_fmt_abort.h b/ydb/core/tablet_flat/util_fmt_abort.h index edfa6e42d7..ffab6fde85 100644 --- a/ydb/core/tablet_flat/util_fmt_abort.h +++ b/ydb/core/tablet_flat/util_fmt_abort.h @@ -20,7 +20,7 @@ namespace NUtil { Raw.reserve(192); } - [[noreturn]] ~TFail() + [[noreturn]] ~TFail() { ::NPrivate::Panic(File, Line, Func, nullptr, "%s\n", Raw.data()); } diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_ensure.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_ensure.cpp index d6d8082bd2..85c8371ec6 100644 --- a/ydb/library/yql/minikql/comp_nodes/mkql_ensure.cpp +++ b/ydb/library/yql/minikql/comp_nodes/mkql_ensure.cpp @@ -58,7 +58,7 @@ public: #endif private: - [[noreturn]] static void Throw(TEnsureWrapper const* thisPtr, TComputationContext* ctxPtr) { + [[noreturn]] static void Throw(TEnsureWrapper const* thisPtr, TComputationContext* ctxPtr) { auto message = thisPtr->Message->GetValue(*ctxPtr); auto messageStr = message.AsStringRef(); TStringBuilder res; diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_unwrap.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_unwrap.cpp index 4c0c79d594..daef4d28f9 100644 --- a/ydb/library/yql/minikql/comp_nodes/mkql_unwrap.cpp +++ b/ydb/library/yql/minikql/comp_nodes/mkql_unwrap.cpp @@ -49,7 +49,7 @@ public: } #endif private: - [[noreturn]] static void Throw(TUnwrapWrapper const* thisPtr, TComputationContext* ctxPtr) { + [[noreturn]] static void Throw(TUnwrapWrapper const* thisPtr, TComputationContext* ctxPtr) { auto message = thisPtr->Message->GetValue(*ctxPtr); auto messageStr = message.AsStringRef(); TStringBuilder res; diff --git a/ydb/library/yql/minikql/defs.h b/ydb/library/yql/minikql/defs.h index 71fff6ed54..3e332363c6 100644 --- a/ydb/library/yql/minikql/defs.h +++ b/ydb/library/yql/minikql/defs.h @@ -34,7 +34,7 @@ namespace NKikimr { template <typename T> -[[noreturn]] void ThrowException(T&& e) +[[noreturn]] void ThrowException(T&& e) { throw e; } @@ -42,7 +42,7 @@ template <typename T> struct TThrowable { template <typename T> - [[noreturn]] void operator,(T&& e) { + [[noreturn]] void operator,(T&& e) { ThrowException(e); } }; diff --git a/ydb/library/yql/minikql/mkql_node_serialization.cpp b/ydb/library/yql/minikql/mkql_node_serialization.cpp index d3a11e3421..e314f38cd6 100644 --- a/ydb/library/yql/minikql/mkql_node_serialization.cpp +++ b/ydb/library/yql/minikql/mkql_node_serialization.cpp @@ -1044,11 +1044,11 @@ namespace { } private: - [[noreturn]] static void ThrowNoData() { + [[noreturn]] static void ThrowNoData() { THROW yexception() << "No more data in buffer"; } - [[noreturn]] static void ThrowCorrupted() { + [[noreturn]] static void ThrowCorrupted() { THROW yexception() << "Serialized data is corrupted"; } diff --git a/ydb/library/yql/minikql/mkql_terminator.cpp b/ydb/library/yql/minikql/mkql_terminator.cpp index b918055953..d86ba4edaf 100644 --- a/ydb/library/yql/minikql/mkql_terminator.cpp +++ b/ydb/library/yql/minikql/mkql_terminator.cpp @@ -18,7 +18,7 @@ TBindTerminator::~TBindTerminator() Terminator = PreviousTerminator; } -[[noreturn]] void MKQLTerminate(const char* message) { +[[noreturn]] void MKQLTerminate(const char* message) { if (const auto t = TBindTerminator::Terminator) t->Terminate(message); diff --git a/ydb/library/yql/minikql/mkql_terminator.h b/ydb/library/yql/minikql/mkql_terminator.h index 40e9e96720..2453e88938 100644 --- a/ydb/library/yql/minikql/mkql_terminator.h +++ b/ydb/library/yql/minikql/mkql_terminator.h @@ -26,7 +26,7 @@ private: ITerminator* PreviousTerminator; }; -[[noreturn]] void MKQLTerminate(const char* message); +[[noreturn]] void MKQLTerminate(const char* message); } diff --git a/ydb/library/yql/utils/yql_panic.h b/ydb/library/yql/utils/yql_panic.h index d83d9fb90f..e7e559b2c5 100644 --- a/ydb/library/yql/utils/yql_panic.h +++ b/ydb/library/yql/utils/yql_panic.h @@ -9,7 +9,7 @@ class TYqlPanic : public yexception {}; namespace NDetail { - [[noreturn]] void YqlPanic(const ::NPrivate::TStaticBuf& file, int line, const char* function, const TStringBuf& condition, const TStringBuf& message); + [[noreturn]] void YqlPanic(const ::NPrivate::TStaticBuf& file, int line, const char* function, const TStringBuf& condition, const TStringBuf& message); } #define YQL_ENSURE(CONDITION, ...) \ |