diff options
author | spreis <spreis@yandex-team.ru> | 2022-02-10 16:47:13 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:47:13 +0300 |
commit | bcd1126cbd5d445cd0665d295198aa39c6ab8cbe (patch) | |
tree | d41d29a041d5733ef148335290dbb817b197d4cd /library | |
parent | 986cb5d624f352524bfa0c42c9a7695235cdaa41 (diff) | |
download | ydb-bcd1126cbd5d445cd0665d295198aa39c6ab8cbe.tar.gz |
Restoring authorship annotation for <spreis@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library')
27 files changed, 197 insertions, 197 deletions
diff --git a/library/cpp/binsaver/bin_saver.h b/library/cpp/binsaver/bin_saver.h index 412424889f..69da5ad127 100644 --- a/library/cpp/binsaver/bin_saver.h +++ b/library/cpp/binsaver/bin_saver.h @@ -30,18 +30,18 @@ enum ESaverMode { SAVER_MODE_WRITE_COMPRESSED = 3, }; -namespace NBinSaverInternals { - // This lets explicitly control the overload resolution priority - // The higher P means higher priority in overload resolution order - template <int P> - struct TOverloadPriority : TOverloadPriority <P-1> { - }; - - template <> - struct TOverloadPriority<0> { - }; -} - +namespace NBinSaverInternals { + // This lets explicitly control the overload resolution priority + // The higher P means higher priority in overload resolution order + template <int P> + struct TOverloadPriority : TOverloadPriority <P-1> { + }; + + template <> + struct TOverloadPriority<0> { + }; +} + ////////////////////////////////////////////////////////////////////////// struct IBinSaver { public: @@ -63,18 +63,18 @@ private: // } // }; template <class T, typename = decltype(std::declval<T*>()->T::operator&(std::declval<IBinSaver&>()))> - void CallObjectSerialize(T* p, NBinSaverInternals::TOverloadPriority<2>) { // highest priority - will be resolved first if enabled + void CallObjectSerialize(T* p, NBinSaverInternals::TOverloadPriority<2>) { // highest priority - will be resolved first if enabled // Note: p->operator &(*this) would lead to infinite recursion p->T::operator&(*this); } template <class T, typename = decltype(std::declval<T&>() & std::declval<IBinSaver&>())> - void CallObjectSerialize(T* p, NBinSaverInternals::TOverloadPriority<1>) { // lower priority - will be resolved second if enabled + void CallObjectSerialize(T* p, NBinSaverInternals::TOverloadPriority<1>) { // lower priority - will be resolved second if enabled (*p) & (*this); } template <class T> - void CallObjectSerialize(T* p, NBinSaverInternals::TOverloadPriority<0>) { // lower priority - will be resolved last + void CallObjectSerialize(T* p, NBinSaverInternals::TOverloadPriority<0>) { // lower priority - will be resolved last #if (!defined(_MSC_VER)) // In MSVC __has_trivial_copy returns false to enums, primitive types and arrays. static_assert(__has_trivial_copy(T), "Class is nontrivial copyable, you must define operator&, see"); @@ -294,7 +294,7 @@ public: // return type of Add() is used to detect specialized serializer (see HasNonTrivialSerializer below) template <class T> char Add(const chunk_id, T* p) { - CallObjectSerialize(p, NBinSaverInternals::TOverloadPriority<2>()); + CallObjectSerialize(p, NBinSaverInternals::TOverloadPriority<2>()); return 0; } int Add(const chunk_id, std::string* pStr) { diff --git a/library/cpp/build_info/ya.make b/library/cpp/build_info/ya.make index 99886a8893..007bcbec54 100644 --- a/library/cpp/build_info/ya.make +++ b/library/cpp/build_info/ya.make @@ -6,9 +6,9 @@ OWNER( heretic ) -DEFAULT(SANDBOX_TASK_ID 0) -DEFAULT(KOSHER_SVN_VERSION "") - +DEFAULT(SANDBOX_TASK_ID 0) +DEFAULT(KOSHER_SVN_VERSION "") + CREATE_BUILDINFO_FOR(buildinfo_data.h) PEERDIR( diff --git a/library/cpp/cpuid_check/README.md b/library/cpp/cpuid_check/README.md index 9c0e8dfa59..a97ee09f58 100644 --- a/library/cpp/cpuid_check/README.md +++ b/library/cpp/cpuid_check/README.md @@ -1,13 +1,13 @@ -Simple utility to check base target x86 SIMD exensions at startup. - -Program may be built with some SIMD extension enabled (e.g. `-msse4.2`). `PEERDIR` to this library adds statrup check that machine where the program is running supports SIMD extension the program is built for. - -Currently supported check are: sse4.2, pclmul, aes, avx, avx2 and fma. - -**Note:** the library depends on `util`. -**Note:** the library adds stratup code and so if `PEERDIR`-ed from `LIBRARY` will do so for all `PROGRAM`-s that (transitively) use the `LIBRARY`. Don't do this! - +Simple utility to check base target x86 SIMD exensions at startup. + +Program may be built with some SIMD extension enabled (e.g. `-msse4.2`). `PEERDIR` to this library adds statrup check that machine where the program is running supports SIMD extension the program is built for. + +Currently supported check are: sse4.2, pclmul, aes, avx, avx2 and fma. + +**Note:** the library depends on `util`. +**Note:** the library adds stratup code and so if `PEERDIR`-ed from `LIBRARY` will do so for all `PROGRAM`-s that (transitively) use the `LIBRARY`. Don't do this! + You normally don't need to `PEERDIR` this library at all. Since making sse4 in Arcadia default this library is used implicitly. It is `PEERDIR`-ed from all `PROGRAM`-s and derived modules (e.g. `PY2_PROGRAM`, but not `GO_PROGRAM` or `JAVA_PROGRAM`). -It is also not applied to `PROGRAM`-s where `NO_UTIL()`, `NO_PLATFORM()` or `ALLOCATOR(FAKE)` set to avoid undesired dependencied. To disable this implicit check use `NO_CPU_CHECK()` macro or `-DCPU_CHECK=no` ya make flag. - - +It is also not applied to `PROGRAM`-s where `NO_UTIL()`, `NO_PLATFORM()` or `ALLOCATOR(FAKE)` set to avoid undesired dependencied. To disable this implicit check use `NO_CPU_CHECK()` macro or `-DCPU_CHECK=no` ya make flag. + + diff --git a/library/cpp/cpuid_check/cpu_id_check.cpp b/library/cpp/cpuid_check/cpu_id_check.cpp index f19a573567..dd20443dbf 100644 --- a/library/cpp/cpuid_check/cpu_id_check.cpp +++ b/library/cpp/cpuid_check/cpu_id_check.cpp @@ -1,64 +1,64 @@ -#include <util/system/compat.h> -#include <util/system/compiler.h> -#include <util/system/cpu_id.h> -#include <util/system/platform.h> - -#define Y_CPU_ID_ENUMERATE_STARTUP_CHECKS(F) \ - F(SSE42) \ - F(PCLMUL) \ - F(AES) \ - F(AVX) \ - F(AVX2) \ - F(FMA) - -namespace { - [[noreturn]] void ReportISAError(const char* isa) { - err(-1, "This program was compiled for %s which is not supported on your system, exiting...", isa); - } - -#define Y_DEF_NAME(X) \ - void Assert##X() noexcept { \ - if (!NX86::Have##X()) { \ - ReportISAError(#X); \ - } \ - } - - Y_CPU_ID_ENUMERATE_STARTUP_CHECKS(Y_DEF_NAME) -#undef Y_DEF_NAME - - class TBuildCpuChecker { - public: - TBuildCpuChecker() { - Check(); - } - - private: - void Check() const noexcept { -#if defined(_fma_) - AssertFMA(); -#elif defined(_avx2_) - AssertAVX2(); -#elif defined(_avx_) - AssertAVX(); -#elif defined(_aes_) - AssertAES(); -#elif defined(_pclmul_) - AssertPCLMUL(); -#elif defined(_sse4_2_) - AssertSSE42(); -#endif - -#define Y_DEF_NAME(X) Y_UNUSED(Assert##X); - Y_CPU_ID_ENUMERATE_STARTUP_CHECKS(Y_DEF_NAME) -#undef Y_DEF_NAME - } - }; -} - -#if defined(_x86_) && !defined(_MSC_VER) -#define INIT_PRIORITY(x) __attribute__((init_priority(x))) -#else -#define INIT_PRIORITY(x) -#endif - -const static TBuildCpuChecker CheckCpuWeAreRunningOn INIT_PRIORITY(101) ; +#include <util/system/compat.h> +#include <util/system/compiler.h> +#include <util/system/cpu_id.h> +#include <util/system/platform.h> + +#define Y_CPU_ID_ENUMERATE_STARTUP_CHECKS(F) \ + F(SSE42) \ + F(PCLMUL) \ + F(AES) \ + F(AVX) \ + F(AVX2) \ + F(FMA) + +namespace { + [[noreturn]] void ReportISAError(const char* isa) { + err(-1, "This program was compiled for %s which is not supported on your system, exiting...", isa); + } + +#define Y_DEF_NAME(X) \ + void Assert##X() noexcept { \ + if (!NX86::Have##X()) { \ + ReportISAError(#X); \ + } \ + } + + Y_CPU_ID_ENUMERATE_STARTUP_CHECKS(Y_DEF_NAME) +#undef Y_DEF_NAME + + class TBuildCpuChecker { + public: + TBuildCpuChecker() { + Check(); + } + + private: + void Check() const noexcept { +#if defined(_fma_) + AssertFMA(); +#elif defined(_avx2_) + AssertAVX2(); +#elif defined(_avx_) + AssertAVX(); +#elif defined(_aes_) + AssertAES(); +#elif defined(_pclmul_) + AssertPCLMUL(); +#elif defined(_sse4_2_) + AssertSSE42(); +#endif + +#define Y_DEF_NAME(X) Y_UNUSED(Assert##X); + Y_CPU_ID_ENUMERATE_STARTUP_CHECKS(Y_DEF_NAME) +#undef Y_DEF_NAME + } + }; +} + +#if defined(_x86_) && !defined(_MSC_VER) +#define INIT_PRIORITY(x) __attribute__((init_priority(x))) +#else +#define INIT_PRIORITY(x) +#endif + +const static TBuildCpuChecker CheckCpuWeAreRunningOn INIT_PRIORITY(101) ; diff --git a/library/cpp/cpuid_check/ya.make b/library/cpp/cpuid_check/ya.make index 9d794f3edc..359c2cc1a4 100644 --- a/library/cpp/cpuid_check/ya.make +++ b/library/cpp/cpuid_check/ya.make @@ -1,7 +1,7 @@ -LIBRARY() - -OWNER(g:util g:ymake) - -SRCS(GLOBAL cpu_id_check.cpp) - -END() +LIBRARY() + +OWNER(g:util g:ymake) + +SRCS(GLOBAL cpu_id_check.cpp) + +END() diff --git a/library/cpp/execprofile/ya.make b/library/cpp/execprofile/ya.make index 9d202ac4eb..b11251f68e 100644 --- a/library/cpp/execprofile/ya.make +++ b/library/cpp/execprofile/ya.make @@ -1,5 +1,5 @@ -OWNER(g:cpp-contrib) - +OWNER(g:cpp-contrib) + LIBRARY() SRCS( diff --git a/library/cpp/lcs/ut/ya.make b/library/cpp/lcs/ut/ya.make index 3d12898788..09432f80c7 100644 --- a/library/cpp/lcs/ut/ya.make +++ b/library/cpp/lcs/ut/ya.make @@ -1,5 +1,5 @@ -OWNER(velavokr) - +OWNER(velavokr) + UNITTEST() PEERDIR( diff --git a/library/cpp/lwtrace/tests/ya.make b/library/cpp/lwtrace/tests/ya.make index 6225ab1fa0..a6d223f206 100644 --- a/library/cpp/lwtrace/tests/ya.make +++ b/library/cpp/lwtrace/tests/ya.make @@ -1,5 +1,5 @@ -OWNER(serxa) - +OWNER(serxa) + PROGRAM() SRCS( diff --git a/library/cpp/pop_count/benchmark/ya.make b/library/cpp/pop_count/benchmark/ya.make index 7fb54a519a..6d68dfec60 100644 --- a/library/cpp/pop_count/benchmark/ya.make +++ b/library/cpp/pop_count/benchmark/ya.make @@ -1,5 +1,5 @@ -OWNER(g:util) - +OWNER(g:util) + Y_BENCHMARK() PEERDIR( diff --git a/library/cpp/retry/retry.h b/library/cpp/retry/retry.h index c47ff5070f..a47bbf2a14 100644 --- a/library/cpp/retry/retry.h +++ b/library/cpp/retry/retry.h @@ -107,7 +107,7 @@ TMaybe<TResult> DoWithRetry(std::function<TResult()> func, TRetryOptions retryOp } template <typename TException = yexception> -bool DoWithRetry(std::function<void()> func, std::function<void(const TException&)> onFail, TRetryOptions retryOptions, bool throwLast) { +bool DoWithRetry(std::function<void()> func, std::function<void(const TException&)> onFail, TRetryOptions retryOptions, bool throwLast) { auto f = [&]() { func(); return nullptr; diff --git a/library/cpp/sse/sse.h b/library/cpp/sse/sse.h index 19bac17de0..04bd1352ee 100644 --- a/library/cpp/sse/sse.h +++ b/library/cpp/sse/sse.h @@ -15,15 +15,15 @@ #include <emmintrin.h> #include <pmmintrin.h> #define ARCADIA_SSE -#if defined(_ssse3_) -#include <tmmintrin.h> -#endif -#if defined(_sse4_1_) -#include <smmintrin.h> -#endif -#if defined(_sse4_2_) -#include <nmmintrin.h> -#endif +#if defined(_ssse3_) +#include <tmmintrin.h> +#endif +#if defined(_sse4_1_) +#include <smmintrin.h> +#endif +#if defined(_sse4_2_) +#include <nmmintrin.h> +#endif #elif defined(_arm64_) #include "sse2neon.h" #define ARCADIA_SSE diff --git a/library/cpp/svnversion/test/ya.make b/library/cpp/svnversion/test/ya.make index 59c0a2d970..cf476ed37d 100644 --- a/library/cpp/svnversion/test/ya.make +++ b/library/cpp/svnversion/test/ya.make @@ -1,5 +1,5 @@ -OWNER(g:cpp-contrib) - +OWNER(g:cpp-contrib) + PROGRAM() PEERDIR(library/cpp/svnversion) SRCS(main.cpp) diff --git a/library/cpp/svnversion/ya.make b/library/cpp/svnversion/ya.make index 04e1a4c4fd..ced57cf6c5 100644 --- a/library/cpp/svnversion/ya.make +++ b/library/cpp/svnversion/ya.make @@ -1,5 +1,5 @@ -OWNER(g:cpp-contrib) - +OWNER(g:cpp-contrib) + LIBRARY() SRCS( diff --git a/library/python/certifi/ya.make b/library/python/certifi/ya.make index 64fefe2833..bedb018850 100644 --- a/library/python/certifi/ya.make +++ b/library/python/certifi/ya.make @@ -1,4 +1,4 @@ -PY23_LIBRARY() +PY23_LIBRARY() OWNER(orivej g:python-contrib) diff --git a/library/python/filelock/ut/lib/ya.make b/library/python/filelock/ut/lib/ya.make index f3f9da5a67..66861ebab4 100644 --- a/library/python/filelock/ut/lib/ya.make +++ b/library/python/filelock/ut/lib/ya.make @@ -1,6 +1,6 @@ OWNER(g:yatool) -PY23_LIBRARY() +PY23_LIBRARY() TEST_SRCS(test_filelock.py) diff --git a/library/python/filelock/ut/py2/ya.make b/library/python/filelock/ut/py2/ya.make index 30b54e0232..69123ee7b6 100644 --- a/library/python/filelock/ut/py2/ya.make +++ b/library/python/filelock/ut/py2/ya.make @@ -3,7 +3,7 @@ OWNER(g:yatool) PY2TEST() PEERDIR( - library/python/filelock/ut/lib + library/python/filelock/ut/lib ) END() diff --git a/library/python/filelock/ut/py3/ya.make b/library/python/filelock/ut/py3/ya.make index 05a856a19a..96ef14d7df 100644 --- a/library/python/filelock/ut/py3/ya.make +++ b/library/python/filelock/ut/py3/ya.make @@ -1,9 +1,9 @@ -OWNER(g:yatool) - -PY3TEST() - -PEERDIR( - library/python/filelock/ut/lib -) - -END() +OWNER(g:yatool) + +PY3TEST() + +PEERDIR( + library/python/filelock/ut/lib +) + +END() diff --git a/library/python/filelock/ut/ya.make b/library/python/filelock/ut/ya.make index 9280ea415e..bc88ee5a3e 100644 --- a/library/python/filelock/ut/ya.make +++ b/library/python/filelock/ut/ya.make @@ -1,7 +1,7 @@ -OWNER(g:yatool) - -RECURSE( - lib - py2 - py3 -) +OWNER(g:yatool) + +RECURSE( + lib + py2 + py3 +) diff --git a/library/python/fs/__init__.py b/library/python/fs/__init__.py index b1b7cde079..cdd2cd28e2 100644 --- a/library/python/fs/__init__.py +++ b/library/python/fs/__init__.py @@ -466,14 +466,14 @@ def copytree3( def walk_relative(path, topdown=True, onerror=None, followlinks=False): for dirpath, dirnames, filenames in os.walk(path, topdown=topdown, onerror=onerror, followlinks=followlinks): yield os.path.relpath(dirpath, path), dirnames, filenames + +def supports_clone(): + if 'darwin' in sys.platform: + import platform -def supports_clone(): - if 'darwin' in sys.platform: - import platform - - return list(map(int, platform.mac_ver()[0].split('.'))) >= [10, 13] - return False + return list(map(int, platform.mac_ver()[0].split('.'))) >= [10, 13] + return False def commonpath(paths): diff --git a/library/python/fs/clonefile.pyx b/library/python/fs/clonefile.pyx index 830bb894f2..c7e834a4d8 100644 --- a/library/python/fs/clonefile.pyx +++ b/library/python/fs/clonefile.pyx @@ -1,18 +1,18 @@ import six -cdef extern from "sys/clonefile.h" nogil: - int clonefile(const char * src, const char * dst, int flags) - -cdef extern from "Python.h": - ctypedef struct PyObject - cdef PyObject *PyExc_OSError - PyObject *PyErr_SetFromErrno(PyObject *) - -cdef int _macos_clone_file(const char* src, const char* dst) except? 0: - if clonefile(src, dst, 0) == -1: - PyErr_SetFromErrno(PyExc_OSError) - return 0 - return 1 - -def macos_clone_file(src, dst): +cdef extern from "sys/clonefile.h" nogil: + int clonefile(const char * src, const char * dst, int flags) + +cdef extern from "Python.h": + ctypedef struct PyObject + cdef PyObject *PyExc_OSError + PyObject *PyErr_SetFromErrno(PyObject *) + +cdef int _macos_clone_file(const char* src, const char* dst) except? 0: + if clonefile(src, dst, 0) == -1: + PyErr_SetFromErrno(PyExc_OSError) + return 0 + return 1 + +def macos_clone_file(src, dst): return _macos_clone_file(six.ensure_binary(src), six.ensure_binary(dst)) != 0 diff --git a/library/python/fs/ya.make b/library/python/fs/ya.make index b3c5092c71..70a2dadb4f 100644 --- a/library/python/fs/ya.make +++ b/library/python/fs/ya.make @@ -2,16 +2,16 @@ OWNER(g:yatool) PY23_LIBRARY() -PY_SRCS( - __init__.py -) - -IF (OS_DARWIN) - PY_SRCS( - clonefile.pyx - ) -ENDIF() +PY_SRCS( + __init__.py +) +IF (OS_DARWIN) + PY_SRCS( + clonefile.pyx + ) +ENDIF() + PEERDIR( library/python/func library/python/strings diff --git a/library/python/resource/__init__.py b/library/python/resource/__init__.py index 26503ef7fc..fdf7ea4850 100644 --- a/library/python/resource/__init__.py +++ b/library/python/resource/__init__.py @@ -3,7 +3,7 @@ from __res import resfs_read, resfs_resolve, resfs_src # noqa import six - + def iterkeys(prefix='', strip_prefix=False): decode = lambda s: s if isinstance(prefix, six.text_type): diff --git a/library/python/resource/ut/py3/ya.make b/library/python/resource/ut/py3/ya.make index 64eb2e83ce..5bcde62e2b 100644 --- a/library/python/resource/ut/py3/ya.make +++ b/library/python/resource/ut/py3/ya.make @@ -1,9 +1,9 @@ -PY3TEST() - +PY3TEST() + OWNER(pg) - -PEERDIR( + +PEERDIR( library/python/resource/ut/lib -) - -END() +) + +END() diff --git a/library/python/resource/ut/ya.make b/library/python/resource/ut/ya.make index a5ec192d74..92185ec976 100644 --- a/library/python/resource/ut/ya.make +++ b/library/python/resource/ut/ya.make @@ -1,6 +1,6 @@ OWNER(pg) -RECURSE( - py2 - py3 +RECURSE( + py2 + py3 ) diff --git a/library/python/resource/ya.make b/library/python/resource/ya.make index 989329fa4b..bc1ee77fe1 100644 --- a/library/python/resource/ya.make +++ b/library/python/resource/ya.make @@ -1,4 +1,4 @@ -PY23_LIBRARY() +PY23_LIBRARY() OWNER(pg) diff --git a/library/python/runtime_py3/importer.pxi b/library/python/runtime_py3/importer.pxi index 904f94dea2..fd0d286fda 100644 --- a/library/python/runtime_py3/importer.pxi +++ b/library/python/runtime_py3/importer.pxi @@ -110,8 +110,8 @@ def iter_py_modules(with_keys=False): yield key, mod else: yield mod - - + + def iter_prefixes(s): i = s.find('.') while i >= 0: @@ -119,7 +119,7 @@ def iter_prefixes(s): i = s.find('.', i + 1) -def resfs_resolve(path): +def resfs_resolve(path): """ Return the absolute path of a root-relative path if it exists. """ @@ -140,7 +140,7 @@ def resfs_src(key, resfs_file=False): return __resource.find(b'resfs/src/' + _b(key)) -def resfs_read(path, builtin=None): +def resfs_read(path, builtin=None): """ Return the bytes of the resource file at path, or None. If builtin is True, do not look for it on the filesystem. @@ -165,11 +165,11 @@ def resfs_files(prefix=b''): def mod_path(mod): - """ + """ Return the resfs path to the source code of the module with the given name. - """ + """ return py_prefix + _b(mod).replace(b'.', b'/') + b'.py' - + class ResourceImporter(object): @@ -279,12 +279,12 @@ class ResourceImporter(object): data = file_bytes(abspath) return compile(data, _s(abspath), 'exec', dont_inherit=True) - yapyc_path = path + b'.yapyc3' - yapyc_data = resfs_read(yapyc_path, builtin=True) + yapyc_path = path + b'.yapyc3' + yapyc_data = resfs_read(yapyc_path, builtin=True) if yapyc_data: return marshal.loads(yapyc_data) else: - py_data = resfs_read(path, builtin=True) + py_data = resfs_read(path, builtin=True) if py_data: return compile(py_data, _s(relpath), 'exec', dont_inherit=True) else: diff --git a/library/python/runtime_py3/ya.make b/library/python/runtime_py3/ya.make index fa5c11341a..a3b8a8b4d1 100644 --- a/library/python/runtime_py3/ya.make +++ b/library/python/runtime_py3/ya.make @@ -1,4 +1,4 @@ -PY3_LIBRARY() +PY3_LIBRARY() OWNER( borman @@ -20,7 +20,7 @@ NO_PYTHON_INCLUDES() ENABLE(PYBUILD_NO_PYC) -PY_SRCS( +PY_SRCS( entry_points.py TOP_LEVEL |