mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-03 19:22:27 +00:00
Release Cosmopolitan v3.6.0
This release is an atomic upgrade to GCC 14.1.0 with C23 and C++23
This commit is contained in:
parent
62ace3623a
commit
5660ec4741
1585 changed files with 117353 additions and 271644 deletions
69
third_party/libcxx/__filesystem/u8path.h
vendored
69
third_party/libcxx/__filesystem/u8path.h
vendored
|
@ -11,7 +11,6 @@
|
|||
#define _LIBCPP___FILESYSTEM_U8PATH_H
|
||||
|
||||
#include <__algorithm/unwrap_iter.h>
|
||||
#include <__availability>
|
||||
#include <__config>
|
||||
#include <__filesystem/path.h>
|
||||
#include <string>
|
||||
|
@ -19,52 +18,48 @@
|
|||
// Only required on Windows for __widen_from_utf8, and included conservatively
|
||||
// because it requires support for localization.
|
||||
#if defined(_LIBCPP_WIN32API)
|
||||
# include <locale>
|
||||
# include <locale>
|
||||
#endif
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
# pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
#if _LIBCPP_STD_VER >= 17
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
|
||||
|
||||
_LIBCPP_AVAILABILITY_FILESYSTEM_PUSH
|
||||
_LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY_PUSH
|
||||
|
||||
template <class _InputIt>
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_DEPRECATED_WITH_CHAR8_T
|
||||
typename enable_if<__is_pathable<_InputIt>::value, path>::type
|
||||
u8path(_InputIt __f, _InputIt __l) {
|
||||
template <class _InputIt, __enable_if_t<__is_pathable<_InputIt>::value, int> = 0>
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_DEPRECATED_WITH_CHAR8_T path u8path(_InputIt __f, _InputIt __l) {
|
||||
static_assert(
|
||||
#ifndef _LIBCPP_HAS_NO_CHAR8_T
|
||||
# ifndef _LIBCPP_HAS_NO_CHAR8_T
|
||||
is_same<typename __is_pathable<_InputIt>::__char_type, char8_t>::value ||
|
||||
#endif
|
||||
is_same<typename __is_pathable<_InputIt>::__char_type, char>::value,
|
||||
# endif
|
||||
is_same<typename __is_pathable<_InputIt>::__char_type, char>::value,
|
||||
"u8path(Iter, Iter) requires Iter have a value_type of type 'char'"
|
||||
" or 'char8_t'");
|
||||
#if defined(_LIBCPP_WIN32API)
|
||||
# if defined(_LIBCPP_WIN32API)
|
||||
string __tmp(__f, __l);
|
||||
using _CVT = __widen_from_utf8<sizeof(wchar_t) * __CHAR_BIT__>;
|
||||
_VSTD::wstring __w;
|
||||
std::wstring __w;
|
||||
__w.reserve(__tmp.size());
|
||||
_CVT()(back_inserter(__w), __tmp.data(), __tmp.data() + __tmp.size());
|
||||
return path(__w);
|
||||
#else
|
||||
# else
|
||||
return path(__f, __l);
|
||||
#endif /* !_LIBCPP_WIN32API */
|
||||
# endif /* !_LIBCPP_WIN32API */
|
||||
}
|
||||
|
||||
#if defined(_LIBCPP_WIN32API)
|
||||
template <class _InputIt>
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_DEPRECATED_WITH_CHAR8_T
|
||||
typename enable_if<__is_pathable<_InputIt>::value, path>::type
|
||||
u8path(_InputIt __f, _NullSentinel) {
|
||||
# if defined(_LIBCPP_WIN32API)
|
||||
template <class _InputIt, __enable_if_t<__is_pathable<_InputIt>::value, int> = 0>
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_DEPRECATED_WITH_CHAR8_T path u8path(_InputIt __f, _NullSentinel) {
|
||||
static_assert(
|
||||
#ifndef _LIBCPP_HAS_NO_CHAR8_T
|
||||
# ifndef _LIBCPP_HAS_NO_CHAR8_T
|
||||
is_same<typename __is_pathable<_InputIt>::__char_type, char8_t>::value ||
|
||||
#endif
|
||||
is_same<typename __is_pathable<_InputIt>::__char_type, char>::value,
|
||||
# endif
|
||||
is_same<typename __is_pathable<_InputIt>::__char_type, char>::value,
|
||||
"u8path(Iter, Iter) requires Iter have a value_type of type 'char'"
|
||||
" or 'char8_t'");
|
||||
string __tmp;
|
||||
|
@ -72,36 +67,34 @@ _LIBCPP_INLINE_VISIBILITY _LIBCPP_DEPRECATED_WITH_CHAR8_T
|
|||
for (; *__f != __sentinel; ++__f)
|
||||
__tmp.push_back(*__f);
|
||||
using _CVT = __widen_from_utf8<sizeof(wchar_t) * __CHAR_BIT__>;
|
||||
_VSTD::wstring __w;
|
||||
std::wstring __w;
|
||||
__w.reserve(__tmp.size());
|
||||
_CVT()(back_inserter(__w), __tmp.data(), __tmp.data() + __tmp.size());
|
||||
return path(__w);
|
||||
}
|
||||
#endif /* _LIBCPP_WIN32API */
|
||||
# endif /* _LIBCPP_WIN32API */
|
||||
|
||||
template <class _Source>
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_DEPRECATED_WITH_CHAR8_T
|
||||
typename enable_if<__is_pathable<_Source>::value, path>::type
|
||||
u8path(const _Source& __s) {
|
||||
template <class _Source, __enable_if_t<__is_pathable<_Source>::value, int> = 0>
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_DEPRECATED_WITH_CHAR8_T path u8path(const _Source& __s) {
|
||||
static_assert(
|
||||
#ifndef _LIBCPP_HAS_NO_CHAR8_T
|
||||
# ifndef _LIBCPP_HAS_NO_CHAR8_T
|
||||
is_same<typename __is_pathable<_Source>::__char_type, char8_t>::value ||
|
||||
#endif
|
||||
is_same<typename __is_pathable<_Source>::__char_type, char>::value,
|
||||
# endif
|
||||
is_same<typename __is_pathable<_Source>::__char_type, char>::value,
|
||||
"u8path(Source const&) requires Source have a character type of type "
|
||||
"'char' or 'char8_t'");
|
||||
#if defined(_LIBCPP_WIN32API)
|
||||
# if defined(_LIBCPP_WIN32API)
|
||||
using _Traits = __is_pathable<_Source>;
|
||||
return u8path(_VSTD::__unwrap_iter(_Traits::__range_begin(__s)), _VSTD::__unwrap_iter(_Traits::__range_end(__s)));
|
||||
#else
|
||||
return u8path(std::__unwrap_iter(_Traits::__range_begin(__s)), std::__unwrap_iter(_Traits::__range_end(__s)));
|
||||
# else
|
||||
return path(__s);
|
||||
#endif
|
||||
# endif
|
||||
}
|
||||
|
||||
_LIBCPP_AVAILABILITY_FILESYSTEM_POP
|
||||
_LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY_POP
|
||||
|
||||
_LIBCPP_END_NAMESPACE_FILESYSTEM
|
||||
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
#endif // _LIBCPP_STD_VER >= 17
|
||||
|
||||
#endif // _LIBCPP___FILESYSTEM_U8PATH_H
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue