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 /util/system | |
parent | 8d333d5e773f6b0ef31e7b3c92339af7e71413f6 (diff) | |
download | ydb-9dac44a55ede6f682527e82880847f99bd7b2d93.tar.gz |
Restoring authorship annotation for <anelyubin@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'util/system')
-rw-r--r-- | util/system/compiler.cpp | 2 | ||||
-rw-r--r-- | util/system/compiler.h | 6 | ||||
-rw-r--r-- | util/system/filemap.cpp | 8 | ||||
-rw-r--r-- | util/system/filemap.h | 10 | ||||
-rw-r--r-- | util/system/guard.h | 32 | ||||
-rw-r--r-- | util/system/guard_ut.cpp | 46 | ||||
-rw-r--r-- | util/system/spinlock.h | 6 | ||||
-rw-r--r-- | util/system/yassert.h | 2 |
8 files changed, 56 insertions, 56 deletions
diff --git a/util/system/compiler.cpp b/util/system/compiler.cpp index 243e0240a4e..d4b3cca0af5 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 1b93c3aa841..b373edcc466 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 6c8b3a627ce..7454a4cb948 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 ce396f3c5a4..11be64bff47 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 fe95ae5e76a..efc091d5f8d 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 a2202c226a4..404ede99ab9 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 283277a28df..af2630890a5 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 03d5b89c0f5..529823440cb 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 |