diff options
author | alevitskii <[email protected]> | 2025-01-20 21:52:05 +0300 |
---|---|---|
committer | alevitskii <[email protected]> | 2025-01-20 22:31:15 +0300 |
commit | c9d773da0955088ede07abe271f712d9138694db (patch) | |
tree | e8143a9d6db70f60d639b1ae7f2e1cbac7556908 | |
parent | c5a9fee73a0e921ad63674012d1730c96e45fa27 (diff) |
clang-format 18 in STYLE_CPP
clang-format 18 in STYLE\_CPP
commit_hash:e2018ac17a95817f09e131ee6d5316b2bdc2d39e
-rw-r--r-- | build/config/tests/cpp_style/default_configs.json | 2 | ||||
-rw-r--r-- | build/platform/clang/clang-format/clang-format16.json | 19 | ||||
-rw-r--r-- | build/platform/clang/clang-format/clang-format18.json | 19 | ||||
-rw-r--r-- | build/platform/clang/clang-format/ya.make | 2 | ||||
-rw-r--r-- | util/generic/hash_table.h | 2 | ||||
-rw-r--r-- | util/generic/maybe.h | 2 | ||||
-rw-r--r-- | util/generic/maybe_traits.h | 4 | ||||
-rw-r--r-- | util/generic/utility.h | 4 | ||||
-rw-r--r-- | util/str_stl.h | 2 | ||||
-rw-r--r-- | util/system/context.cpp | 10 | ||||
-rw-r--r-- | util/system/defaults.h | 2 | ||||
-rw-r--r-- | util/system/file_ut.cpp | 99 | ||||
-rw-r--r-- | util/system/filemap.cpp | 2 |
13 files changed, 86 insertions, 83 deletions
diff --git a/build/config/tests/cpp_style/default_configs.json b/build/config/tests/cpp_style/default_configs.json index f8749d1a012..d35dc1baf81 100644 --- a/build/config/tests/cpp_style/default_configs.json +++ b/build/config/tests/cpp_style/default_configs.json @@ -1,3 +1,3 @@ { - "clang_format": "build/config/tests/cpp_style/config.clang-format" + "clang_format": "build/config/tests/cpp_style/config18.clang-format" } diff --git a/build/platform/clang/clang-format/clang-format16.json b/build/platform/clang/clang-format/clang-format16.json deleted file mode 100644 index 0f983621646..00000000000 --- a/build/platform/clang/clang-format/clang-format16.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "by_platform": { - "darwin": { - "uri": "sbr:7402815718" - }, - "darwin-arm64": { - "uri": "sbr:7402814010" - }, - "linux": { - "uri": "sbr:7402818343" - }, - "linux-aarch64": { - "uri": "sbr:7402817039" - }, - "win32-clang-cl": { - "uri": "sbr:7402812744" - } - } -} diff --git a/build/platform/clang/clang-format/clang-format18.json b/build/platform/clang/clang-format/clang-format18.json new file mode 100644 index 00000000000..c4cc0b5ad07 --- /dev/null +++ b/build/platform/clang/clang-format/clang-format18.json @@ -0,0 +1,19 @@ +{ + "by_platform": { + "darwin-arm64": { + "uri": "sbr:7831958167" + }, + "darwin-x86_64": { + "uri": "sbr:7831990717" + }, + "linux-aarch64": { + "uri": "sbr:7831996261" + }, + "linux-x86_64": { + "uri": "sbr:7832045657" + }, + "win32-x86_64": { + "uri": "sbr:7832062717" + } + } +} diff --git a/build/platform/clang/clang-format/ya.make b/build/platform/clang/clang-format/ya.make index 22a8e6e5c3b..1306b193377 100644 --- a/build/platform/clang/clang-format/ya.make +++ b/build/platform/clang/clang-format/ya.make @@ -2,6 +2,6 @@ RESOURCES_LIBRARY() # Note: the json below is also referred from build/ya.conf.json, # please change these references consistently -DECLARE_EXTERNAL_HOST_RESOURCES_BUNDLE_BY_JSON(CLANG_FORMAT clang-format16.json) +DECLARE_EXTERNAL_HOST_RESOURCES_BUNDLE_BY_JSON(CLANG_FORMAT clang-format18.json) END() diff --git a/util/generic/hash_table.h b/util/generic/hash_table.h index b33ad4f596c..beb7f8cfc89 100644 --- a/util/generic/hash_table.h +++ b/util/generic/hash_table.h @@ -348,7 +348,7 @@ private: * Note that there are no specializations for the case when only one or two * of the functors are empty as this is a case that's just way too rare. */ -template <class HashFcn, class ExtractKey, class EqualKey, class Alloc, bool IsEmpty = std::is_empty<HashFcn>::value&& std::is_empty<ExtractKey>::value&& std::is_empty<EqualKey>::value> +template <class HashFcn, class ExtractKey, class EqualKey, class Alloc, bool IsEmpty = std::is_empty<HashFcn>::value && std::is_empty<ExtractKey>::value && std::is_empty<EqualKey>::value> class _yhashtable_base: public _allocator_base<Alloc> { using base_type = _allocator_base<Alloc>; diff --git a/util/generic/maybe.h b/util/generic/maybe.h index 1de6bf38945..0dfcfdcaaa3 100644 --- a/util/generic/maybe.h +++ b/util/generic/maybe.h @@ -288,7 +288,7 @@ public: std::enable_if_t<TMoveAssignable<U>::value, TMaybe&> operator=(TMaybe<U, Policy>&& right) noexcept( - std::is_nothrow_assignable<T&, U&&>::value&& std::is_nothrow_constructible<T, U&&>::value) + std::is_nothrow_assignable<T&, U&&>::value && std::is_nothrow_constructible<T, U&&>::value) { if (right.Defined()) { if (Defined()) { diff --git a/util/generic/maybe_traits.h b/util/generic/maybe_traits.h index fc456a0a760..1fb3f312f75 100644 --- a/util/generic/maybe_traits.h +++ b/util/generic/maybe_traits.h @@ -162,8 +162,8 @@ namespace NMaybe { constexpr TMoveAssignBase(TMoveAssignBase&&) = default; TMoveAssignBase& operator=(const TMoveAssignBase&) = default; TMoveAssignBase& operator=(TMoveAssignBase&& rhs) noexcept( - std::is_nothrow_move_assignable<T>::value&& - std::is_nothrow_move_constructible<T>::value) + std::is_nothrow_move_assignable<T>::value && + std::is_nothrow_move_constructible<T>::value) { if (this->Defined_) { if (rhs.Defined_) { diff --git a/util/generic/utility.h b/util/generic/utility.h index c82c8f489e4..a7afefc4ff8 100644 --- a/util/generic/utility.h +++ b/util/generic/utility.h @@ -73,8 +73,8 @@ namespace NSwapCheck { template <class T, class = void> struct TSwapSelector { - static inline void Swap(T& l, T& r) noexcept(std::is_nothrow_move_constructible<T>::value&& - std::is_nothrow_move_assignable<T>::value) { + static inline void Swap(T& l, T& r) noexcept(std::is_nothrow_move_constructible<T>::value && + std::is_nothrow_move_assignable<T>::value) { T tmp(std::move(l)); l = std::move(r); r = std::move(tmp); diff --git a/util/str_stl.h b/util/str_stl.h index f86d017af37..5909e34902a 100644 --- a/util/str_stl.h +++ b/util/str_stl.h @@ -160,7 +160,7 @@ struct THash: public ::hash<T> { }; namespace NHashPrivate { - template <class TFirst, class TSecond, bool IsEmpty = std::is_empty<THash<TFirst>>::value&& std::is_empty<THash<TSecond>>::value> + template <class TFirst, class TSecond, bool IsEmpty = std::is_empty<THash<TFirst>>::value && std::is_empty<THash<TSecond>>::value> struct TPairHash { private: THash<TFirst> FirstHash; diff --git a/util/system/context.cpp b/util/system/context.cpp index 8285aa48de4..81dcb7664c5 100644 --- a/util/system/context.cpp +++ b/util/system/context.cpp @@ -117,15 +117,17 @@ namespace { #if defined(_x86_64_) // not sure if Y_NO_SANITIZE is needed Y_NO_SANITIZE("address") - Y_NO_SANITIZE("memory") extern "C" void ContextTrampoLine(void*, void*, void*, void*, void*, void*, // register arguments, no defined value - /* first argument passed through the stack */ void* t1, - /* second argument passed through the stack */ void* t2) { + Y_NO_SANITIZE("memory") extern "C" void + ContextTrampoLine(void*, void*, void*, void*, void*, void*, // register arguments, no defined value + /* first argument passed through the stack */ void* t1, + /* second argument passed through the stack */ void* t2) { Y_ASSERT(t1 == t2); Run(t1); } #else Y_NO_SANITIZE("address") - Y_NO_SANITIZE("memory") static void ContextTrampoLine() { + Y_NO_SANITIZE("memory") static void + ContextTrampoLine() { void** argPtr = (void**)((char*)AlignUp(&argPtr + EXTRA_PUSH_ARGS, STACK_ALIGN) + STACK_ALIGN); Y_ASSERT(*(argPtr - 1) == *(argPtr - 2)); diff --git a/util/system/defaults.h b/util/system/defaults.h index dcd7abea38e..c90e40ce226 100644 --- a/util/system/defaults.h +++ b/util/system/defaults.h @@ -152,4 +152,4 @@ constexpr bool Y_IS_DEBUG_BUILD = true; #define Y_GENERATE_UNIQUE_ID(N) Y_CAT(N, __LINE__) #endif -#define NPOS ((size_t)-1) +#define NPOS ((size_t) - 1) diff --git a/util/system/file_ut.cpp b/util/system/file_ut.cpp index 959633f579e..312a0e8f2c5 100644 --- a/util/system/file_ut.cpp +++ b/util/system/file_ut.cpp @@ -335,73 +335,74 @@ void TFileTest::TestPread() { #define TMPFS_MAGIC 0x01021994 #endif -void TFileTest::TestCache(){ +void TFileTest::TestCache() { #ifdef _linux_ - {// create file in /tmp, current dir could be tmpfs which does not support fadvise - TFile file(MakeTempName("/tmp"), OpenAlways | Transient | RdWr | NoReadAhead); + { // create file in /tmp, current dir could be tmpfs which does not support fadvise + TFile file(MakeTempName("/tmp"), OpenAlways | Transient | RdWr | NoReadAhead); -struct statfs fs; -if (!fstatfs(file.GetHandle(), &fs) && fs.f_type == TMPFS_MAGIC) { - return; -} + struct statfs fs; + if (!fstatfs(file.GetHandle(), &fs) && fs.f_type == TMPFS_MAGIC) { + return; + } -UNIT_ASSERT_VALUES_EQUAL(file.CountCache(), 0); -UNIT_ASSERT_VALUES_EQUAL(file.CountCache(0, 0), 0); + UNIT_ASSERT_VALUES_EQUAL(file.CountCache(), 0); + UNIT_ASSERT_VALUES_EQUAL(file.CountCache(0, 0), 0); -file.Resize(7); -file.PrefetchCache(); -UNIT_ASSERT_VALUES_EQUAL(file.CountCache(), 7); -UNIT_ASSERT_VALUES_EQUAL(file.CountCache(3, 2), 2); + file.Resize(7); + file.PrefetchCache(); + UNIT_ASSERT_VALUES_EQUAL(file.CountCache(), 7); + UNIT_ASSERT_VALUES_EQUAL(file.CountCache(3, 2), 2); -file.FlushCache(); -UNIT_ASSERT_VALUES_EQUAL(file.CountCache(), 7); + file.FlushCache(); + UNIT_ASSERT_VALUES_EQUAL(file.CountCache(), 7); -file.EvictCache(); -UNIT_ASSERT_VALUES_EQUAL(file.CountCache(), 0); + file.EvictCache(); + UNIT_ASSERT_VALUES_EQUAL(file.CountCache(), 0); -file.PrefetchCache(); -UNIT_ASSERT_VALUES_EQUAL(file.CountCache(), 7); + file.PrefetchCache(); + UNIT_ASSERT_VALUES_EQUAL(file.CountCache(), 7); -file.Resize(12345); -UNIT_ASSERT_VALUES_EQUAL(file.CountCache(), 4096); -UNIT_ASSERT_VALUES_EQUAL(file.CountCache(4096, 0), 0); + file.Resize(12345); + UNIT_ASSERT_VALUES_EQUAL(file.CountCache(), 4096); + UNIT_ASSERT_VALUES_EQUAL(file.CountCache(4096, 0), 0); -file.PrefetchCache(); -UNIT_ASSERT_VALUES_EQUAL(file.CountCache(), 12345); + file.PrefetchCache(); + UNIT_ASSERT_VALUES_EQUAL(file.CountCache(), 12345); -file.FlushCache(); -file.EvictCache(); -UNIT_ASSERT_LE(file.CountCache(), 0); + file.FlushCache(); + file.EvictCache(); + UNIT_ASSERT_LE(file.CountCache(), 0); -file.Resize(33333333); -file.PrefetchCache(11111111, 11111111); -UNIT_ASSERT_GE(file.CountCache(), 11111111); + file.Resize(33333333); + file.PrefetchCache(11111111, 11111111); + UNIT_ASSERT_GE(file.CountCache(), 11111111); -UNIT_ASSERT_LE(file.CountCache(0, 11111111), 1111111); -UNIT_ASSERT_VALUES_EQUAL(file.CountCache(11111111, 11111111), 11111111); -UNIT_ASSERT_LE(file.CountCache(22222222, 11111111), 1111111); + UNIT_ASSERT_LE(file.CountCache(0, 11111111), 1111111); + UNIT_ASSERT_VALUES_EQUAL(file.CountCache(11111111, 11111111), 11111111); + UNIT_ASSERT_LE(file.CountCache(22222222, 11111111), 1111111); -file.FlushCache(11111111, 11111111); -UNIT_ASSERT_GE(file.CountCache(), 11111111); + file.FlushCache(11111111, 11111111); + UNIT_ASSERT_GE(file.CountCache(), 11111111); -// first and last incomplete pages could stay in cache -file.EvictCache(11111111, 11111111); -UNIT_ASSERT_LT(file.CountCache(11111111, 11111111), 4096 * 2); + // first and last incomplete pages could stay in cache + file.EvictCache(11111111, 11111111); + UNIT_ASSERT_LT(file.CountCache(11111111, 11111111), 4096 * 2); -file.EvictCache(); -UNIT_ASSERT_VALUES_EQUAL(file.CountCache(), 0); -} + file.EvictCache(); + UNIT_ASSERT_VALUES_EQUAL(file.CountCache(), 0); + } #else - {TFile file(MakeTempName(), OpenAlways | Transient | RdWr); + { + TFile file(MakeTempName(), OpenAlways | Transient | RdWr); -file.Resize(12345); + file.Resize(12345); -UNIT_ASSERT_VALUES_EQUAL(file.CountCache(), -1); -file.PrefetchCache(); -file.FlushCache(); -file.EvictCache(); -UNIT_ASSERT_VALUES_EQUAL(file.CountCache(0, 12345), -1); -} + UNIT_ASSERT_VALUES_EQUAL(file.CountCache(), -1); + file.PrefetchCache(); + file.FlushCache(); + file.EvictCache(); + UNIT_ASSERT_VALUES_EQUAL(file.CountCache(0, 12345), -1); + } #endif } diff --git a/util/system/filemap.cpp b/util/system/filemap.cpp index 948572e81b8..95ea988e7df 100644 --- a/util/system/filemap.cpp +++ b/util/system/filemap.cpp @@ -37,7 +37,7 @@ #undef GRANULARITY #ifdef _win_ - #define MAP_FAILED ((void*)(LONG_PTR)-1) + #define MAP_FAILED ((void*)(LONG_PTR) - 1) #endif namespace { |