diff options
Diffstat (limited to 'libcxx/src')
-rw-r--r-- | libcxx/src/algorithm.cpp | 2 | ||||
-rw-r--r-- | libcxx/src/call_once.cpp | 10 | ||||
-rw-r--r-- | libcxx/src/chrono.cpp | 4 | ||||
-rw-r--r-- | libcxx/src/experimental/include/tzdb/tzdb_list_private.h | 12 | ||||
-rw-r--r-- | libcxx/src/filesystem/time_utils.h | 4 | ||||
-rw-r--r-- | libcxx/src/include/atomic_support.h | 8 | ||||
-rw-r--r-- | libcxx/src/include/config_elast.h | 2 | ||||
-rw-r--r-- | libcxx/src/ios.cpp | 2 | ||||
-rw-r--r-- | libcxx/src/ios.instantiations.cpp | 4 | ||||
-rw-r--r-- | libcxx/src/iostream.cpp | 20 | ||||
-rw-r--r-- | libcxx/src/locale.cpp | 188 | ||||
-rw-r--r-- | libcxx/src/memory.cpp | 6 | ||||
-rw-r--r-- | libcxx/src/memory_resource.cpp | 4 | ||||
-rw-r--r-- | libcxx/src/ostream.cpp | 4 | ||||
-rw-r--r-- | libcxx/src/print.cpp | 4 | ||||
-rw-r--r-- | libcxx/src/random_shuffle.cpp | 8 | ||||
-rw-r--r-- | libcxx/src/std_stream.h | 6 | ||||
-rw-r--r-- | libcxx/src/string.cpp | 26 | ||||
-rw-r--r-- | libcxx/src/system_error.cpp | 6 |
19 files changed, 160 insertions, 160 deletions
diff --git a/libcxx/src/algorithm.cpp b/libcxx/src/algorithm.cpp index a7c39b5..d388fee 100644 --- a/libcxx/src/algorithm.cpp +++ b/libcxx/src/algorithm.cpp @@ -26,7 +26,7 @@ void __sort(RandomAccessIterator first, RandomAccessIterator last, Comp comp) { // clang-format off template void __sort<__less<char>&, char*>(char*, char*, __less<char>&); -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS template void __sort<__less<wchar_t>&, wchar_t*>(wchar_t*, wchar_t*, __less<wchar_t>&); #endif template void __sort<__less<signed char>&, signed char*>(signed char*, signed char*, __less<signed char>&); diff --git a/libcxx/src/call_once.cpp b/libcxx/src/call_once.cpp index 5744347..a398eae 100644 --- a/libcxx/src/call_once.cpp +++ b/libcxx/src/call_once.cpp @@ -9,7 +9,7 @@ #include <__mutex/once_flag.h> #include <__utility/exception_guard.h> -#ifndef _LIBCPP_HAS_NO_THREADS +#if _LIBCPP_HAS_THREADS # include <__thread/support.h> #endif @@ -23,13 +23,13 @@ _LIBCPP_BEGIN_NAMESPACE_STD // call into dispatch_once_f instead of here. Relevant radar this code needs to // keep in sync with: 7741191. -#ifndef _LIBCPP_HAS_NO_THREADS +#if _LIBCPP_HAS_THREADS static constinit __libcpp_mutex_t mut = _LIBCPP_MUTEX_INITIALIZER; static constinit __libcpp_condvar_t cv = _LIBCPP_CONDVAR_INITIALIZER; #endif void __call_once(volatile once_flag::_State_type& flag, void* arg, void (*func)(void*)) { -#if defined(_LIBCPP_HAS_NO_THREADS) +#if !_LIBCPP_HAS_THREADS if (flag == once_flag::_Unset) { auto guard = std::__make_exception_guard([&flag] { flag = once_flag::_Unset; }); @@ -39,7 +39,7 @@ void __call_once(volatile once_flag::_State_type& flag, void* arg, void (*func)( guard.__complete(); } -#else // !_LIBCPP_HAS_NO_THREADS +#else // !_LIBCPP_HAS_THREADS __libcpp_mutex_lock(&mut); while (flag == once_flag::_Pending) @@ -64,7 +64,7 @@ void __call_once(volatile once_flag::_State_type& flag, void* arg, void (*func)( __libcpp_mutex_unlock(&mut); } -#endif // !_LIBCPP_HAS_NO_THREADS +#endif // !_LIBCPP_HAS_THREADS } _LIBCPP_END_NAMESPACE_STD diff --git a/libcxx/src/chrono.cpp b/libcxx/src/chrono.cpp index 986360d..f17ea55 100644 --- a/libcxx/src/chrono.cpp +++ b/libcxx/src/chrono.cpp @@ -152,7 +152,7 @@ system_clock::time_point system_clock::from_time_t(time_t t) noexcept { return s // instead. // -#ifndef _LIBCPP_HAS_NO_MONOTONIC_CLOCK +#if _LIBCPP_HAS_MONOTONIC_CLOCK # if defined(__APPLE__) @@ -230,7 +230,7 @@ const bool steady_clock::is_steady; steady_clock::time_point steady_clock::now() noexcept { return __libcpp_steady_clock_now(); } -#endif // !_LIBCPP_HAS_NO_MONOTONIC_CLOCK +#endif // _LIBCPP_HAS_MONOTONIC_CLOCK } // namespace chrono diff --git a/libcxx/src/experimental/include/tzdb/tzdb_list_private.h b/libcxx/src/experimental/include/tzdb/tzdb_list_private.h index 0be7b8e..ead64e6 100644 --- a/libcxx/src/experimental/include/tzdb/tzdb_list_private.h +++ b/libcxx/src/experimental/include/tzdb/tzdb_list_private.h @@ -18,7 +18,7 @@ // When threads are available, we use std::mutex over std::shared_mutex // due to the increased overhead of std::shared_mutex. // See shared_mutex_vs_mutex.bench.cpp -#ifndef _LIBCPP_HAS_NO_THREADS +#if _LIBCPP_HAS_THREADS # include <mutex> #endif @@ -48,7 +48,7 @@ public: __impl() { __load_no_lock(); } [[nodiscard]] const tzdb& __load() { -#ifndef _LIBCPP_HAS_NO_THREADS +#if _LIBCPP_HAS_THREADS unique_lock __lock{__mutex_}; #endif __load_no_lock(); @@ -58,14 +58,14 @@ public: using const_iterator = tzdb_list::const_iterator; const tzdb& __front() const noexcept { -#ifndef _LIBCPP_HAS_NO_THREADS +#if _LIBCPP_HAS_THREADS unique_lock __lock{__mutex_}; #endif return __tzdb_.front(); } const_iterator __erase_after(const_iterator __p) { -#ifndef _LIBCPP_HAS_NO_THREADS +#if _LIBCPP_HAS_THREADS unique_lock __lock{__mutex_}; #endif @@ -74,7 +74,7 @@ public: } const_iterator __begin() const noexcept { -#ifndef _LIBCPP_HAS_NO_THREADS +#if _LIBCPP_HAS_THREADS unique_lock __lock{__mutex_}; #endif return __tzdb_.begin(); @@ -89,7 +89,7 @@ private: // pre: The caller ensures the locking, if needed, is done. void __load_no_lock() { chrono::__init_tzdb(__tzdb_.emplace_front(), __rules_.emplace_front()); } -#ifndef _LIBCPP_HAS_NO_THREADS +#if _LIBCPP_HAS_THREADS mutable mutex __mutex_; #endif forward_list<tzdb> __tzdb_; diff --git a/libcxx/src/filesystem/time_utils.h b/libcxx/src/filesystem/time_utils.h index 13f0d6f..89352e5 100644 --- a/libcxx/src/filesystem/time_utils.h +++ b/libcxx/src/filesystem/time_utils.h @@ -299,7 +299,7 @@ inline TimeSpec extract_mtime(StatT const& st) { return st.st_mtim; } inline TimeSpec extract_atime(StatT const& st) { return st.st_atim; } #endif -#ifndef _LIBCPP_HAS_NO_FILESYSTEM +#if _LIBCPP_HAS_FILESYSTEM # if !defined(_LIBCPP_WIN32API) inline bool posix_utimes(const path& p, std::array<TimeSpec, 2> const& TS, error_code& ec) { @@ -342,7 +342,7 @@ inline file_time_type __extract_last_write_time(const path& p, const StatT& st, return fs_time::convert_from_timespec(ts); } -#endif // !_LIBCPP_HAS_NO_FILESYSTEM +#endif // _LIBCPP_HAS_FILESYSTEM } // namespace detail diff --git a/libcxx/src/include/atomic_support.h b/libcxx/src/include/atomic_support.h index c4bc34f..410f64b 100644 --- a/libcxx/src/include/atomic_support.h +++ b/libcxx/src/include/atomic_support.h @@ -21,7 +21,7 @@ # define _LIBCPP_HAS_ATOMIC_BUILTINS #endif -#if !defined(_LIBCPP_HAS_ATOMIC_BUILTINS) && !defined(_LIBCPP_HAS_NO_THREADS) +#if !defined(_LIBCPP_HAS_ATOMIC_BUILTINS) && _LIBCPP_HAS_THREADS # if defined(_LIBCPP_WARNING) _LIBCPP_WARNING("Building libc++ without __atomic builtins is unsupported") # else @@ -33,7 +33,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD namespace { -#if defined(_LIBCPP_HAS_ATOMIC_BUILTINS) && !defined(_LIBCPP_HAS_NO_THREADS) +#if defined(_LIBCPP_HAS_ATOMIC_BUILTINS) && _LIBCPP_HAS_THREADS enum __libcpp_atomic_order { _AO_Relaxed = __ATOMIC_RELAXED, @@ -80,7 +80,7 @@ inline _LIBCPP_HIDE_FROM_ABI bool __libcpp_atomic_compare_exchange( return __atomic_compare_exchange_n(__val, __expected, __after, true, __success_order, __fail_order); } -#else // _LIBCPP_HAS_NO_THREADS +#else // _LIBCPP_HAS_THREADS enum __libcpp_atomic_order { _AO_Relaxed, _AO_Consume, _AO_Acquire, _AO_Release, _AO_Acq_Rel, _AO_Seq }; @@ -123,7 +123,7 @@ __libcpp_atomic_compare_exchange(_ValueType* __val, _ValueType* __expected, _Val return false; } -#endif // _LIBCPP_HAS_NO_THREADS +#endif // _LIBCPP_HAS_THREADS } // namespace diff --git a/libcxx/src/include/config_elast.h b/libcxx/src/include/config_elast.h index 158b93e..7edff2d 100644 --- a/libcxx/src/include/config_elast.h +++ b/libcxx/src/include/config_elast.h @@ -33,7 +33,7 @@ // No _LIBCPP_ELAST needed on WASI #elif defined(__EMSCRIPTEN__) // No _LIBCPP_ELAST needed on Emscripten -#elif defined(__linux__) || defined(_LIBCPP_HAS_MUSL_LIBC) +#elif defined(__linux__) || _LIBCPP_HAS_MUSL_LIBC # define _LIBCPP_ELAST 4095 #elif defined(__APPLE__) // No _LIBCPP_ELAST needed on Apple diff --git a/libcxx/src/ios.cpp b/libcxx/src/ios.cpp index 74d33b4..4bb6f80 100644 --- a/libcxx/src/ios.cpp +++ b/libcxx/src/ios.cpp @@ -116,7 +116,7 @@ locale ios_base::getloc() const { } // xalloc -#if defined(_LIBCPP_HAS_C_ATOMIC_IMP) && !defined(_LIBCPP_HAS_NO_THREADS) +#if _LIBCPP_HAS_C_ATOMIC_IMP && _LIBCPP_HAS_THREADS atomic<int> ios_base::__xindex_{0}; #else int ios_base::__xindex_ = 0; diff --git a/libcxx/src/ios.instantiations.cpp b/libcxx/src/ios.instantiations.cpp index aac7a68..a8d267f 100644 --- a/libcxx/src/ios.instantiations.cpp +++ b/libcxx/src/ios.instantiations.cpp @@ -23,7 +23,7 @@ template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_istream<char>; template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_ostream<char>; template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_iostream<char>; -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_ios<wchar_t>; template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_streambuf<wchar_t>; template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_istream<wchar_t>; @@ -37,7 +37,7 @@ template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_stringstream<char> template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_ostringstream<char>; template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_istringstream<char>; -#ifndef _LIBCPP_HAS_NO_FILESYSTEM +#if _LIBCPP_HAS_FILESYSTEM template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_ifstream<char>; template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_ofstream<char>; template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_filebuf<char>; diff --git a/libcxx/src/iostream.cpp b/libcxx/src/iostream.cpp index 48d2fdb..6d49a9be 100644 --- a/libcxx/src/iostream.cpp +++ b/libcxx/src/iostream.cpp @@ -30,7 +30,7 @@ alignas(istream) _LIBCPP_EXPORTED_FROM_ABI char cin[sizeof(istream)] alignas(__stdinbuf<char>) static char __cin[sizeof(__stdinbuf<char>)]; static mbstate_t mb_cin; -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS alignas(wistream) _LIBCPP_EXPORTED_FROM_ABI char wcin[sizeof(wistream)] # if defined(_LIBCPP_ABI_MICROSOFT) && defined(__clang__) __asm__("?wcin@" _LIBCPP_ABI_NAMESPACE_STR "@std@@3V?$basic_istream@_WU?$char_traits@_W@" _LIBCPP_ABI_NAMESPACE_STR @@ -39,7 +39,7 @@ alignas(wistream) _LIBCPP_EXPORTED_FROM_ABI char wcin[sizeof(wistream)] ; alignas(__stdinbuf<wchar_t>) static char __wcin[sizeof(__stdinbuf<wchar_t>)]; static mbstate_t mb_wcin; -#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS +#endif // _LIBCPP_HAS_WIDE_CHARACTERS alignas(ostream) _LIBCPP_EXPORTED_FROM_ABI char cout[sizeof(ostream)] #if defined(_LIBCPP_ABI_MICROSOFT) && defined(__clang__) @@ -50,7 +50,7 @@ alignas(ostream) _LIBCPP_EXPORTED_FROM_ABI char cout[sizeof(ostream)] alignas(__stdoutbuf<char>) static char __cout[sizeof(__stdoutbuf<char>)]; static mbstate_t mb_cout; -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS alignas(wostream) _LIBCPP_EXPORTED_FROM_ABI char wcout[sizeof(wostream)] # if defined(_LIBCPP_ABI_MICROSOFT) && defined(__clang__) __asm__("?wcout@" _LIBCPP_ABI_NAMESPACE_STR "@std@@3V?$basic_ostream@_WU?$char_traits@_W@" _LIBCPP_ABI_NAMESPACE_STR @@ -59,7 +59,7 @@ alignas(wostream) _LIBCPP_EXPORTED_FROM_ABI char wcout[sizeof(wostream)] ; alignas(__stdoutbuf<wchar_t>) static char __wcout[sizeof(__stdoutbuf<wchar_t>)]; static mbstate_t mb_wcout; -#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS +#endif // _LIBCPP_HAS_WIDE_CHARACTERS alignas(ostream) _LIBCPP_EXPORTED_FROM_ABI char cerr[sizeof(ostream)] #if defined(_LIBCPP_ABI_MICROSOFT) && defined(__clang__) @@ -70,7 +70,7 @@ alignas(ostream) _LIBCPP_EXPORTED_FROM_ABI char cerr[sizeof(ostream)] alignas(__stdoutbuf<char>) static char __cerr[sizeof(__stdoutbuf<char>)]; static mbstate_t mb_cerr; -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS alignas(wostream) _LIBCPP_EXPORTED_FROM_ABI char wcerr[sizeof(wostream)] # if defined(_LIBCPP_ABI_MICROSOFT) && defined(__clang__) __asm__("?wcerr@" _LIBCPP_ABI_NAMESPACE_STR "@std@@3V?$basic_ostream@_WU?$char_traits@_W@" _LIBCPP_ABI_NAMESPACE_STR @@ -79,7 +79,7 @@ alignas(wostream) _LIBCPP_EXPORTED_FROM_ABI char wcerr[sizeof(wostream)] ; alignas(__stdoutbuf<wchar_t>) static char __wcerr[sizeof(__stdoutbuf<wchar_t>)]; static mbstate_t mb_wcerr; -#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS +#endif // _LIBCPP_HAS_WIDE_CHARACTERS alignas(ostream) _LIBCPP_EXPORTED_FROM_ABI char clog[sizeof(ostream)] #if defined(_LIBCPP_ABI_MICROSOFT) && defined(__clang__) @@ -88,14 +88,14 @@ alignas(ostream) _LIBCPP_EXPORTED_FROM_ABI char clog[sizeof(ostream)] #endif ; -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS alignas(wostream) _LIBCPP_EXPORTED_FROM_ABI char wclog[sizeof(wostream)] # if defined(_LIBCPP_ABI_MICROSOFT) && defined(__clang__) __asm__("?wclog@" _LIBCPP_ABI_NAMESPACE_STR "@std@@3V?$basic_ostream@_WU?$char_traits@_W@" _LIBCPP_ABI_NAMESPACE_STR "@std@@@12@A") # endif ; -#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS +#endif // _LIBCPP_HAS_WIDE_CHARACTERS // Pretend we're inside a system header so the compiler doesn't flag the use of the init_priority // attribute with a value that's reserved for the implementation (we're the implementation). @@ -136,7 +136,7 @@ DoIOSInit::DoIOSInit() { std::unitbuf(*cerr_ptr); cerr_ptr->tie(cout_ptr); -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS wistream* wcin_ptr = ::new (wcin) wistream(::new (__wcin) __stdinbuf<wchar_t>(stdin, &mb_wcin)); wostream* wcout_ptr = ::new (wcout) wostream(::new (__wcout) __stdoutbuf<wchar_t>(stdout, &mb_wcout)); wostream* wcerr_ptr = ::new (wcerr) wostream(::new (__wcerr) __stdoutbuf<wchar_t>(stderr, &mb_wcerr)); @@ -154,7 +154,7 @@ DoIOSInit::~DoIOSInit() { ostream* clog_ptr = reinterpret_cast<ostream*>(clog); clog_ptr->flush(); -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS wostream* wcout_ptr = reinterpret_cast<wostream*>(wcout); wcout_ptr->flush(); wostream* wclog_ptr = reinterpret_cast<wostream*>(wclog); diff --git a/libcxx/src/locale.cpp b/libcxx/src/locale.cpp index 99a2d50..12ebe28 100644 --- a/libcxx/src/locale.cpp +++ b/libcxx/src/locale.cpp @@ -22,7 +22,7 @@ #include <utility> #include <vector> -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS # include <cwctype> #endif @@ -159,15 +159,15 @@ private: locale::__imp::__imp(size_t refs) : facet(refs), facets_(N), name_("C") { facets_.clear(); install(&make<std::collate<char> >(1u)); -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS install(&make<std::collate<wchar_t> >(1u)); #endif install(&make<std::ctype<char> >(nullptr, false, 1u)); -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS install(&make<std::ctype<wchar_t> >(1u)); #endif install(&make<codecvt<char, char, mbstate_t> >(1u)); -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS install(&make<codecvt<wchar_t, char, mbstate_t> >(1u)); #endif _LIBCPP_SUPPRESS_DEPRECATED_PUSH @@ -179,41 +179,41 @@ locale::__imp::__imp(size_t refs) : facet(refs), facets_(N), name_("C") { install(&make<codecvt<char32_t, char8_t, mbstate_t> >(1u)); #endif install(&make<numpunct<char> >(1u)); -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS install(&make<numpunct<wchar_t> >(1u)); #endif install(&make<num_get<char> >(1u)); -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS install(&make<num_get<wchar_t> >(1u)); #endif install(&make<num_put<char> >(1u)); -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS install(&make<num_put<wchar_t> >(1u)); #endif install(&make<moneypunct<char, false> >(1u)); install(&make<moneypunct<char, true> >(1u)); -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS install(&make<moneypunct<wchar_t, false> >(1u)); install(&make<moneypunct<wchar_t, true> >(1u)); #endif install(&make<money_get<char> >(1u)); -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS install(&make<money_get<wchar_t> >(1u)); #endif install(&make<money_put<char> >(1u)); -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS install(&make<money_put<wchar_t> >(1u)); #endif install(&make<time_get<char> >(1u)); -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS install(&make<time_get<wchar_t> >(1u)); #endif install(&make<time_put<char> >(1u)); -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS install(&make<time_put<wchar_t> >(1u)); #endif install(&make<std::messages<char> >(1u)); -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS install(&make<std::messages<wchar_t> >(1u)); #endif } @@ -227,15 +227,15 @@ locale::__imp::__imp(const string& name, size_t refs) : facet(refs), facets_(N), if (facets_[i]) facets_[i]->__add_shared(); install(new collate_byname<char>(name_)); -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS install(new collate_byname<wchar_t>(name_)); #endif install(new ctype_byname<char>(name_)); -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS install(new ctype_byname<wchar_t>(name_)); #endif install(new codecvt_byname<char, char, mbstate_t>(name_)); -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS install(new codecvt_byname<wchar_t, char, mbstate_t>(name_)); #endif _LIBCPP_SUPPRESS_DEPRECATED_PUSH @@ -247,25 +247,25 @@ locale::__imp::__imp(const string& name, size_t refs) : facet(refs), facets_(N), install(new codecvt_byname<char32_t, char8_t, mbstate_t>(name_)); #endif install(new numpunct_byname<char>(name_)); -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS install(new numpunct_byname<wchar_t>(name_)); #endif install(new moneypunct_byname<char, false>(name_)); install(new moneypunct_byname<char, true>(name_)); -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS install(new moneypunct_byname<wchar_t, false>(name_)); install(new moneypunct_byname<wchar_t, true>(name_)); #endif install(new time_get_byname<char>(name_)); -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS install(new time_get_byname<wchar_t>(name_)); #endif install(new time_put_byname<char>(name_)); -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS install(new time_put_byname<wchar_t>(name_)); #endif install(new messages_byname<char>(name_)); -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS install(new messages_byname<wchar_t>(name_)); #endif #if _LIBCPP_HAS_EXCEPTIONS @@ -296,17 +296,17 @@ locale::__imp::__imp(const __imp& other, const string& name, locale::category c) #endif // _LIBCPP_HAS_EXCEPTIONS if (c & locale::collate) { install(new collate_byname<char>(name)); -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS install(new collate_byname<wchar_t>(name)); #endif } if (c & locale::ctype) { install(new ctype_byname<char>(name)); -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS install(new ctype_byname<wchar_t>(name)); #endif install(new codecvt_byname<char, char, mbstate_t>(name)); -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS install(new codecvt_byname<wchar_t, char, mbstate_t>(name)); #endif _LIBCPP_SUPPRESS_DEPRECATED_PUSH @@ -321,30 +321,30 @@ locale::__imp::__imp(const __imp& other, const string& name, locale::category c) if (c & locale::monetary) { install(new moneypunct_byname<char, false>(name)); install(new moneypunct_byname<char, true>(name)); -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS install(new moneypunct_byname<wchar_t, false>(name)); install(new moneypunct_byname<wchar_t, true>(name)); #endif } if (c & locale::numeric) { install(new numpunct_byname<char>(name)); -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS install(new numpunct_byname<wchar_t>(name)); #endif } if (c & locale::time) { install(new time_get_byname<char>(name)); -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS install(new time_get_byname<wchar_t>(name)); #endif install(new time_put_byname<char>(name)); -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS install(new time_put_byname<wchar_t>(name)); #endif } if (c & locale::messages) { install(new messages_byname<char>(name)); -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS install(new messages_byname<wchar_t>(name)); #endif } @@ -375,13 +375,13 @@ locale::__imp::__imp(const __imp& other, const __imp& one, locale::category c) #endif // _LIBCPP_HAS_EXCEPTIONS if (c & locale::collate) { install_from<std::collate<char> >(one); -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS install_from<std::collate<wchar_t> >(one); #endif } if (c & locale::ctype) { install_from<std::ctype<char> >(one); -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS install_from<std::ctype<wchar_t> >(one); #endif install_from<std::codecvt<char, char, mbstate_t> >(one); @@ -393,53 +393,53 @@ locale::__imp::__imp(const __imp& other, const __imp& one, locale::category c) install_from<std::codecvt<char16_t, char8_t, mbstate_t> >(one); install_from<std::codecvt<char32_t, char8_t, mbstate_t> >(one); #endif -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS install_from<std::codecvt<wchar_t, char, mbstate_t> >(one); #endif } if (c & locale::monetary) { install_from<moneypunct<char, false> >(one); install_from<moneypunct<char, true> >(one); -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS install_from<moneypunct<wchar_t, false> >(one); install_from<moneypunct<wchar_t, true> >(one); #endif install_from<money_get<char> >(one); -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS install_from<money_get<wchar_t> >(one); #endif install_from<money_put<char> >(one); -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS install_from<money_put<wchar_t> >(one); #endif } if (c & locale::numeric) { install_from<numpunct<char> >(one); -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS install_from<numpunct<wchar_t> >(one); #endif install_from<num_get<char> >(one); -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS install_from<num_get<wchar_t> >(one); #endif install_from<num_put<char> >(one); -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS install_from<num_put<wchar_t> >(one); #endif } if (c & locale::time) { install_from<time_get<char> >(one); -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS install_from<time_get<wchar_t> >(one); #endif install_from<time_put<char> >(one); -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS install_from<time_put<wchar_t> >(one); #endif } if (c & locale::messages) { install_from<std::messages<char> >(one); -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS install_from<std::messages<wchar_t> >(one); #endif } @@ -642,7 +642,7 @@ collate_byname<char>::string_type collate_byname<char>::do_transform(const char_ // template <> class collate_byname<wchar_t> -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS collate_byname<wchar_t>::collate_byname(const char* n, size_t refs) : collate<wchar_t>(refs), __l_(newlocale(LC_ALL_MASK, n, 0)) { if (__l_ == 0) @@ -684,7 +684,7 @@ collate_byname<wchar_t>::do_transform(const char_type* lo, const char_type* hi) wcsxfrm_l(const_cast<wchar_t*>(out.c_str()), in.c_str(), out.size() + 1, __l_); return out; } -#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS +#endif // _LIBCPP_HAS_WIDE_CHARACTERS const ctype_base::mask ctype_base::space; const ctype_base::mask ctype_base::print; @@ -701,7 +701,7 @@ const ctype_base::mask ctype_base::graph; // template <> class ctype<wchar_t>; -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS constinit locale::id ctype<wchar_t>::id; ctype<wchar_t>::~ctype() {} @@ -796,7 +796,7 @@ const wchar_t* ctype<wchar_t>::do_narrow(const char_type* low, const char_type* *dest = dfault; return low; } -#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS +#endif // _LIBCPP_HAS_WIDE_CHARACTERS // template <> class ctype<char>; @@ -1085,7 +1085,7 @@ const char* ctype_byname<char>::do_tolower(char_type* low, const char_type* high // template <> class ctype_byname<wchar_t> -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS ctype_byname<wchar_t>::ctype_byname(const char* name, size_t refs) : ctype<wchar_t>(refs), __l_(newlocale(LC_ALL_MASK, name, 0)) { if (__l_ == 0) @@ -1278,7 +1278,7 @@ ctype_byname<wchar_t>::do_narrow(const char_type* low, const char_type* high, ch } return low; } -#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS +#endif // _LIBCPP_HAS_WIDE_CHARACTERS // template <> class codecvt<char, char, mbstate_t> @@ -1331,7 +1331,7 @@ int codecvt<char, char, mbstate_t>::do_max_length() const noexcept { return 1; } // template <> class codecvt<wchar_t, char, mbstate_t> -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS constinit locale::id codecvt<wchar_t, char, mbstate_t>::id; codecvt<wchar_t, char, mbstate_t>::codecvt(size_t refs) : locale::facet(refs), __l_(_LIBCPP_GET_C_LOCALE) {} @@ -1524,7 +1524,7 @@ int codecvt<wchar_t, char, mbstate_t>::do_length( int codecvt<wchar_t, char, mbstate_t>::do_max_length() const noexcept { return __l_ == 0 ? 1 : static_cast<int>(__libcpp_mb_cur_max_l(__l_)); } -#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS +#endif // _LIBCPP_HAS_WIDE_CHARACTERS // Valid UTF ranges // UTF-32 UTF-16 UTF-8 # of code points @@ -3020,7 +3020,7 @@ int codecvt<char32_t, char8_t, mbstate_t>::do_max_length() const noexcept { retu // __codecvt_utf8<wchar_t> -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS __codecvt_utf8<wchar_t>::result __codecvt_utf8<wchar_t>::do_out( state_type&, const intern_type* frm, @@ -3111,7 +3111,7 @@ int __codecvt_utf8<wchar_t>::do_max_length() const noexcept { return 4; # endif } -#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS +#endif // _LIBCPP_HAS_WIDE_CHARACTERS // __codecvt_utf8<char16_t> @@ -3249,7 +3249,7 @@ _LIBCPP_SUPPRESS_DEPRECATED_POP // __codecvt_utf16<wchar_t, false> -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS __codecvt_utf16<wchar_t, false>::result __codecvt_utf16<wchar_t, false>::do_out( state_type&, const intern_type* frm, @@ -3431,7 +3431,7 @@ int __codecvt_utf16<wchar_t, true>::do_max_length() const noexcept { return 4; # endif } -#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS +#endif // _LIBCPP_HAS_WIDE_CHARACTERS // __codecvt_utf16<char16_t, false> @@ -3703,7 +3703,7 @@ _LIBCPP_SUPPRESS_DEPRECATED_POP // __codecvt_utf8_utf16<wchar_t> -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS __codecvt_utf8_utf16<wchar_t>::result __codecvt_utf8_utf16<wchar_t>::do_out( state_type&, const intern_type* frm, @@ -3778,7 +3778,7 @@ int __codecvt_utf8_utf16<wchar_t>::do_max_length() const noexcept { return 7; return 4; } -#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS +#endif // _LIBCPP_HAS_WIDE_CHARACTERS // __codecvt_utf8_utf16<char16_t> @@ -3930,7 +3930,7 @@ __widen_from_utf8<16>::~__widen_from_utf8() {} __widen_from_utf8<32>::~__widen_from_utf8() {} -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS static bool checked_string_to_wchar_convert(wchar_t& dest, const char* ptr, locale_t loc) { if (*ptr == '\0') return false; @@ -3943,9 +3943,9 @@ static bool checked_string_to_wchar_convert(wchar_t& dest, const char* ptr, loca dest = out; return true; } -#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS +#endif // _LIBCPP_HAS_WIDE_CHARACTERS -#ifdef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if !_LIBCPP_HAS_WIDE_CHARACTERS static bool is_narrow_non_breaking_space(const char* ptr) { // https://www.fileformat.info/info/unicode/char/202f/index.htm return ptr[0] == '\xe2' && ptr[1] == '\x80' && ptr[2] == '\xaf'; @@ -3955,7 +3955,7 @@ static bool is_non_breaking_space(const char* ptr) { // https://www.fileformat.info/info/unicode/char/0a/index.htm return ptr[0] == '\xc2' && ptr[1] == '\xa0'; } -#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS +#endif // _LIBCPP_HAS_WIDE_CHARACTERS static bool checked_string_to_char_convert(char& dest, const char* ptr, locale_t __loc) { if (*ptr == '\0') @@ -3965,7 +3965,7 @@ static bool checked_string_to_char_convert(char& dest, const char* ptr, locale_t return true; } -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS // First convert the MBS into a wide char then attempt to narrow it using // wctob_l. wchar_t wout; @@ -3986,7 +3986,7 @@ static bool checked_string_to_char_convert(char& dest, const char* ptr, locale_t default: return false; } -#else // _LIBCPP_HAS_NO_WIDE_CHARACTERS +#else // _LIBCPP_HAS_WIDE_CHARACTERS // FIXME: Work around specific multibyte sequences that we can reasonably // translate into a different single byte. if (is_narrow_non_breaking_space(ptr) || is_non_breaking_space(ptr)) { @@ -3995,51 +3995,51 @@ static bool checked_string_to_char_convert(char& dest, const char* ptr, locale_t } return false; -#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS +#endif // _LIBCPP_HAS_WIDE_CHARACTERS __libcpp_unreachable(); } // numpunct<char> && numpunct<wchar_t> constinit locale::id numpunct<char>::id; -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS constinit locale::id numpunct<wchar_t>::id; #endif numpunct<char>::numpunct(size_t refs) : locale::facet(refs), __decimal_point_('.'), __thousands_sep_(',') {} -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS numpunct<wchar_t>::numpunct(size_t refs) : locale::facet(refs), __decimal_point_(L'.'), __thousands_sep_(L',') {} #endif numpunct<char>::~numpunct() {} -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS numpunct<wchar_t>::~numpunct() {} #endif char numpunct< char >::do_decimal_point() const { return __decimal_point_; } -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS wchar_t numpunct<wchar_t>::do_decimal_point() const { return __decimal_point_; } #endif char numpunct< char >::do_thousands_sep() const { return __thousands_sep_; } -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS wchar_t numpunct<wchar_t>::do_thousands_sep() const { return __thousands_sep_; } #endif string numpunct< char >::do_grouping() const { return __grouping_; } -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS string numpunct<wchar_t>::do_grouping() const { return __grouping_; } #endif string numpunct< char >::do_truename() const { return "true"; } -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS wstring numpunct<wchar_t>::do_truename() const { return L"true"; } #endif string numpunct< char >::do_falsename() const { return "false"; } -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS wstring numpunct<wchar_t>::do_falsename() const { return L"false"; } #endif @@ -4074,7 +4074,7 @@ void numpunct_byname<char>::__init(const char* nm) { // numpunct_byname<wchar_t> -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS numpunct_byname<wchar_t>::numpunct_byname(const char* nm, size_t refs) : numpunct<wchar_t>(refs) { __init(nm); } numpunct_byname<wchar_t>::numpunct_byname(const string& nm, size_t refs) : numpunct<wchar_t>(refs) { @@ -4100,7 +4100,7 @@ void numpunct_byname<wchar_t>::__init(const char* nm) { // localization for truename and falsename is not available } } -#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS +#endif // _LIBCPP_HAS_WIDE_CHARACTERS // num_get helpers @@ -4240,7 +4240,7 @@ static string* init_weeks() { return weeks; } -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS static wstring* init_wweeks() { static wstring weeks[14]; weeks[0] = L"Sunday"; @@ -4267,7 +4267,7 @@ const string* __time_get_c_storage<char>::__weeks() const { return weeks; } -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS template <> const wstring* __time_get_c_storage<wchar_t>::__weeks() const { static const wstring* weeks = init_wweeks(); @@ -4304,7 +4304,7 @@ static string* init_months() { return months; } -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS static wstring* init_wmonths() { static wstring months[24]; months[0] = L"January"; @@ -4341,7 +4341,7 @@ const string* __time_get_c_storage<char>::__months() const { return months; } -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS template <> const wstring* __time_get_c_storage<wchar_t>::__months() const { static const wstring* months = init_wmonths(); @@ -4356,7 +4356,7 @@ static string* init_am_pm() { return am_pm; } -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS static wstring* init_wam_pm() { static wstring am_pm[2]; am_pm[0] = L"AM"; @@ -4371,7 +4371,7 @@ const string* __time_get_c_storage<char>::__am_pm() const { return am_pm; } -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS template <> const wstring* __time_get_c_storage<wchar_t>::__am_pm() const { static const wstring* am_pm = init_wam_pm(); @@ -4385,7 +4385,7 @@ const string& __time_get_c_storage<char>::__x() const { return s; } -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS template <> const wstring& __time_get_c_storage<wchar_t>::__x() const { static wstring s(L"%m/%d/%y"); @@ -4399,7 +4399,7 @@ const string& __time_get_c_storage<char>::__X() const { return s; } -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS template <> const wstring& __time_get_c_storage<wchar_t>::__X() const { static wstring s(L"%H:%M:%S"); @@ -4413,7 +4413,7 @@ const string& __time_get_c_storage<char>::__c() const { return s; } -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS template <> const wstring& __time_get_c_storage<wchar_t>::__c() const { static wstring s(L"%a %b %d %H:%M:%S %Y"); @@ -4427,7 +4427,7 @@ const string& __time_get_c_storage<char>::__r() const { return s; } -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS template <> const wstring& __time_get_c_storage<wchar_t>::__r() const { static wstring s(L"%I:%M:%S %p"); @@ -4581,7 +4581,7 @@ string __time_get_storage<char>::__analyze(char fmt, const ctype<char>& ct) { _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wmissing-braces") -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS template <> wstring __time_get_storage<wchar_t>::__analyze(char fmt, const ctype<wchar_t>& ct) { tm t = {0}; @@ -4715,7 +4715,7 @@ wstring __time_get_storage<wchar_t>::__analyze(char fmt, const ctype<wchar_t>& c } return result; } -#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS +#endif // _LIBCPP_HAS_WIDE_CHARACTERS template <> void __time_get_storage<char>::init(const ctype<char>& ct) { @@ -4750,7 +4750,7 @@ void __time_get_storage<char>::init(const ctype<char>& ct) { __X_ = __analyze('X', ct); } -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS template <> void __time_get_storage<wchar_t>::init(const ctype<wchar_t>& ct) { tm t = {0}; @@ -4822,7 +4822,7 @@ void __time_get_storage<wchar_t>::init(const ctype<wchar_t>& ct) { __x_ = __analyze('x', ct); __X_ = __analyze('X', ct); } -#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS +#endif // _LIBCPP_HAS_WIDE_CHARACTERS template <class CharT> struct _LIBCPP_HIDDEN __time_get_temp : public ctype_byname<CharT> { @@ -4842,7 +4842,7 @@ __time_get_storage<char>::__time_get_storage(const string& __nm) : __time_get(__ init(ct); } -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS template <> __time_get_storage<wchar_t>::__time_get_storage(const char* __nm) : __time_get(__nm) { const __time_get_temp<wchar_t> ct(__nm); @@ -4854,7 +4854,7 @@ __time_get_storage<wchar_t>::__time_get_storage(const string& __nm) : __time_get const __time_get_temp<wchar_t> ct(__nm); init(ct); } -#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS +#endif // _LIBCPP_HAS_WIDE_CHARACTERS template <> time_base::dateorder __time_get_storage<char>::__do_date_order() const { @@ -4937,7 +4937,7 @@ time_base::dateorder __time_get_storage<char>::__do_date_order() const { return time_base::no_order; } -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS template <> time_base::dateorder __time_get_storage<wchar_t>::__do_date_order() const { unsigned i; @@ -5018,7 +5018,7 @@ time_base::dateorder __time_get_storage<wchar_t>::__do_date_order() const { } return time_base::no_order; } -#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS +#endif // _LIBCPP_HAS_WIDE_CHARACTERS // time_put @@ -5045,7 +5045,7 @@ void __time_put::__do_put(char* __nb, char*& __ne, const tm* __tm, char __fmt, c __ne = __nb + n; } -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS void __time_put::__do_put(wchar_t* __wb, wchar_t*& __we, const tm* __tm, char __fmt, char __mod) const { char __nar[100]; char* __ne = __nar + 100; @@ -5057,7 +5057,7 @@ void __time_put::__do_put(wchar_t* __wb, wchar_t*& __we, const tm* __tm, char __ __throw_runtime_error("locale not supported"); __we = __wb + j; } -#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS +#endif // _LIBCPP_HAS_WIDE_CHARACTERS // moneypunct_byname @@ -5511,7 +5511,7 @@ void moneypunct_byname<char, true>::init(const char* nm) { #endif // !_LIBCPP_MSVCRT } -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS template <> void moneypunct_byname<wchar_t, false>::init(const char* nm) { typedef moneypunct<wchar_t, false> base; @@ -5641,7 +5641,7 @@ void moneypunct_byname<wchar_t, true>::init(const char* nm) { __neg_format_, __curr_symbol_, true, lc->int_n_cs_precedes, lc->int_n_sep_by_space, lc->int_n_sign_posn, L' '); # endif // !_LIBCPP_MSVCRT } -#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS +#endif // _LIBCPP_HAS_WIDE_CHARACTERS void __do_nothing(void*) {} diff --git a/libcxx/src/memory.cpp b/libcxx/src/memory.cpp index 7a1c283..16190c2 100644 --- a/libcxx/src/memory.cpp +++ b/libcxx/src/memory.cpp @@ -13,7 +13,7 @@ #include <memory> -#ifndef _LIBCPP_HAS_NO_THREADS +#if _LIBCPP_HAS_THREADS # include <mutex> # include <thread> # if defined(__ELF__) && defined(_LIBCPP_LINK_PTHREAD_LIB) @@ -96,7 +96,7 @@ __shared_weak_count* __shared_weak_count::lock() noexcept { const void* __shared_weak_count::__get_deleter(const type_info&) const noexcept { return nullptr; } -#if !defined(_LIBCPP_HAS_NO_THREADS) +#if _LIBCPP_HAS_THREADS static constexpr std::size_t __sp_mut_count = 32; static constinit __libcpp_mutex_t mut_back[__sp_mut_count] = { @@ -128,7 +128,7 @@ __sp_mut& __get_sp_mut(const void* p) { return muts[hash<const void*>()(p) & (__sp_mut_count - 1)]; } -#endif // !defined(_LIBCPP_HAS_NO_THREADS) +#endif // _LIBCPP_HAS_THREADS void* align(size_t alignment, size_t size, void*& ptr, size_t& space) { void* r = nullptr; diff --git a/libcxx/src/memory_resource.cpp b/libcxx/src/memory_resource.cpp index 3d0d4ea..0cd575e 100644 --- a/libcxx/src/memory_resource.cpp +++ b/libcxx/src/memory_resource.cpp @@ -12,7 +12,7 @@ #if _LIBCPP_HAS_ATOMIC_HEADER # include <atomic> -#elif !defined(_LIBCPP_HAS_NO_THREADS) +#elif _LIBCPP_HAS_THREADS # include <mutex> # if defined(__ELF__) && defined(_LIBCPP_LINK_PTHREAD_LIB) # pragma comment(lib, "pthread") @@ -101,7 +101,7 @@ static memory_resource* __default_memory_resource(bool set = false, memory_resou } else { return std::atomic_load_explicit(&__res, memory_order_acquire); } -#elif !defined(_LIBCPP_HAS_NO_THREADS) +#elif _LIBCPP_HAS_THREADS static constinit memory_resource* res = &res_init.resources.new_delete_res; static mutex res_lock; if (set) { diff --git a/libcxx/src/ostream.cpp b/libcxx/src/ostream.cpp index f036aaf..e0f14a8 100644 --- a/libcxx/src/ostream.cpp +++ b/libcxx/src/ostream.cpp @@ -7,7 +7,7 @@ //===----------------------------------------------------------------------===// #include <__config> -#ifndef _LIBCPP_HAS_NO_FILESYSTEM +#if _LIBCPP_HAS_FILESYSTEM # include <fstream> #endif #include <ostream> @@ -26,7 +26,7 @@ _LIBCPP_EXPORTED_FROM_ABI FILE* __get_ostream_file(ostream& __os) { // importance on Windows. #if _LIBCPP_HAS_RTTI auto* __rdbuf = __os.rdbuf(); -# ifndef _LIBCPP_HAS_NO_FILESYSTEM +# if _LIBCPP_HAS_FILESYSTEM if (auto* __buffer = dynamic_cast<filebuf*>(__rdbuf)) return __buffer->__file_; # endif diff --git a/libcxx/src/print.cpp b/libcxx/src/print.cpp index 8fa59fdd..37b1fc0 100644 --- a/libcxx/src/print.cpp +++ b/libcxx/src/print.cpp @@ -42,7 +42,7 @@ _LIBCPP_EXPORTED_FROM_ABI bool __is_windows_terminal(FILE* __stream) { return GetConsoleMode(reinterpret_cast<void*>(__handle), &__mode); } -# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +# if _LIBCPP_HAS_WIDE_CHARACTERS _LIBCPP_EXPORTED_FROM_ABI void __write_to_windows_console([[maybe_unused]] FILE* __stream, [[maybe_unused]] wstring_view __view) { // https://learn.microsoft.com/en-us/windows/console/writeconsole @@ -54,7 +54,7 @@ __write_to_windows_console([[maybe_unused]] FILE* __stream, [[maybe_unused]] wst __throw_system_error(filesystem::detail::make_windows_error(GetLastError()), "failed to write formatted output"); } } -# endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS +# endif // _LIBCPP_HAS_WIDE_CHARACTERS #elif __has_include(<unistd.h>) // !_LIBCPP_WIN32API diff --git a/libcxx/src/random_shuffle.cpp b/libcxx/src/random_shuffle.cpp index 3aaf71d..4f2669a 100644 --- a/libcxx/src/random_shuffle.cpp +++ b/libcxx/src/random_shuffle.cpp @@ -9,7 +9,7 @@ #include <algorithm> #include <random> -#ifndef _LIBCPP_HAS_NO_THREADS +#if _LIBCPP_HAS_THREADS # include <mutex> # if defined(__ELF__) && defined(_LIBCPP_LINK_PTHREAD_LIB) # pragma comment(lib, "pthread") @@ -18,13 +18,13 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#ifndef _LIBCPP_HAS_NO_THREADS +#if _LIBCPP_HAS_THREADS static constinit __libcpp_mutex_t __rs_mut = _LIBCPP_MUTEX_INITIALIZER; #endif unsigned __rs_default::__c_ = 0; __rs_default::__rs_default() { -#ifndef _LIBCPP_HAS_NO_THREADS +#if _LIBCPP_HAS_THREADS __libcpp_mutex_lock(&__rs_mut); #endif __c_ = 1; @@ -33,7 +33,7 @@ __rs_default::__rs_default() { __rs_default::__rs_default(const __rs_default&) { ++__c_; } __rs_default::~__rs_default() { -#ifndef _LIBCPP_HAS_NO_THREADS +#if _LIBCPP_HAS_THREADS if (--__c_ == 0) __libcpp_mutex_unlock(&__rs_mut); #else diff --git a/libcxx/src/std_stream.h b/libcxx/src/std_stream.h index e55cd0b..1bbaee6 100644 --- a/libcxx/src/std_stream.h +++ b/libcxx/src/std_stream.h @@ -106,7 +106,7 @@ inline bool __do_getc(FILE* __fp, char* __pbuf) { *__pbuf = static_cast<char>(__c); return true; } -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS inline bool __do_getc(FILE* __fp, wchar_t* __pbuf) { wint_t __c = getwc(__fp); if (__c == WEOF) @@ -121,7 +121,7 @@ inline bool __do_ungetc(int __c, FILE* __fp, char __dummy) { return false; return true; } -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS inline bool __do_ungetc(std::wint_t __c, FILE* __fp, wchar_t __dummy) { if (ungetwc(__c, __fp) == WEOF) return false; @@ -293,7 +293,7 @@ inline bool __do_fputc(char __c, FILE* __fp) { return false; return true; } -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS inline bool __do_fputc(wchar_t __c, FILE* __fp) { // fputwc works regardless of wide/narrow mode of stdout, while // fwrite of wchar_t only works if the stream actually has been set diff --git a/libcxx/src/string.cpp b/libcxx/src/string.cpp index 12db538..dc16ce7 100644 --- a/libcxx/src/string.cpp +++ b/libcxx/src/string.cpp @@ -14,7 +14,7 @@ #include <stdexcept> #include <string> -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS # include <cwchar> #endif @@ -40,12 +40,12 @@ void __basic_string_common<true>::__throw_out_of_range() const { std::__throw_ou #define _LIBCPP_EXTERN_TEMPLATE_DEFINE(...) template __VA_ARGS__; #ifdef _LIBCPP_ABI_STRING_OPTIMIZED_EXTERNAL_INSTANTIATION _LIBCPP_STRING_UNSTABLE_EXTERN_TEMPLATE_LIST(_LIBCPP_EXTERN_TEMPLATE_DEFINE, char) -# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +# if _LIBCPP_HAS_WIDE_CHARACTERS _LIBCPP_STRING_UNSTABLE_EXTERN_TEMPLATE_LIST(_LIBCPP_EXTERN_TEMPLATE_DEFINE, wchar_t) # endif #else _LIBCPP_STRING_V1_EXTERN_TEMPLATE_LIST(_LIBCPP_EXTERN_TEMPLATE_DEFINE, char) -# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +# if _LIBCPP_HAS_WIDE_CHARACTERS _LIBCPP_STRING_V1_EXTERN_TEMPLATE_LIST(_LIBCPP_EXTERN_TEMPLATE_DEFINE, wchar_t) # endif #endif @@ -115,7 +115,7 @@ inline unsigned long long as_integer(const string& func, const string& s, size_t return as_integer_helper<unsigned long long>(func, s, idx, base, strtoull); } -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS // wstring template <> inline int as_integer(const string& func, const wstring& s, size_t* idx, int base) { @@ -145,7 +145,7 @@ template <> inline unsigned long long as_integer(const string& func, const wstring& s, size_t* idx, int base) { return as_integer_helper<unsigned long long>(func, s, idx, base, wcstoull); } -#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS +#endif // _LIBCPP_HAS_WIDE_CHARACTERS // as_float @@ -184,7 +184,7 @@ inline long double as_float(const string& func, const string& s, size_t* idx) { return as_float_helper<long double>(func, s, idx, strtold); } -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS template <> inline float as_float(const string& func, const wstring& s, size_t* idx) { return as_float_helper<float>(func, s, idx, wcstof); @@ -199,7 +199,7 @@ template <> inline long double as_float(const string& func, const wstring& s, size_t* idx) { return as_float_helper<long double>(func, s, idx, wcstold); } -#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS +#endif // _LIBCPP_HAS_WIDE_CHARACTERS } // unnamed namespace @@ -223,7 +223,7 @@ double stod(const string& str, size_t* idx) { return as_float<double>("stod", st long double stold(const string& str, size_t* idx) { return as_float<long double>("stold", str, idx); } -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS int stoi(const wstring& str, size_t* idx, int base) { return as_integer<int>("stoi", str, idx, base); } long stol(const wstring& str, size_t* idx, int base) { return as_integer<long>("stol", str, idx, base); } @@ -243,7 +243,7 @@ float stof(const wstring& str, size_t* idx) { return as_float<float>("stof", str double stod(const wstring& str, size_t* idx) { return as_float<double>("stod", str, idx); } long double stold(const wstring& str, size_t* idx) { return as_float<long double>("stold", str, idx); } -#endif // !_LIBCPP_HAS_NO_WIDE_CHARACTERS +#endif // _LIBCPP_HAS_WIDE_CHARACTERS // to_string @@ -283,7 +283,7 @@ struct initial_string<string> { } }; -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS template <> struct initial_string<wstring> { wstring operator()() const { @@ -302,7 +302,7 @@ inline wide_printf get_swprintf() { return static_cast<int(__cdecl*)(wchar_t* __restrict, size_t, const wchar_t* __restrict, ...)>(_snwprintf); # endif } -#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS +#endif // _LIBCPP_HAS_WIDE_CHARACTERS template <typename S, typename V> S i_to_string(V v) { @@ -325,7 +325,7 @@ string to_string(unsigned val) { return i_to_string< string>(val); } string to_string(unsigned long val) { return i_to_string< string>(val); } string to_string(unsigned long long val) { return i_to_string< string>(val); } -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS wstring to_wstring(int val) { return i_to_string<wstring>(val); } wstring to_wstring(long val) { return i_to_string<wstring>(val); } wstring to_wstring(long long val) { return i_to_string<wstring>(val); } @@ -338,7 +338,7 @@ string to_string(float val) { return as_string(snprintf, initial_string< string> string to_string(double val) { return as_string(snprintf, initial_string< string>()(), "%f", val); } string to_string(long double val) { return as_string(snprintf, initial_string< string>()(), "%Lf", val); } -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +#if _LIBCPP_HAS_WIDE_CHARACTERS wstring to_wstring(float val) { return as_string(get_swprintf(), initial_string<wstring>()(), L"%f", val); } wstring to_wstring(double val) { return as_string(get_swprintf(), initial_string<wstring>()(), L"%f", val); } wstring to_wstring(long double val) { return as_string(get_swprintf(), initial_string<wstring>()(), L"%Lf", val); } diff --git a/libcxx/src/system_error.cpp b/libcxx/src/system_error.cpp index 4767293..53838c6 100644 --- a/libcxx/src/system_error.cpp +++ b/libcxx/src/system_error.cpp @@ -26,7 +26,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD namespace { -#if !defined(_LIBCPP_HAS_NO_THREADS) +#if _LIBCPP_HAS_THREADS // GLIBC also uses 1024 as the maximum buffer size internally. constexpr size_t strerror_buff_size = 1024; @@ -92,7 +92,7 @@ string do_strerror_r(int ev) { } # endif -#endif // !defined(_LIBCPP_HAS_NO_THREADS) +#endif // _LIBCPP_HAS_THREADS string make_error_str(const error_code& ec, string what_arg) { if (ec) { @@ -113,7 +113,7 @@ string make_error_str(const error_code& ec) { } // namespace string __do_message::message(int ev) const { -#if defined(_LIBCPP_HAS_NO_THREADS) +#if !_LIBCPP_HAS_THREADS return string(::strerror(ev)); #else return do_strerror_r(ev); |