diff options
author | Andrey Khalyavin <halyavin@gmail.com> | 2022-07-05 23:56:28 +0300 |
---|---|---|
committer | Andrey Khalyavin <halyavin@gmail.com> | 2022-07-05 23:56:28 +0300 |
commit | 41223d67bc008890be4c26f2860a749faad77d15 (patch) | |
tree | a31baff5f563db0e7f6bc0699f1a3f8b6e461311 /contrib/libs/cxxsupp/libcxx/src | |
parent | 7cca6053f9af9db0dce2fc1c9bf1bad0910cdceb (diff) | |
download | ydb-41223d67bc008890be4c26f2860a749faad77d15.tar.gz |
Update libc++ to a7c2a628 (15 Feb 2022).
Notable changes:
* macros for disabling and enabling compile warnings
* replace _VSTD with std in __ranges
* add stdatomic.h
* implement unreachable()
* implement ranges::rbegin, rend, crbegin and crend
* remove experimental/filesystem header
ref:3104f711bf2401dd8b882290fa4fa01f71924406
Diffstat (limited to 'contrib/libs/cxxsupp/libcxx/src')
10 files changed, 39 insertions, 51 deletions
diff --git a/contrib/libs/cxxsupp/libcxx/src/filesystem/filesystem_common.h b/contrib/libs/cxxsupp/libcxx/src/filesystem/filesystem_common.h index b693476518..4e117c3f19 100644 --- a/contrib/libs/cxxsupp/libcxx/src/filesystem/filesystem_common.h +++ b/contrib/libs/cxxsupp/libcxx/src/filesystem/filesystem_common.h @@ -14,11 +14,11 @@ #include "chrono" #include "climits" #include "cstdarg" -#include "cstdlib" #include "ctime" #include "filesystem" #include "ratio" #include "system_error" +#include <utility> #if defined(_LIBCPP_WIN32API) # define WIN32_LEAN_AND_MEAN @@ -188,7 +188,7 @@ struct ErrorHandler { case 2: __throw_filesystem_error(what, *p1_, *p2_, ec); } - _LIBCPP_UNREACHABLE(); + __libcpp_unreachable(); } _LIBCPP_ATTRIBUTE_FORMAT(__printf__, 3, 0) @@ -207,7 +207,7 @@ struct ErrorHandler { case 2: __throw_filesystem_error(what, *p1_, *p2_, ec); } - _LIBCPP_UNREACHABLE(); + __libcpp_unreachable(); } _LIBCPP_ATTRIBUTE_FORMAT(__printf__, 3, 4) diff --git a/contrib/libs/cxxsupp/libcxx/src/filesystem/operations.cpp b/contrib/libs/cxxsupp/libcxx/src/filesystem/operations.cpp index 8e1a8ef1ab..39777a316a 100644 --- a/contrib/libs/cxxsupp/libcxx/src/filesystem/operations.cpp +++ b/contrib/libs/cxxsupp/libcxx/src/filesystem/operations.cpp @@ -6,6 +6,7 @@ // //===----------------------------------------------------------------------===// +#include <__utility/unreachable.h> #include "filesystem" #include "array" #include "iterator" @@ -154,7 +155,7 @@ public: return makeState(PS_AtEnd); case PS_AtEnd: - _LIBCPP_UNREACHABLE(); + __libcpp_unreachable(); } } @@ -202,7 +203,7 @@ public: return makeState(PS_InRootName, Path.data(), RStart + 1); case PS_InRootName: case PS_BeforeBegin: - _LIBCPP_UNREACHABLE(); + __libcpp_unreachable(); } } @@ -224,7 +225,7 @@ public: case PS_InFilenames: return RawEntry; } - _LIBCPP_UNREACHABLE(); + __libcpp_unreachable(); } explicit operator bool() const noexcept { @@ -285,7 +286,7 @@ private: case PS_AtEnd: return getAfterBack(); } - _LIBCPP_UNREACHABLE(); + __libcpp_unreachable(); } /// \brief Return a pointer to the first character in the currently lexed @@ -302,7 +303,7 @@ private: case PS_AtEnd: return &Path.back() + 1; } - _LIBCPP_UNREACHABLE(); + __libcpp_unreachable(); } // Consume all consecutive separators. @@ -685,7 +686,7 @@ void filesystem_error::__create_what(int __num_paths) { return detail::format_string("filesystem error: %s [" PATH_CSTR_FMT "] [" PATH_CSTR_FMT "]", derived_what, path1().c_str(), path2().c_str()); } - _LIBCPP_UNREACHABLE(); + __libcpp_unreachable(); }(); } @@ -1192,7 +1193,7 @@ bool __fs_is_empty(const path& p, error_code* ec) { } else if (is_regular_file(st)) return static_cast<uintmax_t>(pst.st_size) == 0; - _LIBCPP_UNREACHABLE(); + __libcpp_unreachable(); } static file_time_type __extract_last_write_time(const path& p, const StatT& st, @@ -1805,7 +1806,7 @@ path path::lexically_normal() const { break; } case PK_None: - _LIBCPP_UNREACHABLE(); + __libcpp_unreachable(); } } // [fs.path.generic]p6.8: If the path is empty, add a dot. diff --git a/contrib/libs/cxxsupp/libcxx/src/future.cpp b/contrib/libs/cxxsupp/libcxx/src/future.cpp index 177fe7523e..07ae9389ec 100644 --- a/contrib/libs/cxxsupp/libcxx/src/future.cpp +++ b/contrib/libs/cxxsupp/libcxx/src/future.cpp @@ -29,13 +29,9 @@ __future_error_category::name() const noexcept return "future"; } -#if defined(__clang__) -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wswitch" -#elif defined(__GNUC__) || defined(__GNUG__) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wswitch" -#endif +_LIBCPP_DIAGNOSTIC_PUSH +_LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wswitch") +_LIBCPP_GCC_DIAGNOSTIC_IGNORED("-Wswitch") string __future_error_category::message(int ev) const @@ -58,11 +54,7 @@ __future_error_category::message(int ev) const return string("unspecified future_errc value\n"); } -#if defined(__clang__) -#pragma clang diagnostic pop -#elif defined(__GNUC__) || defined(__GNUG__) -#pragma GCC diagnostic pop -#endif +_LIBCPP_DIAGNOSTIC_POP const error_category& future_category() noexcept diff --git a/contrib/libs/cxxsupp/libcxx/src/hash.cpp b/contrib/libs/cxxsupp/libcxx/src/hash.cpp index b8e921ad06..daf276f5b7 100644 --- a/contrib/libs/cxxsupp/libcxx/src/hash.cpp +++ b/contrib/libs/cxxsupp/libcxx/src/hash.cpp @@ -11,9 +11,7 @@ #include "stdexcept" #include "type_traits" -#ifdef __clang__ -#pragma clang diagnostic ignored "-Wtautological-constant-out-of-range-compare" -#endif +_LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wtautological-constant-out-of-range-compare") _LIBCPP_BEGIN_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/src/include/ryu/d2s_intrinsics.h b/contrib/libs/cxxsupp/libcxx/src/include/ryu/d2s_intrinsics.h index 95912818ac..756fe1e831 100644 --- a/contrib/libs/cxxsupp/libcxx/src/include/ryu/d2s_intrinsics.h +++ b/contrib/libs/cxxsupp/libcxx/src/include/ryu/d2s_intrinsics.h @@ -46,6 +46,8 @@ #include "include/ryu/ryu.h" +#include "include/ryu/ryu.h" + _LIBCPP_BEGIN_NAMESPACE_STD #if defined(_M_X64) && defined(_MSC_VER) diff --git a/contrib/libs/cxxsupp/libcxx/src/include/ryu/ryu.h b/contrib/libs/cxxsupp/libcxx/src/include/ryu/ryu.h index 78c04e81ab..cfd5303472 100644 --- a/contrib/libs/cxxsupp/libcxx/src/include/ryu/ryu.h +++ b/contrib/libs/cxxsupp/libcxx/src/include/ryu/ryu.h @@ -68,7 +68,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD // https://github.com/ulfjack/ryu/tree/59661c3/ryu -#if !defined(_LIBCPP_COMPILER_MSVC) +#if !defined(_MSC_VER) _LIBCPP_HIDE_FROM_ABI inline unsigned char _BitScanForward64(unsigned long* __index, unsigned long long __mask) { if (__mask == 0) { return false; @@ -84,7 +84,7 @@ _LIBCPP_HIDE_FROM_ABI inline unsigned char _BitScanForward(unsigned long* __inde *__index = __builtin_ctz(__mask); return true; } -#endif // _LIBCPP_COMPILER_MSVC +#endif // !_MSC_VER template <class _Floating> [[nodiscard]] to_chars_result _Floating_to_chars_ryu( diff --git a/contrib/libs/cxxsupp/libcxx/src/locale.cpp b/contrib/libs/cxxsupp/libcxx/src/locale.cpp index c9ecfb24ff..92fd8d7445 100644 --- a/contrib/libs/cxxsupp/libcxx/src/locale.cpp +++ b/contrib/libs/cxxsupp/libcxx/src/locale.cpp @@ -12,6 +12,8 @@ #define _LCONV_C99 #endif +#include <__utility/unreachable.h> +#include "algorithm" #include "clocale" #include "codecvt" #include "cstdio" @@ -46,9 +48,7 @@ // On Linux, wint_t and wchar_t have different signed-ness, and this causes // lots of noise in the build log, but no bugs that I know of. -#if defined(__clang__) -#pragma clang diagnostic ignored "-Wsign-conversion" -#endif +_LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wsign-conversion") _LIBCPP_BEGIN_NAMESPACE_STD @@ -4641,7 +4641,7 @@ static bool checked_string_to_char_convert(char& dest, return false; #endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS - _LIBCPP_UNREACHABLE(); + __libcpp_unreachable(); } @@ -5218,12 +5218,8 @@ __time_get::~__time_get() { freelocale(__loc_); } -#if defined(__clang__) -#pragma clang diagnostic ignored "-Wmissing-field-initializers" -#endif -#if defined(__GNUG__) -#pragma GCC diagnostic ignored "-Wmissing-field-initializers" -#endif + +_LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wmissing-field-initializers") template <> string @@ -5369,9 +5365,7 @@ __time_get_storage<char>::__analyze(char fmt, const ctype<char>& ct) return result; } -#if defined(__clang__) -#pragma clang diagnostic ignored "-Wmissing-braces" -#endif +_LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wmissing-braces") #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS template <> diff --git a/contrib/libs/cxxsupp/libcxx/src/strstream.cpp b/contrib/libs/cxxsupp/libcxx/src/strstream.cpp index e62c07768b..fe7e2d4120 100644 --- a/contrib/libs/cxxsupp/libcxx/src/strstream.cpp +++ b/contrib/libs/cxxsupp/libcxx/src/strstream.cpp @@ -6,6 +6,7 @@ // //===----------------------------------------------------------------------===// +#include <__utility/unreachable.h> #include "strstream" #include "algorithm" #include "climits" @@ -268,7 +269,7 @@ strstreambuf::seekoff(off_type __off, ios_base::seekdir __way, ios_base::openmod newoff = seekhigh - eback(); break; default: - _LIBCPP_UNREACHABLE(); + __libcpp_unreachable(); } newoff += __off; if (0 <= newoff && newoff <= seekhigh - eback()) diff --git a/contrib/libs/cxxsupp/libcxx/src/support/win32/locale_win32.cpp b/contrib/libs/cxxsupp/libcxx/src/support/win32/locale_win32.cpp index 43e5c9a572..67f4d1341a 100644 --- a/contrib/libs/cxxsupp/libcxx/src/support/win32/locale_win32.cpp +++ b/contrib/libs/cxxsupp/libcxx/src/support/win32/locale_win32.cpp @@ -97,10 +97,10 @@ int snprintf_l(char *ret, size_t n, locale_t loc, const char *format, ...) ret, n, format, loc, ap); #else __libcpp_locale_guard __current(loc); -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wformat-nonliteral" + _LIBCPP_DIAGNOSTIC_PUSH + _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wformat-nonliteral") int result = vsnprintf( ret, n, format, ap ); -#pragma clang diagnostic pop + _LIBCPP_DIAGNOSTIC_POP #endif va_end(ap); return result; diff --git a/contrib/libs/cxxsupp/libcxx/src/support/win32/support.cpp b/contrib/libs/cxxsupp/libcxx/src/support/win32/support.cpp index 6d4b371f3d..dbec4083cb 100644 --- a/contrib/libs/cxxsupp/libcxx/src/support/win32/support.cpp +++ b/contrib/libs/cxxsupp/libcxx/src/support/win32/support.cpp @@ -23,10 +23,10 @@ int __libcpp_vasprintf( char **sptr, const char *__restrict format, va_list ap ) // Query the count required. va_list ap_copy; va_copy(ap_copy, ap); -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wformat-nonliteral" + _LIBCPP_DIAGNOSTIC_PUSH + _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wformat-nonliteral") int count = vsnprintf( NULL, 0, format, ap_copy ); -#pragma clang diagnostic pop + _LIBCPP_DIAGNOSTIC_POP va_end(ap_copy); if (count < 0) return count; @@ -36,10 +36,10 @@ int __libcpp_vasprintf( char **sptr, const char *__restrict format, va_list ap ) return -1; // If we haven't used exactly what was required, something is wrong. // Maybe bug in vsnprintf. Report the error and return. -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wformat-nonliteral" + _LIBCPP_DIAGNOSTIC_PUSH + _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wformat-nonliteral") if (vsnprintf(p, buffer_size, format, ap) != count) { -#pragma clang diagnostic pop + _LIBCPP_DIAGNOSTIC_POP free(p); return -1; } |