aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorthegeorg <thegeorg@yandex-team.ru>2022-03-03 13:53:18 +0300
committerthegeorg <thegeorg@yandex-team.ru>2022-03-03 13:53:18 +0300
commit75b363ad9be455d895aee7f72f45be2d950d3518 (patch)
treeceef86b4a2c864b1a962dab41a8cd8b3f3ab0bc3
parent473e96c44443a8567db5ba7ee48110663fcb21c7 (diff)
downloadydb-75b363ad9be455d895aee7f72f45be2d950d3518.tar.gz
Support std::filesystem::path in Arcadia streams
ref:11bbdd83544b9579747dd12d51395840bda86faf
-rw-r--r--build/ymake.core.conf3
-rw-r--r--contrib/libs/cxxsupp/libcxx/src/filesystem/filesystem_common.h10
-rw-r--r--util/stream/output.cpp11
-rw-r--r--util/string/cast.cpp11
-rw-r--r--util/system/filemap.h2
5 files changed, 34 insertions, 3 deletions
diff --git a/build/ymake.core.conf b/build/ymake.core.conf
index 97ffbb8c39..f515d457a3 100644
--- a/build/ymake.core.conf
+++ b/build/ymake.core.conf
@@ -1334,6 +1334,9 @@ module _BASE_UNIT: _BARE_UNIT {
when ($USE_INTERNAL_STL == "yes" && $MSVC != "yes") {
CXXFLAGS += -nostdinc++
}
+ otherwise {
+ CFLAGS += -DUSE_STL_SYSTEM
+ }
when ($CODENAVIGATION && $NOCODENAVIGATION != "yes") {
PEERDIR += build/external_resources/codenavigation
diff --git a/contrib/libs/cxxsupp/libcxx/src/filesystem/filesystem_common.h b/contrib/libs/cxxsupp/libcxx/src/filesystem/filesystem_common.h
index a5f5749783..9c6fdf34f6 100644
--- a/contrib/libs/cxxsupp/libcxx/src/filesystem/filesystem_common.h
+++ b/contrib/libs/cxxsupp/libcxx/src/filesystem/filesystem_common.h
@@ -128,6 +128,16 @@ size_t error_value<size_t>() {
return size_t(-1);
}
#endif
+
+#if defined(_MSC_VER) && !defined(__clang__) && defined(_M_IX86)
+// FIXME thegeorg@ MSVC on i686 somehow depends on this function presence.
+// Further investigation is needed in order to understand the logic behind this.
+template <>
+unsigned int error_value<unsigned int>() {
+ return unsigned int(-1);
+}
+#endif
+
template <>
uintmax_t error_value<uintmax_t>() {
return uintmax_t(-1);
diff --git a/util/stream/output.cpp b/util/stream/output.cpp
index db81b81b70..d84b3ad4d0 100644
--- a/util/stream/output.cpp
+++ b/util/stream/output.cpp
@@ -16,9 +16,10 @@
#endif
#include <cerrno>
+#include <cstdio>
+#include <filesystem>
#include <string>
#include <string_view>
-#include <cstdio>
#if defined(_win_)
#include <io.h>
@@ -114,6 +115,14 @@ void Out<std::u32string_view>(IOutputStream& o, const std::u32string_view& p) {
WriteString(o, p.data(), p.length());
}
+#ifndef USE_STL_SYSTEM
+// FIXME thegeorg@: remove #ifndef upon raising minimal macOS version to 10.15 in https://st.yandex-team.ru/DTCC-836
+template <>
+void Out<std::filesystem::path>(IOutputStream& o, const std::filesystem::path& p) {
+ o.Write(p.string());
+}
+#endif
+
template <>
void Out<TStringBuf>(IOutputStream& o, const TStringBuf& p) {
o.Write(p.data(), p.length());
diff --git a/util/string/cast.cpp b/util/string/cast.cpp
index 939a3e7a92..4cd940f57b 100644
--- a/util/string/cast.cpp
+++ b/util/string/cast.cpp
@@ -4,9 +4,10 @@
#define __LONG_LONG_SUPPORTED
#endif
+#include <cmath>
#include <cstdio>
+#include <filesystem>
#include <string>
-#include <cmath>
#include <util/string/type.h>
#include <util/string/cast.h>
@@ -531,6 +532,14 @@ std::string FromStringImpl<std::string>(const char* data, size_t len) {
return std::string(data, len);
}
+#ifndef USE_STL_SYSTEM
+// FIXME thegeorg@: remove #ifndef upon raising minimal macOS version to 10.15 in https://st.yandex-team.ru/DTCC-836
+template <>
+std::filesystem::path FromStringImpl<std::filesystem::path>(const char* data, size_t len) {
+ return std::filesystem::path(std::string(data, len));
+}
+#endif
+
template <>
TUtf16String FromStringImpl<TUtf16String>(const wchar16* data, size_t len) {
return TUtf16String(data, len);
diff --git a/util/system/filemap.h b/util/system/filemap.h
index edae96228b..f66b70c96c 100644
--- a/util/system/filemap.h
+++ b/util/system/filemap.h
@@ -296,7 +296,7 @@ public:
TMappedAllocation(TMappedAllocation&& other) noexcept {
this->swap(other);
}
- TMappedAllocation& operator = (TMappedAllocation&& other)noexcept {
+ TMappedAllocation& operator=(TMappedAllocation&& other) noexcept {
this->swap(other);
return *this;
}