From 5e26fb169936ca1e24da6698ce895fec99af06c2 Mon Sep 17 00:00:00 2001 From: Louis Dionne Date: Fri, 21 Feb 2025 07:59:46 -0500 Subject: [PATCH] [libc++] Qualify calls to nullary functions like __throw_foo (#122465) This is technically not necessary in most cases to prevent issues with ADL, but let's be consistent. This allows us to remove the libcpp-qualify-declval clang-tidy check, which is now enforced by the robust-against-adl clang-tidy check. --- libcxx/docs/CodingGuidelines.rst | 2 +- .../__algorithm/ranges_iterator_concept.h | 2 +- libcxx/include/__algorithm/stable_sort.h | 4 +- libcxx/include/__chrono/formatter.h | 4 +- .../__compare/common_comparison_category.h | 2 +- .../__condition_variable/condition_variable.h | 4 +- libcxx/include/__filesystem/directory_entry.h | 2 +- libcxx/include/__format/format_arg_store.h | 2 +- libcxx/include/__functional/function.h | 4 +- libcxx/include/__locale | 10 +- libcxx/include/__locale_dir/support/windows.h | 2 +- libcxx/include/__memory/allocator.h | 2 +- libcxx/include/__memory/shared_ptr.h | 2 +- .../__memory_resource/polymorphic_allocator.h | 2 +- libcxx/include/__mutex/unique_lock.h | 18 +-- libcxx/include/__ostream/basic_ostream.h | 2 +- libcxx/include/__random/clamp_to_integral.h | 2 +- libcxx/include/__ranges/elements_view.h | 2 +- libcxx/include/__ranges/zip_view.h | 2 +- libcxx/include/__thread/thread.h | 6 +- .../__type_traits/is_nothrow_convertible.h | 2 +- libcxx/include/__vector/vector.h | 2 +- libcxx/include/__vector/vector_bool.h | 2 +- libcxx/include/any | 6 +- libcxx/include/array | 8 +- libcxx/include/bitset | 14 +- libcxx/include/experimental/__simd/utility.h | 2 +- libcxx/include/fstream | 8 +- libcxx/include/future | 54 ++++---- libcxx/include/locale | 24 ++-- libcxx/include/map | 10 +- libcxx/include/optional | 8 +- libcxx/include/regex | 130 +++++++++--------- libcxx/include/set | 6 +- libcxx/include/shared_mutex | 18 +-- libcxx/include/string | 56 ++++---- libcxx/include/string_view | 2 +- libcxx/include/unordered_map | 4 +- libcxx/include/variant | 7 +- libcxx/src/chrono.cpp | 12 +- libcxx/src/condition_variable.cpp | 8 +- libcxx/src/filesystem/error.h | 12 +- libcxx/src/filesystem/filesystem_clock.cpp | 4 +- libcxx/src/future.cpp | 20 +-- libcxx/src/hash.cpp | 4 +- libcxx/src/ios.cpp | 10 +- libcxx/src/locale.cpp | 68 ++++----- libcxx/src/memory_resource.cpp | 4 +- libcxx/src/mutex.cpp | 8 +- libcxx/src/print.cpp | 2 +- libcxx/src/random.cpp | 24 ++-- libcxx/src/std_stream.h | 2 +- libcxx/src/thread.cpp | 4 +- .../tools/clang_tidy_checks/CMakeLists.txt | 1 - .../tools/clang_tidy_checks/libcpp_module.cpp | 2 - .../clang_tidy_checks/qualify_declval.cpp | 31 ----- .../clang_tidy_checks/qualify_declval.hpp | 18 --- .../clang_tidy_checks/robust_against_adl.cpp | 1 - 58 files changed, 313 insertions(+), 361 deletions(-) delete mode 100644 libcxx/test/tools/clang_tidy_checks/qualify_declval.cpp delete mode 100644 libcxx/test/tools/clang_tidy_checks/qualify_declval.hpp diff --git a/libcxx/docs/CodingGuidelines.rst b/libcxx/docs/CodingGuidelines.rst index 9bf23a4cfe08..0c85cd07c0f6 100644 --- a/libcxx/docs/CodingGuidelines.rst +++ b/libcxx/docs/CodingGuidelines.rst @@ -36,7 +36,7 @@ Function overloading also applies to operators. Using ``&user_object`` may call ... } -This is mostly enforced by the clang-tidy checks ``libcpp-robust-against-adl`` and ``libcpp-qualify-declval``. +This is mostly enforced by the clang-tidy check ``libcpp-robust-against-adl``. Avoid including public headers ============================== diff --git a/libcxx/include/__algorithm/ranges_iterator_concept.h b/libcxx/include/__algorithm/ranges_iterator_concept.h index 58790e95aa80..947dfa481129 100644 --- a/libcxx/include/__algorithm/ranges_iterator_concept.h +++ b/libcxx/include/__algorithm/ranges_iterator_concept.h @@ -44,7 +44,7 @@ consteval auto __get_iterator_concept() { } template -using __iterator_concept _LIBCPP_NODEBUG = decltype(__get_iterator_concept<_Iter>()); +using __iterator_concept _LIBCPP_NODEBUG = decltype(ranges::__get_iterator_concept<_Iter>()); } // namespace ranges _LIBCPP_END_NAMESPACE_STD diff --git a/libcxx/include/__algorithm/stable_sort.h b/libcxx/include/__algorithm/stable_sort.h index 49d3cca2526e..76d9e5557008 100644 --- a/libcxx/include/__algorithm/stable_sort.h +++ b/libcxx/include/__algorithm/stable_sort.h @@ -252,8 +252,8 @@ _LIBCPP_CONSTEXPR_SINCE_CXX26 void __stable_sort( is_integral_v && is_same_v< value_type&, __iter_reference<_RandomAccessIterator>>; constexpr auto __allowed_radix_sort = __default_comp && __integral_value; if constexpr (__allowed_radix_sort) { - if (__len <= __buff_size && __len >= static_cast(__radix_sort_min_bound()) && - __len <= static_cast(__radix_sort_max_bound())) { + if (__len <= __buff_size && __len >= static_cast(std::__radix_sort_min_bound()) && + __len <= static_cast(std::__radix_sort_max_bound())) { if (__libcpp_is_constant_evaluated()) { for (auto* __p = __buff; __p < __buff + __buff_size; ++__p) { std::__construct_at(__p); diff --git a/libcxx/include/__chrono/formatter.h b/libcxx/include/__chrono/formatter.h index 13bcb717291f..b2983f49709c 100644 --- a/libcxx/include/__chrono/formatter.h +++ b/libcxx/include/__chrono/formatter.h @@ -315,7 +315,7 @@ _LIBCPP_HIDE_FROM_ABI void __format_chrono_using_chrono_specs( case _CharT('T'): __facet.put( {__sstr}, __sstr, _CharT(' '), std::addressof(__t), std::to_address(__s), std::to_address(__it + 1)); - if constexpr (__use_fraction<_Tp>()) + if constexpr (__formatter::__use_fraction<_Tp>()) __formatter::__format_sub_seconds(__sstr, __value); break; @@ -378,7 +378,7 @@ _LIBCPP_HIDE_FROM_ABI void __format_chrono_using_chrono_specs( break; case _CharT('O'): - if constexpr (__use_fraction<_Tp>()) { + if constexpr (__formatter::__use_fraction<_Tp>()) { // Handle OS using the normal representation for the non-fractional // part. There seems to be no locale information regarding how the // fractional part should be formatted. diff --git a/libcxx/include/__compare/common_comparison_category.h b/libcxx/include/__compare/common_comparison_category.h index 215922abad6b..6ddf9b9d4589 100644 --- a/libcxx/include/__compare/common_comparison_category.h +++ b/libcxx/include/__compare/common_comparison_category.h @@ -55,7 +55,7 @@ __compute_comp_type(const _ClassifyCompCategory (&__types)[_Size]) { template _LIBCPP_HIDE_FROM_ABI constexpr auto __get_comp_type() { using _CCC = _ClassifyCompCategory; - constexpr _CCC __type_kinds[] = {_StrongOrd, __type_to_enum<_Ts>()...}; + constexpr _CCC __type_kinds[] = {_StrongOrd, __comp_detail::__type_to_enum<_Ts>()...}; constexpr _CCC __cat = __comp_detail::__compute_comp_type(__type_kinds); if constexpr (__cat == _None) return void(); diff --git a/libcxx/include/__condition_variable/condition_variable.h b/libcxx/include/__condition_variable/condition_variable.h index 4521fe274614..82ecb804669e 100644 --- a/libcxx/include/__condition_variable/condition_variable.h +++ b/libcxx/include/__condition_variable/condition_variable.h @@ -210,7 +210,7 @@ inline void condition_variable::__do_timed_wait( unique_lock& __lk, chrono::time_point __tp) _NOEXCEPT { using namespace chrono; if (!__lk.owns_lock()) - __throw_system_error(EPERM, "condition_variable::timed wait: mutex not locked"); + std::__throw_system_error(EPERM, "condition_variable::timed wait: mutex not locked"); nanoseconds __d = __tp.time_since_epoch(); timespec __ts; seconds __s = duration_cast(__d); @@ -225,7 +225,7 @@ inline void condition_variable::__do_timed_wait( } int __ec = pthread_cond_clockwait(&__cv_, __lk.mutex()->native_handle(), CLOCK_MONOTONIC, &__ts); if (__ec != 0 && __ec != ETIMEDOUT) - __throw_system_error(__ec, "condition_variable timed_wait failed"); + std::__throw_system_error(__ec, "condition_variable timed_wait failed"); } # endif // _LIBCPP_HAS_COND_CLOCKWAIT diff --git a/libcxx/include/__filesystem/directory_entry.h b/libcxx/include/__filesystem/directory_entry.h index 11e07acdbe00..5f236cf2648d 100644 --- a/libcxx/include/__filesystem/directory_entry.h +++ b/libcxx/include/__filesystem/directory_entry.h @@ -286,7 +286,7 @@ private: return; } if (__ec && (!__allow_dne || !__is_dne_error(__ec))) - __throw_filesystem_error(__msg, __p_, __ec); + filesystem::__throw_filesystem_error(__msg, __p_, __ec); } _LIBCPP_HIDE_FROM_ABI void __refresh(error_code* __ec = nullptr) { diff --git a/libcxx/include/__format/format_arg_store.h b/libcxx/include/__format/format_arg_store.h index 4c5ee9e9e4fd..c6c7fdeedcfe 100644 --- a/libcxx/include/__format/format_arg_store.h +++ b/libcxx/include/__format/format_arg_store.h @@ -164,7 +164,7 @@ consteval __arg_t __determine_arg_t() { template _LIBCPP_HIDE_FROM_ABI basic_format_arg<_Context> __create_format_arg(_Tp& __value) noexcept { using _Dp = remove_const_t<_Tp>; - constexpr __arg_t __arg = __determine_arg_t<_Context, _Dp>(); + constexpr __arg_t __arg = __format::__determine_arg_t<_Context, _Dp>(); static_assert(__arg != __arg_t::__none, "the supplied type is not formattable"); static_assert(__formattable_with<_Tp, _Context>); diff --git a/libcxx/include/__functional/function.h b/libcxx/include/__functional/function.h index 2a1293cfcc26..cb800c6b3d19 100644 --- a/libcxx/include/__functional/function.h +++ b/libcxx/include/__functional/function.h @@ -432,7 +432,7 @@ public: _LIBCPP_HIDE_FROM_ABI _Rp operator()(_ArgTypes&&... __args) const { if (__f_ == nullptr) - __throw_bad_function_call(); + std::__throw_bad_function_call(); return (*__f_)(std::forward<_ArgTypes>(__args)...); } @@ -607,7 +607,7 @@ private: _LIBCPP_HIDE_FROM_ABI explicit __policy_invoker(__Call __c) : __call_(__c) {} _LIBCPP_HIDE_FROM_ABI static _Rp __call_empty(const __policy_storage*, __fast_forward<_ArgTypes>...) { - __throw_bad_function_call(); + std::__throw_bad_function_call(); } template diff --git a/libcxx/include/__locale b/libcxx/include/__locale index dfe79d5e506f..9bd77cbf3890 100644 --- a/libcxx/include/__locale +++ b/libcxx/include/__locale @@ -154,7 +154,7 @@ inline _LIBCPP_HIDE_FROM_ABI locale::locale(const locale& __other, _Facet* __f) template locale locale::combine(const locale& __other) const { if (!std::has_facet<_Facet>(__other)) - __throw_runtime_error("locale::combine: locale missing facet"); + std::__throw_runtime_error("locale::combine: locale missing facet"); return locale(*this, &const_cast<_Facet&>(std::use_facet<_Facet>(__other))); } @@ -1298,7 +1298,7 @@ struct _LIBCPP_EXPORTED_FROM_ABI __narrow_to_utf8<16> : public codecvt : public codecvt : public codecvt __sz ? __nb + __sz : __ne, __nn, __buf, __buf + __sz, __bn); if (__r == codecvt_base::error || __nn == __nb) - __throw_runtime_error("locale not supported"); + std::__throw_runtime_error("locale not supported"); for (const char16_t* __p = __buf; __p < __bn; ++__p, ++__s) *__s = *__p; __nb = __nn; @@ -1398,7 +1398,7 @@ struct _LIBCPP_EXPORTED_FROM_ABI __widen_from_utf8<32> : public codecvt __sz ? __nb + __sz : __ne, __nn, __buf, __buf + __sz, __bn); if (__r == codecvt_base::error || __nn == __nb) - __throw_runtime_error("locale not supported"); + std::__throw_runtime_error("locale not supported"); for (const char32_t* __p = __buf; __p < __bn; ++__p, ++__s) *__s = *__p; __nb = __nn; diff --git a/libcxx/include/__locale_dir/support/windows.h b/libcxx/include/__locale_dir/support/windows.h index 56d34c6f0e6c..03c621ee0ff1 100644 --- a/libcxx/include/__locale_dir/support/windows.h +++ b/libcxx/include/__locale_dir/support/windows.h @@ -317,7 +317,7 @@ struct __locale_guard { if (std::strcmp(__l.__get_locale(), __lc) != 0) { __locale_all = _strdup(__lc); if (__locale_all == nullptr) - __throw_bad_alloc(); + std::__throw_bad_alloc(); __locale::__setlocale(LC_ALL, __l.__get_locale()); } } diff --git a/libcxx/include/__memory/allocator.h b/libcxx/include/__memory/allocator.h index 191a59e6614a..2620f1cafb43 100644 --- a/libcxx/include/__memory/allocator.h +++ b/libcxx/include/__memory/allocator.h @@ -98,7 +98,7 @@ public: [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp* allocate(size_t __n) { static_assert(sizeof(_Tp) >= 0, "cannot allocate memory for an incomplete type"); if (__n > allocator_traits::max_size(*this)) - __throw_bad_array_new_length(); + std::__throw_bad_array_new_length(); if (__libcpp_is_constant_evaluated()) { return static_cast<_Tp*>(::operator new(__n * sizeof(_Tp))); } else { diff --git a/libcxx/include/__memory/shared_ptr.h b/libcxx/include/__memory/shared_ptr.h index d513fa692c1f..e1d49c459486 100644 --- a/libcxx/include/__memory/shared_ptr.h +++ b/libcxx/include/__memory/shared_ptr.h @@ -497,7 +497,7 @@ public: _LIBCPP_HIDE_FROM_ABI explicit shared_ptr(const weak_ptr<_Yp>& __r) : __ptr_(__r.__ptr_), __cntrl_(__r.__cntrl_ ? __r.__cntrl_->lock() : __r.__cntrl_) { if (__cntrl_ == nullptr) - __throw_bad_weak_ptr(); + std::__throw_bad_weak_ptr(); } #if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR) diff --git a/libcxx/include/__memory_resource/polymorphic_allocator.h b/libcxx/include/__memory_resource/polymorphic_allocator.h index 2dec9788852c..7e7eca5c64fb 100644 --- a/libcxx/include/__memory_resource/polymorphic_allocator.h +++ b/libcxx/include/__memory_resource/polymorphic_allocator.h @@ -64,7 +64,7 @@ public: [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _ValueType* allocate(size_t __n) { if (__n > __max_size()) { - __throw_bad_array_new_length(); + std::__throw_bad_array_new_length(); } return static_cast<_ValueType*>(__res_->allocate(__n * sizeof(_ValueType), alignof(_ValueType))); } diff --git a/libcxx/include/__mutex/unique_lock.h b/libcxx/include/__mutex/unique_lock.h index 3642ab93cb1f..84073ef4b511 100644 --- a/libcxx/include/__mutex/unique_lock.h +++ b/libcxx/include/__mutex/unique_lock.h @@ -116,9 +116,9 @@ _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(unique_lock); template _LIBCPP_HIDE_FROM_ABI void unique_lock<_Mutex>::lock() { if (__m_ == nullptr) - __throw_system_error(EPERM, "unique_lock::lock: references null mutex"); + std::__throw_system_error(EPERM, "unique_lock::lock: references null mutex"); if (__owns_) - __throw_system_error(EDEADLK, "unique_lock::lock: already locked"); + std::__throw_system_error(EDEADLK, "unique_lock::lock: already locked"); __m_->lock(); __owns_ = true; } @@ -126,9 +126,9 @@ _LIBCPP_HIDE_FROM_ABI void unique_lock<_Mutex>::lock() { template _LIBCPP_HIDE_FROM_ABI bool unique_lock<_Mutex>::try_lock() { if (__m_ == nullptr) - __throw_system_error(EPERM, "unique_lock::try_lock: references null mutex"); + std::__throw_system_error(EPERM, "unique_lock::try_lock: references null mutex"); if (__owns_) - __throw_system_error(EDEADLK, "unique_lock::try_lock: already locked"); + std::__throw_system_error(EDEADLK, "unique_lock::try_lock: already locked"); __owns_ = __m_->try_lock(); return __owns_; } @@ -137,9 +137,9 @@ template template _LIBCPP_HIDE_FROM_ABI bool unique_lock<_Mutex>::try_lock_for(const chrono::duration<_Rep, _Period>& __d) { if (__m_ == nullptr) - __throw_system_error(EPERM, "unique_lock::try_lock_for: references null mutex"); + std::__throw_system_error(EPERM, "unique_lock::try_lock_for: references null mutex"); if (__owns_) - __throw_system_error(EDEADLK, "unique_lock::try_lock_for: already locked"); + std::__throw_system_error(EDEADLK, "unique_lock::try_lock_for: already locked"); __owns_ = __m_->try_lock_for(__d); return __owns_; } @@ -148,9 +148,9 @@ template template _LIBCPP_HIDE_FROM_ABI bool unique_lock<_Mutex>::try_lock_until(const chrono::time_point<_Clock, _Duration>& __t) { if (__m_ == nullptr) - __throw_system_error(EPERM, "unique_lock::try_lock_until: references null mutex"); + std::__throw_system_error(EPERM, "unique_lock::try_lock_until: references null mutex"); if (__owns_) - __throw_system_error(EDEADLK, "unique_lock::try_lock_until: already locked"); + std::__throw_system_error(EDEADLK, "unique_lock::try_lock_until: already locked"); __owns_ = __m_->try_lock_until(__t); return __owns_; } @@ -158,7 +158,7 @@ _LIBCPP_HIDE_FROM_ABI bool unique_lock<_Mutex>::try_lock_until(const chrono::tim template _LIBCPP_HIDE_FROM_ABI void unique_lock<_Mutex>::unlock() { if (!__owns_) - __throw_system_error(EPERM, "unique_lock::unlock: not locked"); + std::__throw_system_error(EPERM, "unique_lock::unlock: not locked"); __m_->unlock(); __owns_ = false; } diff --git a/libcxx/include/__ostream/basic_ostream.h b/libcxx/include/__ostream/basic_ostream.h index 97226476e5ef..06bf54a5bd2f 100644 --- a/libcxx/include/__ostream/basic_ostream.h +++ b/libcxx/include/__ostream/basic_ostream.h @@ -407,7 +407,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const char* __strn) { if (__len > __bs) { __wb = (_CharT*)malloc(__len * sizeof(_CharT)); if (__wb == 0) - __throw_bad_alloc(); + std::__throw_bad_alloc(); __h.reset(__wb); } for (_CharT* __p = __wb; *__strn != '\0'; ++__strn, ++__p) diff --git a/libcxx/include/__random/clamp_to_integral.h b/libcxx/include/__random/clamp_to_integral.h index d9bfd31b7f01..9ddf41e0a39a 100644 --- a/libcxx/include/__random/clamp_to_integral.h +++ b/libcxx/include/__random/clamp_to_integral.h @@ -43,7 +43,7 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _IntT __max_representable_int_for_float( template _LIBCPP_HIDE_FROM_ABI _IntT __clamp_to_integral(_RealT __r) _NOEXCEPT { using _Lim = numeric_limits<_IntT>; - const _IntT __max_val = __max_representable_int_for_float<_IntT, _RealT>(); + const _IntT __max_val = std::__max_representable_int_for_float<_IntT, _RealT>(); if (__r >= ::nextafter(static_cast<_RealT>(__max_val), INFINITY)) { return _Lim::max(); } else if (__r <= _Lim::lowest()) { diff --git a/libcxx/include/__ranges/elements_view.h b/libcxx/include/__ranges/elements_view.h index 5121298fb684..b1419f2a1dd9 100644 --- a/libcxx/include/__ranges/elements_view.h +++ b/libcxx/include/__ranges/elements_view.h @@ -197,7 +197,7 @@ class elements_view<_View, _Np>::__iterator } public: - using iterator_concept = decltype(__get_iterator_concept()); + using iterator_concept = decltype(__iterator::__get_iterator_concept()); using value_type = remove_cvref_t>>; using difference_type = range_difference_t<_Base>; diff --git a/libcxx/include/__ranges/zip_view.h b/libcxx/include/__ranges/zip_view.h index 835e23cb23af..6d31f5ce0993 100644 --- a/libcxx/include/__ranges/zip_view.h +++ b/libcxx/include/__ranges/zip_view.h @@ -252,7 +252,7 @@ class zip_view<_Views...>::__iterator : public __zip_view_iterator_category_base friend class zip_view<_Views...>; public: - using iterator_concept = decltype(__get_zip_view_iterator_tag<_Const, _Views...>()); + using iterator_concept = decltype(ranges::__get_zip_view_iterator_tag<_Const, _Views...>()); using value_type = tuple>...>; using difference_type = common_type_t>...>; diff --git a/libcxx/include/__thread/thread.h b/libcxx/include/__thread/thread.h index c40ffd25b903..8e5b97f2a5c0 100644 --- a/libcxx/include/__thread/thread.h +++ b/libcxx/include/__thread/thread.h @@ -100,7 +100,7 @@ template __thread_specific_ptr<_Tp>::__thread_specific_ptr() { int __ec = __libcpp_tls_create(&__key_, &__thread_specific_ptr::__at_thread_exit); if (__ec) - __throw_system_error(__ec, "__thread_specific_ptr construction failed"); + std::__throw_system_error(__ec, "__thread_specific_ptr construction failed"); } template @@ -219,7 +219,7 @@ thread::thread(_Fp&& __f, _Args&&... __args) { if (__ec == 0) __p.release(); else - __throw_system_error(__ec, "thread constructor failed"); + std::__throw_system_error(__ec, "thread constructor failed"); } # else // _LIBCPP_CXX03_LANG @@ -251,7 +251,7 @@ thread::thread(_Fp __f) { if (__ec == 0) __pp.release(); else - __throw_system_error(__ec, "thread constructor failed"); + std::__throw_system_error(__ec, "thread constructor failed"); } # endif // _LIBCPP_CXX03_LANG diff --git a/libcxx/include/__type_traits/is_nothrow_convertible.h b/libcxx/include/__type_traits/is_nothrow_convertible.h index 8b1aacf8f287..f11461929643 100644 --- a/libcxx/include/__type_traits/is_nothrow_convertible.h +++ b/libcxx/include/__type_traits/is_nothrow_convertible.h @@ -43,7 +43,7 @@ template bool_constant(std::declval<_Fm>()))> __is_nothrow_convertible_test(); template -struct __is_nothrow_convertible_helper : decltype(__is_nothrow_convertible_test<_Fm, _To>()) {}; +struct __is_nothrow_convertible_helper : decltype(std::__is_nothrow_convertible_test<_Fm, _To>()) {}; template struct is_nothrow_convertible diff --git a/libcxx/include/__vector/vector.h b/libcxx/include/__vector/vector.h index 244506065db6..ef796a8ed0a9 100644 --- a/libcxx/include/__vector/vector.h +++ b/libcxx/include/__vector/vector.h @@ -555,7 +555,7 @@ private: // Postcondition: size() == 0 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __vallocate(size_type __n) { if (__n > max_size()) - __throw_length_error(); + this->__throw_length_error(); auto __allocation = std::__allocate_at_least(this->__alloc_, __n); __begin_ = __allocation.ptr; __end_ = __allocation.ptr; diff --git a/libcxx/include/__vector/vector_bool.h b/libcxx/include/__vector/vector_bool.h index 714c86ae2bb9..1d3960bd0159 100644 --- a/libcxx/include/__vector/vector_bool.h +++ b/libcxx/include/__vector/vector_bool.h @@ -446,7 +446,7 @@ private: // Postcondition: size() == 0 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __vallocate(size_type __n) { if (__n > max_size()) - __throw_length_error(); + this->__throw_length_error(); auto __allocation = std::__allocate_at_least(__alloc_, __external_cap_to_internal(__n)); __begin_ = __allocation.ptr; __size_ = 0; diff --git a/libcxx/include/any b/libcxx/include/any index 786e86b5ccd8..b1df494d3db8 100644 --- a/libcxx/include/any +++ b/libcxx/include/any @@ -526,7 +526,7 @@ inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST _ValueType "or a CopyConstructible type"); auto __tmp = std::any_cast>(&__v); if (__tmp == nullptr) - __throw_bad_any_cast(); + std::__throw_bad_any_cast(); return static_cast<_ValueType>(*__tmp); } @@ -538,7 +538,7 @@ inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST _ValueType "or a CopyConstructible type"); auto __tmp = std::any_cast<_RawValueType>(&__v); if (__tmp == nullptr) - __throw_bad_any_cast(); + std::__throw_bad_any_cast(); return static_cast<_ValueType>(*__tmp); } @@ -550,7 +550,7 @@ inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST _ValueType "or a CopyConstructible type"); auto __tmp = std::any_cast<_RawValueType>(&__v); if (__tmp == nullptr) - __throw_bad_any_cast(); + std::__throw_bad_any_cast(); return static_cast<_ValueType>(std::move(*__tmp)); } diff --git a/libcxx/include/array b/libcxx/include/array index 1b9bcd6891d9..44c6bb5c5cc9 100644 --- a/libcxx/include/array +++ b/libcxx/include/array @@ -276,13 +276,13 @@ struct _LIBCPP_TEMPLATE_VIS array { _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reference at(size_type __n) { if (__n >= _Size) - __throw_out_of_range("array::at"); + std::__throw_out_of_range("array::at"); return __elems_[__n]; } _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const_reference at(size_type __n) const { if (__n >= _Size) - __throw_out_of_range("array::at"); + std::__throw_out_of_range("array::at"); return __elems_[__n]; } @@ -407,12 +407,12 @@ struct _LIBCPP_TEMPLATE_VIS array<_Tp, 0> { } _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reference at(size_type) { - __throw_out_of_range("array::at"); + std::__throw_out_of_range("array::at"); __libcpp_unreachable(); } _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const_reference at(size_type) const { - __throw_out_of_range("array::at"); + std::__throw_out_of_range("array::at"); __libcpp_unreachable(); } diff --git a/libcxx/include/bitset b/libcxx/include/bitset index a20842985b3d..ab1dda739c7d 100644 --- a/libcxx/include/bitset +++ b/libcxx/include/bitset @@ -343,7 +343,7 @@ __bitset<_N_words, _Size>::to_ulong(false_type) const { __const_iterator __e = __make_iter(_Size); __const_iterator __i = std::find(__make_iter(sizeof(unsigned long) * CHAR_BIT), __e, true); if (__i != __e) - __throw_overflow_error("bitset to_ulong overflow error"); + std::__throw_overflow_error("bitset to_ulong overflow error"); return __first_[0]; } @@ -360,7 +360,7 @@ __bitset<_N_words, _Size>::to_ullong(false_type) const { __const_iterator __e = __make_iter(_Size); __const_iterator __i = std::find(__make_iter(sizeof(unsigned long long) * CHAR_BIT), __e, true); if (__i != __e) - __throw_overflow_error("bitset to_ullong overflow error"); + std::__throw_overflow_error("bitset to_ullong overflow error"); return to_ullong(true_type()); } @@ -645,7 +645,7 @@ public: _CharT __zero = _CharT('0'), _CharT __one = _CharT('1')) { if (__pos > __str.size()) - __throw_out_of_range("bitset string pos out of range"); + std::__throw_out_of_range("bitset string pos out of range"); size_t __rlen = std::min(__n, __str.size() - __pos); __init_from_string_view(basic_string_view<_CharT, _Traits>(__str.data() + __pos, __rlen), __zero, __one); @@ -790,7 +790,7 @@ inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset<_Size>& bitset template _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset<_Size>& bitset<_Size>::set(size_t __pos, bool __val) { if (__pos >= _Size) - __throw_out_of_range("bitset set argument out of range"); + std::__throw_out_of_range("bitset set argument out of range"); (*this)[__pos] = __val; return *this; @@ -805,7 +805,7 @@ inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset<_Size>& bitset template _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset<_Size>& bitset<_Size>::reset(size_t __pos) { if (__pos >= _Size) - __throw_out_of_range("bitset reset argument out of range"); + std::__throw_out_of_range("bitset reset argument out of range"); (*this)[__pos] = false; return *this; @@ -827,7 +827,7 @@ inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset<_Size>& bitset template _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset<_Size>& bitset<_Size>::flip(size_t __pos) { if (__pos >= _Size) - __throw_out_of_range("bitset flip argument out of range"); + std::__throw_out_of_range("bitset flip argument out of range"); reference __r = __base::__make_ref(__pos); __r = ~__r; @@ -899,7 +899,7 @@ inline _LIBCPP_HIDE_FROM_ABI bool bitset<_Size>::operator!=(const bitset& __rhs) template _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool bitset<_Size>::test(size_t __pos) const { if (__pos >= _Size) - __throw_out_of_range("bitset test argument out of range"); + std::__throw_out_of_range("bitset test argument out of range"); return (*this)[__pos]; } diff --git a/libcxx/include/experimental/__simd/utility.h b/libcxx/include/experimental/__simd/utility.h index fd9fcecc7986..2af61e34082f 100644 --- a/libcxx/include/experimental/__simd/utility.h +++ b/libcxx/include/experimental/__simd/utility.h @@ -58,7 +58,7 @@ _LIBCPP_HIDE_FROM_ABI auto __choose_mask_type() { template _LIBCPP_HIDE_FROM_ABI auto constexpr __set_all_bits(bool __v) { - return __v ? (numeric_limits())>::max()) : 0; + return __v ? (numeric_limits())>::max()) : 0; } template diff --git a/libcxx/include/fstream b/libcxx/include/fstream index de5c07035dba..e2eba51b58bd 100644 --- a/libcxx/include/fstream +++ b/libcxx/include/fstream @@ -780,7 +780,7 @@ typename basic_filebuf<_CharT, _Traits>::int_type basic_filebuf<_CharT, _Traits> size_t __nr = fread((void*)const_cast(__extbufnext_), 1, __nmemb, __file_); if (__nr != 0) { if (!__cv_) - __throw_bad_cast(); + std::__throw_bad_cast(); __extbufend_ = __extbufnext_ + __nr; char_type* __inext; @@ -842,7 +842,7 @@ typename basic_filebuf<_CharT, _Traits>::int_type basic_filebuf<_CharT, _Traits> codecvt_base::result __r; do { if (!__cv_) - __throw_bad_cast(); + std::__throw_bad_cast(); const char_type* __e; __r = __cv_->out(__st_, this->pbase(), this->pptr(), __e, __extbuf_, __extbuf_ + __ebs_, __extbe); @@ -913,7 +913,7 @@ template typename basic_filebuf<_CharT, _Traits>::pos_type basic_filebuf<_CharT, _Traits>::seekoff(off_type __off, ios_base::seekdir __way, ios_base::openmode) { if (!__cv_) - __throw_bad_cast(); + std::__throw_bad_cast(); int __width = __cv_->encoding(); if (__file_ == nullptr || (__width <= 0 && __off != 0) || sync()) @@ -978,7 +978,7 @@ int basic_filebuf<_CharT, _Traits>::sync() { if (__file_ == nullptr) return 0; if (!__cv_) - __throw_bad_cast(); + std::__throw_bad_cast(); if (__cm_ & ios_base::out) { if (this->pptr() != this->pbase()) diff --git a/libcxx/include/future b/libcxx/include/future index db1f624244b8..c17e79f8c03b 100644 --- a/libcxx/include/future +++ b/libcxx/include/future @@ -541,7 +541,7 @@ public: lock_guard __lk(__mut_); bool __has_future_attached = (__state_ & __future_attached) != 0; if (__has_future_attached) - __throw_future_error(future_errc::future_already_retrieved); + std::__throw_future_error(future_errc::future_already_retrieved); this->__add_shared(); __state_ |= __future_attached; } @@ -621,7 +621,7 @@ template void __assoc_state<_Rp>::set_value(_Arg&& __arg) { unique_lock __lk(this->__mut_); if (this->__has_value()) - __throw_future_error(future_errc::promise_already_satisfied); + std::__throw_future_error(future_errc::promise_already_satisfied); ::new ((void*)&__value_) _Rp(std::forward<_Arg>(__arg)); this->__state_ |= base::__constructed | base::ready; __cv_.notify_all(); @@ -632,7 +632,7 @@ template void __assoc_state<_Rp>::set_value_at_thread_exit(_Arg&& __arg) { unique_lock __lk(this->__mut_); if (this->__has_value()) - __throw_future_error(future_errc::promise_already_satisfied); + std::__throw_future_error(future_errc::promise_already_satisfied); ::new ((void*)&__value_) _Rp(std::forward<_Arg>(__arg)); this->__state_ |= base::__constructed; __thread_local_data()->__make_ready_at_thread_exit(this); @@ -682,7 +682,7 @@ template void __assoc_state<_Rp&>::set_value(_Rp& __arg) { unique_lock __lk(this->__mut_); if (this->__has_value()) - __throw_future_error(future_errc::promise_already_satisfied); + std::__throw_future_error(future_errc::promise_already_satisfied); __value_ = std::addressof(__arg); this->__state_ |= base::__constructed | base::ready; __cv_.notify_all(); @@ -692,7 +692,7 @@ template void __assoc_state<_Rp&>::set_value_at_thread_exit(_Rp& __arg) { unique_lock __lk(this->__mut_); if (this->__has_value()) - __throw_future_error(future_errc::promise_already_satisfied); + std::__throw_future_error(future_errc::promise_already_satisfied); __value_ = std::addressof(__arg); this->__state_ |= base::__constructed; __thread_local_data()->__make_ready_at_thread_exit(this); @@ -1185,21 +1185,21 @@ promise<_Rp>::~promise() { template future<_Rp> promise<_Rp>::get_future() { if (__state_ == nullptr) - __throw_future_error(future_errc::no_state); + std::__throw_future_error(future_errc::no_state); return future<_Rp>(__state_); } template void promise<_Rp>::set_value(const _Rp& __r) { if (__state_ == nullptr) - __throw_future_error(future_errc::no_state); + std::__throw_future_error(future_errc::no_state); __state_->set_value(__r); } template void promise<_Rp>::set_value(_Rp&& __r) { if (__state_ == nullptr) - __throw_future_error(future_errc::no_state); + std::__throw_future_error(future_errc::no_state); __state_->set_value(std::move(__r)); } @@ -1207,21 +1207,21 @@ template void promise<_Rp>::set_exception(exception_ptr __p) { _LIBCPP_ASSERT_NON_NULL(__p != nullptr, "promise::set_exception: received nullptr"); if (__state_ == nullptr) - __throw_future_error(future_errc::no_state); + std::__throw_future_error(future_errc::no_state); __state_->set_exception(__p); } template void promise<_Rp>::set_value_at_thread_exit(const _Rp& __r) { if (__state_ == nullptr) - __throw_future_error(future_errc::no_state); + std::__throw_future_error(future_errc::no_state); __state_->set_value_at_thread_exit(__r); } template void promise<_Rp>::set_value_at_thread_exit(_Rp&& __r) { if (__state_ == nullptr) - __throw_future_error(future_errc::no_state); + std::__throw_future_error(future_errc::no_state); __state_->set_value_at_thread_exit(std::move(__r)); } @@ -1229,7 +1229,7 @@ template void promise<_Rp>::set_exception_at_thread_exit(exception_ptr __p) { _LIBCPP_ASSERT_NON_NULL(__p != nullptr, "promise::set_exception_at_thread_exit: received nullptr"); if (__state_ == nullptr) - __throw_future_error(future_errc::no_state); + std::__throw_future_error(future_errc::no_state); __state_->set_exception_at_thread_exit(__p); } @@ -1300,14 +1300,14 @@ promise<_Rp&>::~promise() { template future<_Rp&> promise<_Rp&>::get_future() { if (__state_ == nullptr) - __throw_future_error(future_errc::no_state); + std::__throw_future_error(future_errc::no_state); return future<_Rp&>(__state_); } template void promise<_Rp&>::set_value(_Rp& __r) { if (__state_ == nullptr) - __throw_future_error(future_errc::no_state); + std::__throw_future_error(future_errc::no_state); __state_->set_value(__r); } @@ -1315,14 +1315,14 @@ template void promise<_Rp&>::set_exception(exception_ptr __p) { _LIBCPP_ASSERT_NON_NULL(__p != nullptr, "promise::set_exception: received nullptr"); if (__state_ == nullptr) - __throw_future_error(future_errc::no_state); + std::__throw_future_error(future_errc::no_state); __state_->set_exception(__p); } template void promise<_Rp&>::set_value_at_thread_exit(_Rp& __r) { if (__state_ == nullptr) - __throw_future_error(future_errc::no_state); + std::__throw_future_error(future_errc::no_state); __state_->set_value_at_thread_exit(__r); } @@ -1330,7 +1330,7 @@ template void promise<_Rp&>::set_exception_at_thread_exit(exception_ptr __p) { _LIBCPP_ASSERT_NON_NULL(__p != nullptr, "promise::set_exception_at_thread_exit: received nullptr"); if (__state_ == nullptr) - __throw_future_error(future_errc::no_state); + std::__throw_future_error(future_errc::no_state); __state_->set_exception_at_thread_exit(__p); } @@ -1665,9 +1665,9 @@ public: template void packaged_task<_Rp(_ArgTypes...)>::operator()(_ArgTypes... __args) { if (__p_.__state_ == nullptr) - __throw_future_error(future_errc::no_state); + std::__throw_future_error(future_errc::no_state); if (__p_.__state_->__has_value()) - __throw_future_error(future_errc::promise_already_satisfied); + std::__throw_future_error(future_errc::promise_already_satisfied); # if _LIBCPP_HAS_EXCEPTIONS try { # endif // _LIBCPP_HAS_EXCEPTIONS @@ -1682,9 +1682,9 @@ void packaged_task<_Rp(_ArgTypes...)>::operator()(_ArgTypes... __args) { template void packaged_task<_Rp(_ArgTypes...)>::make_ready_at_thread_exit(_ArgTypes... __args) { if (__p_.__state_ == nullptr) - __throw_future_error(future_errc::no_state); + std::__throw_future_error(future_errc::no_state); if (__p_.__state_->__has_value()) - __throw_future_error(future_errc::promise_already_satisfied); + std::__throw_future_error(future_errc::promise_already_satisfied); # if _LIBCPP_HAS_EXCEPTIONS try { # endif // _LIBCPP_HAS_EXCEPTIONS @@ -1699,7 +1699,7 @@ void packaged_task<_Rp(_ArgTypes...)>::make_ready_at_thread_exit(_ArgTypes... __ template void packaged_task<_Rp(_ArgTypes...)>::reset() { if (!valid()) - __throw_future_error(future_errc::no_state); + std::__throw_future_error(future_errc::no_state); __p_ = promise<_Rp>(); } @@ -1767,9 +1767,9 @@ packaged_task(_Fp) -> packaged_task<_Stripped>; template void packaged_task::operator()(_ArgTypes... __args) { if (__p_.__state_ == nullptr) - __throw_future_error(future_errc::no_state); + std::__throw_future_error(future_errc::no_state); if (__p_.__state_->__has_value()) - __throw_future_error(future_errc::promise_already_satisfied); + std::__throw_future_error(future_errc::promise_already_satisfied); # if _LIBCPP_HAS_EXCEPTIONS try { # endif // _LIBCPP_HAS_EXCEPTIONS @@ -1785,9 +1785,9 @@ void packaged_task::operator()(_ArgTypes... __args) { template void packaged_task::make_ready_at_thread_exit(_ArgTypes... __args) { if (__p_.__state_ == nullptr) - __throw_future_error(future_errc::no_state); + std::__throw_future_error(future_errc::no_state); if (__p_.__state_->__has_value()) - __throw_future_error(future_errc::promise_already_satisfied); + std::__throw_future_error(future_errc::promise_already_satisfied); # if _LIBCPP_HAS_EXCEPTIONS try { # endif // _LIBCPP_HAS_EXCEPTIONS @@ -1803,7 +1803,7 @@ void packaged_task::make_ready_at_thread_exit(_ArgTypes... _ template void packaged_task::reset() { if (!valid()) - __throw_future_error(future_errc::no_state); + std::__throw_future_error(future_errc::no_state); __p_ = promise(); } diff --git a/libcxx/include/locale b/libcxx/include/locale index be0f31cece67..86e327fde569 100644 --- a/libcxx/include/locale +++ b/libcxx/include/locale @@ -292,7 +292,7 @@ _LIBCPP_HIDE_FROM_ABI _ForwardIterator __scan_keyword( if (__nkw > sizeof(__statbuf)) { __status = (unsigned char*)malloc(__nkw); if (__status == nullptr) - __throw_bad_alloc(); + std::__throw_bad_alloc(); __stat_hold.reset(__status); } size_t __n_might_match = __nkw; // At this point, any keyword might match @@ -1324,7 +1324,7 @@ _LIBCPP_HIDE_FROM_ABI inline _OutputIterator num_put<_CharT, _OutputIterator>::_ else __nc = __locale::__asprintf(&__nb, _LIBCPP_GET_C_LOCALE, __fmt, __v); if (__nc == -1) - __throw_bad_alloc(); + std::__throw_bad_alloc(); __nbh.reset(__nb); } _LIBCPP_DIAGNOSTIC_POP @@ -1337,7 +1337,7 @@ _LIBCPP_HIDE_FROM_ABI inline _OutputIterator num_put<_CharT, _OutputIterator>::_ if (__nb != __nar) { __ob = (char_type*)malloc(2 * static_cast(__nc) * sizeof(char_type)); if (__ob == 0) - __throw_bad_alloc(); + std::__throw_bad_alloc(); __obh.reset(__ob); } char_type* __op; // pad here @@ -2382,7 +2382,7 @@ _LIBCPP_HIDE_FROM_ABI void __double_or_nothing(unique_ptr<_Tp, void (*)(void*)>& size_t __n_off = static_cast(__n - __b.get()); _Tp* __t = (_Tp*)std::realloc(__owns ? __b.get() : 0, __new_cap); if (__t == 0) - __throw_bad_alloc(); + std::__throw_bad_alloc(); if (__owns) __b.release(); __b = unique_ptr<_Tp, void (*)(void*)>(__t, free); @@ -2585,7 +2585,7 @@ _InputIterator money_get<_CharT, _InputIterator>::do_get( if (__wn - __wb.get() > __bz - 2) { __h.reset((char*)malloc(static_cast(__wn - __wb.get() + 2))); if (__h.get() == nullptr) - __throw_bad_alloc(); + std::__throw_bad_alloc(); __nc = __h.get(); } if (__neg) @@ -2594,7 +2594,7 @@ _InputIterator money_get<_CharT, _InputIterator>::do_get( *__nc = __src[std::find(__atoms, std::end(__atoms), *__w) - __atoms]; *__nc = char(); if (sscanf(__nbuf, "%Lf", &__v) != 1) - __throw_runtime_error("money_get error"); + std::__throw_runtime_error("money_get error"); } if (__b == __e) __err |= ios_base::eofbit; @@ -2859,11 +2859,11 @@ _OutputIterator money_put<_CharT, _OutputIterator>::do_put( if (static_cast(__n) > __bs - 1) { __n = __locale::__asprintf(&__bb, _LIBCPP_GET_C_LOCALE, "%.0Lf", __units); if (__n == -1) - __throw_bad_alloc(); + std::__throw_bad_alloc(); __hn.reset(__bb); __hd.reset((char_type*)malloc(static_cast(__n) * sizeof(char_type))); if (__hd == nullptr) - __throw_bad_alloc(); + std::__throw_bad_alloc(); __db = __hd.get(); } // gather info @@ -2890,7 +2890,7 @@ _OutputIterator money_put<_CharT, _OutputIterator>::do_put( __hw.reset((char_type*)malloc(__exn * sizeof(char_type))); __mb = __hw.get(); if (__mb == 0) - __throw_bad_alloc(); + std::__throw_bad_alloc(); } // format char_type* __mi; @@ -2928,7 +2928,7 @@ _OutputIterator money_put<_CharT, _OutputIterator>::do_put( __h.reset((char_type*)malloc(__exn * sizeof(char_type))); __mb = __h.get(); if (__mb == 0) - __throw_bad_alloc(); + std::__throw_bad_alloc(); } // format char_type* __mi; @@ -3203,7 +3203,7 @@ wstring_convert<_Codecvt, _Elem, _WideAlloc, _ByteAlloc>::from_bytes(const char* } if (__wide_err_string_.empty()) - __throw_range_error("wstring_convert: from_bytes error"); + std::__throw_range_error("wstring_convert: from_bytes error"); return __wide_err_string_; } @@ -3272,7 +3272,7 @@ wstring_convert<_Codecvt, _Elem, _WideAlloc, _ByteAlloc>::to_bytes(const _Elem* } if (__byte_err_string_.empty()) - __throw_range_error("wstring_convert: to_bytes error"); + std::__throw_range_error("wstring_convert: to_bytes error"); return __byte_err_string_; } diff --git a/libcxx/include/map b/libcxx/include/map index 76d32ad883d6..37a8ec91b8f1 100644 --- a/libcxx/include/map +++ b/libcxx/include/map @@ -1138,7 +1138,7 @@ public: insert(__m.begin(), __m.end()); } - _LIBCPP_HIDE_FROM_ABI ~map() { static_assert(sizeof(__diagnose_non_const_comparator<_Key, _Compare>()), ""); } + _LIBCPP_HIDE_FROM_ABI ~map() { static_assert(sizeof(std::__diagnose_non_const_comparator<_Key, _Compare>()), ""); } _LIBCPP_HIDE_FROM_ABI iterator begin() _NOEXCEPT { return __tree_.begin(); } _LIBCPP_HIDE_FROM_ABI const_iterator begin() const _NOEXCEPT { return __tree_.begin(); } @@ -1572,7 +1572,7 @@ _Tp& map<_Key, _Tp, _Compare, _Allocator>::at(const key_type& __k) { __parent_pointer __parent; __node_base_pointer& __child = __tree_.__find_equal(__parent, __k); if (__child == nullptr) - __throw_out_of_range("map::at: key not found"); + std::__throw_out_of_range("map::at: key not found"); return static_cast<__node_pointer>(__child)->__value_.__get_value().second; } @@ -1581,7 +1581,7 @@ const _Tp& map<_Key, _Tp, _Compare, _Allocator>::at(const key_type& __k) const { __parent_pointer __parent; __node_base_pointer __child = __tree_.__find_equal(__parent, __k); if (__child == nullptr) - __throw_out_of_range("map::at: key not found"); + std::__throw_out_of_range("map::at: key not found"); return static_cast<__node_pointer>(__child)->__value_.__get_value().second; } @@ -1826,7 +1826,9 @@ public: insert(__m.begin(), __m.end()); } - _LIBCPP_HIDE_FROM_ABI ~multimap() { static_assert(sizeof(__diagnose_non_const_comparator<_Key, _Compare>()), ""); } + _LIBCPP_HIDE_FROM_ABI ~multimap() { + static_assert(sizeof(std::__diagnose_non_const_comparator<_Key, _Compare>()), ""); + } _LIBCPP_HIDE_FROM_ABI iterator begin() _NOEXCEPT { return __tree_.begin(); } _LIBCPP_HIDE_FROM_ABI const_iterator begin() const _NOEXCEPT { return __tree_.begin(); } diff --git a/libcxx/include/optional b/libcxx/include/optional index db236f86e74d..294c3ddf993f 100644 --- a/libcxx/include/optional +++ b/libcxx/include/optional @@ -827,25 +827,25 @@ public: _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS constexpr value_type const& value() const& { if (!this->has_value()) - __throw_bad_optional_access(); + std::__throw_bad_optional_access(); return this->__get(); } _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS constexpr value_type& value() & { if (!this->has_value()) - __throw_bad_optional_access(); + std::__throw_bad_optional_access(); return this->__get(); } _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS constexpr value_type&& value() && { if (!this->has_value()) - __throw_bad_optional_access(); + std::__throw_bad_optional_access(); return std::move(this->__get()); } _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS constexpr value_type const&& value() const&& { if (!this->has_value()) - __throw_bad_optional_access(); + std::__throw_bad_optional_access(); return std::move(this->__get()); } diff --git a/libcxx/include/regex b/libcxx/include/regex index dcee77cfacc3..36ea55ce3092 100644 --- a/libcxx/include/regex +++ b/libcxx/include/regex @@ -1681,7 +1681,7 @@ public: template void __back_ref<_CharT>::__exec(__state& __s) const { if (__mexp_ > __s.__sub_matches_.size()) - __throw_regex_error(); + std::__throw_regex_error(); sub_match& __sm = __s.__sub_matches_[__mexp_ - 1]; if (__sm.matched) { ptrdiff_t __len = __sm.second - __sm.first; @@ -2117,7 +2117,7 @@ public: std::make_pair(__traits_.transform(__b.begin(), __b.end()), __traits_.transform(__e.begin(), __e.end()))); } else { if (__b.size() != 1 || __e.size() != 1) - __throw_regex_error(); + std::__throw_regex_error(); if (__icase_) { __b[0] = __traits_.translate_nocase(__b[0]); __e[0] = __traits_.translate_nocase(__e[0]); @@ -2743,7 +2743,7 @@ void basic_regex<_CharT, _Traits>::__init(_ForwardIterator __first, _ForwardIter __flags_ |= regex_constants::ECMAScript; _ForwardIterator __temp = __parse(__first, __last); if (__temp != __last) - __throw_regex_error(); + std::__throw_regex_error(); } template @@ -2773,7 +2773,7 @@ _ForwardIterator basic_regex<_CharT, _Traits>::__parse(_ForwardIterator __first, __first = __parse_egrep(__first, __last); break; default: - __throw_regex_error(); + std::__throw_regex_error(); } return __first; } @@ -2798,7 +2798,7 @@ basic_regex<_CharT, _Traits>::__parse_basic_reg_exp(_ForwardIterator __first, _F } } if (__first != __last) - __throw_regex_error(); + std::__throw_regex_error(); } return __first; } @@ -2810,13 +2810,13 @@ basic_regex<_CharT, _Traits>::__parse_extended_reg_exp(_ForwardIterator __first, __owns_one_state<_CharT>* __sa = __end_; _ForwardIterator __temp = __parse_ERE_branch(__first, __last); if (__temp == __first) - __throw_regex_error(); + std::__throw_regex_error(); __first = __temp; while (__first != __last && *__first == '|') { __owns_one_state<_CharT>* __sb = __end_; __temp = __parse_ERE_branch(++__first, __last); if (__temp == __first) - __throw_regex_error(); + std::__throw_regex_error(); __push_alternation(__sa, __sb); __first = __temp; } @@ -2828,7 +2828,7 @@ template _ForwardIterator basic_regex<_CharT, _Traits>::__parse_ERE_branch(_ForwardIterator __first, _ForwardIterator __last) { _ForwardIterator __temp = __parse_ERE_expression(__first, __last); if (__temp == __first) - __throw_regex_error(); + std::__throw_regex_error(); do { __first = __temp; __temp = __parse_ERE_expression(__first, __last); @@ -2859,7 +2859,7 @@ basic_regex<_CharT, _Traits>::__parse_ERE_expression(_ForwardIterator __first, _ ++__open_count_; __temp = __parse_extended_reg_exp(++__temp, __last); if (__temp == __last || *__temp != ')') - __throw_regex_error(); + std::__throw_regex_error(); __push_end_marked_subexpression(__temp_count); --__open_count_; ++__temp; @@ -2911,7 +2911,7 @@ _ForwardIterator basic_regex<_CharT, _Traits>::__parse_nondupl_RE(_ForwardIterat __first = __parse_RE_expression(__temp, __last); __temp = __parse_Back_close_paren(__first, __last); if (__temp == __first) - __throw_regex_error(); + std::__throw_regex_error(); __push_end_marked_subexpression(__temp_count); __first = __temp; } else @@ -3154,14 +3154,14 @@ _ForwardIterator basic_regex<_CharT, _Traits>::__parse_RE_dupl_symbol( __first = __temp; __temp = __parse_DUP_COUNT(__first, __last, __min); if (__temp == __first) - __throw_regex_error(); + std::__throw_regex_error(); __first = __temp; if (__first == __last) - __throw_regex_error(); + std::__throw_regex_error(); if (*__first != ',') { __temp = __parse_Back_close_brace(__first, __last); if (__temp == __first) - __throw_regex_error(); + std::__throw_regex_error(); __push_loop(__min, __min, __s, __mexp_begin, __mexp_end, true); __first = __temp; } else { @@ -3170,12 +3170,12 @@ _ForwardIterator basic_regex<_CharT, _Traits>::__parse_RE_dupl_symbol( __first = __parse_DUP_COUNT(__first, __last, __max); __temp = __parse_Back_close_brace(__first, __last); if (__temp == __first) - __throw_regex_error(); + std::__throw_regex_error(); if (__max == -1) __push_greedy_inf_repeat(__min, __s, __mexp_begin, __mexp_end); else { if (__max < __min) - __throw_regex_error(); + std::__throw_regex_error(); __push_loop(__min, __max, __s, __mexp_begin, __mexp_end, true); } __first = __temp; @@ -3225,10 +3225,10 @@ _ForwardIterator basic_regex<_CharT, _Traits>::__parse_ERE_dupl_symbol( int __min; _ForwardIterator __temp = __parse_DUP_COUNT(++__first, __last, __min); if (__temp == __first) - __throw_regex_error(); + std::__throw_regex_error(); __first = __temp; if (__first == __last) - __throw_regex_error(); + std::__throw_regex_error(); switch (*__first) { case '}': ++__first; @@ -3241,7 +3241,7 @@ _ForwardIterator basic_regex<_CharT, _Traits>::__parse_ERE_dupl_symbol( case ',': ++__first; if (__first == __last) - __throw_regex_error(); + std::__throw_regex_error(); if (*__first == '}') { ++__first; if (__grammar == ECMAScript && __first != __last && *__first == '?') { @@ -3253,13 +3253,13 @@ _ForwardIterator basic_regex<_CharT, _Traits>::__parse_ERE_dupl_symbol( int __max = -1; __temp = __parse_DUP_COUNT(__first, __last, __max); if (__temp == __first) - __throw_regex_error(); + std::__throw_regex_error(); __first = __temp; if (__first == __last || *__first != '}') - __throw_regex_error(); + std::__throw_regex_error(); ++__first; if (__max < __min) - __throw_regex_error(); + std::__throw_regex_error(); if (__grammar == ECMAScript && __first != __last && *__first == '?') { ++__first; __push_loop(__min, __max, __s, __mexp_begin, __mexp_end, false); @@ -3268,7 +3268,7 @@ _ForwardIterator basic_regex<_CharT, _Traits>::__parse_ERE_dupl_symbol( } break; default: - __throw_regex_error(); + std::__throw_regex_error(); } } break; } @@ -3283,7 +3283,7 @@ basic_regex<_CharT, _Traits>::__parse_bracket_expression(_ForwardIterator __firs if (__first != __last && *__first == '[') { ++__first; if (__first == __last) - __throw_regex_error(); + std::__throw_regex_error(); bool __negate = false; if (*__first == '^') { ++__first; @@ -3292,20 +3292,20 @@ basic_regex<_CharT, _Traits>::__parse_bracket_expression(_ForwardIterator __firs __bracket_expression<_CharT, _Traits>* __ml = __start_matching_list(__negate); // __ml owned by *this if (__first == __last) - __throw_regex_error(); + std::__throw_regex_error(); if (__get_grammar(__flags_) != ECMAScript && *__first == ']') { __ml->__add_char(']'); ++__first; } __first = __parse_follow_list(__first, __last, __ml); if (__first == __last) - __throw_regex_error(); + std::__throw_regex_error(); if (*__first == '-') { __ml->__add_char('-'); ++__first; } if (__first == __last || *__first != ']') - __throw_regex_error(); + std::__throw_regex_error(); ++__first; } return __first; @@ -3398,7 +3398,7 @@ _ForwardIterator basic_regex<_CharT, _Traits>::__parse_class_escape( basic_string<_CharT>& __str, __bracket_expression<_CharT, _Traits>* __ml) { if (__first == __last) - __throw_regex_error(); + std::__throw_regex_error(); switch (*__first) { case 0: __str = *__first; @@ -3436,7 +3436,7 @@ template _ForwardIterator basic_regex<_CharT, _Traits>::__parse_awk_escape( _ForwardIterator __first, _ForwardIterator __last, basic_string<_CharT>* __str) { if (__first == __last) - __throw_regex_error(); + std::__throw_regex_error(); switch (*__first) { case '\\': case '"': @@ -3501,7 +3501,7 @@ _ForwardIterator basic_regex<_CharT, _Traits>::__parse_awk_escape( else __push_char(_CharT(__val)); } else - __throw_regex_error(); + std::__throw_regex_error(); return __first; } @@ -3514,11 +3514,11 @@ _ForwardIterator basic_regex<_CharT, _Traits>::__parse_equivalence_class( value_type __equal_close[2] = {'=', ']'}; _ForwardIterator __temp = std::search(__first, __last, __equal_close, __equal_close + 2); if (__temp == __last) - __throw_regex_error(); + std::__throw_regex_error(); // [__first, __temp) contains all text in [= ... =] string_type __collate_name = __traits_.lookup_collatename(__first, __temp); if (__collate_name.empty()) - __throw_regex_error(); + std::__throw_regex_error(); string_type __equiv_name = __traits_.transform_primary(__collate_name.begin(), __collate_name.end()); if (!__equiv_name.empty()) __ml->__add_equivalence(__equiv_name); @@ -3531,7 +3531,7 @@ _ForwardIterator basic_regex<_CharT, _Traits>::__parse_equivalence_class( __ml->__add_digraph(__collate_name[0], __collate_name[1]); break; default: - __throw_regex_error(); + std::__throw_regex_error(); } } __first = std::next(__temp, 2); @@ -3547,12 +3547,12 @@ _ForwardIterator basic_regex<_CharT, _Traits>::__parse_character_class( value_type __colon_close[2] = {':', ']'}; _ForwardIterator __temp = std::search(__first, __last, __colon_close, __colon_close + 2); if (__temp == __last) - __throw_regex_error(); + std::__throw_regex_error(); // [__first, __temp) contains all text in [: ... :] typedef typename _Traits::char_class_type char_class_type; char_class_type __class_type = __traits_.lookup_classname(__first, __temp, __flags_ & icase); if (__class_type == 0) - __throw_regex_error(); + std::__throw_regex_error(); __ml->__add_class(__class_type); __first = std::next(__temp, 2); return __first; @@ -3567,7 +3567,7 @@ _ForwardIterator basic_regex<_CharT, _Traits>::__parse_collating_symbol( value_type __dot_close[2] = {'.', ']'}; _ForwardIterator __temp = std::search(__first, __last, __dot_close, __dot_close + 2); if (__temp == __last) - __throw_regex_error(); + std::__throw_regex_error(); // [__first, __temp) contains all text in [. ... .] __col_sym = __traits_.lookup_collatename(__first, __temp); switch (__col_sym.size()) { @@ -3575,7 +3575,7 @@ _ForwardIterator basic_regex<_CharT, _Traits>::__parse_collating_symbol( case 2: break; default: - __throw_regex_error(); + std::__throw_regex_error(); } __first = std::next(__temp, 2); return __first; @@ -3591,7 +3591,7 @@ basic_regex<_CharT, _Traits>::__parse_DUP_COUNT(_ForwardIterator __first, _Forwa __c = __val; for (++__first; __first != __last && (__val = __traits_.value(*__first, 10)) != -1; ++__first) { if (__c >= numeric_limits::max() / 10) - __throw_regex_error(); + std::__throw_regex_error(); __c *= 10; __c += __val; } @@ -3684,7 +3684,7 @@ _ForwardIterator basic_regex<_CharT, _Traits>::__parse_assertion(_ForwardIterato __push_lookahead(std::move(__exp), false, __marked_count_); __marked_count_ += __mexp; if (__temp == __last || *__temp != ')') - __throw_regex_error(); + std::__throw_regex_error(); __first = ++__temp; } break; case '!': { @@ -3695,7 +3695,7 @@ _ForwardIterator basic_regex<_CharT, _Traits>::__parse_assertion(_ForwardIterato __push_lookahead(std::move(__exp), true, __marked_count_); __marked_count_ += __mexp; if (__temp == __last || *__temp != ')') - __throw_regex_error(); + std::__throw_regex_error(); __first = ++__temp; } break; } @@ -3725,13 +3725,13 @@ _ForwardIterator basic_regex<_CharT, _Traits>::__parse_atom(_ForwardIterator __f case '(': { ++__first; if (__first == __last) - __throw_regex_error(); + std::__throw_regex_error(); _ForwardIterator __temp = std::next(__first); if (__temp != __last && *__first == '?' && *__temp == ':') { ++__open_count_; __first = __parse_ecma_exp(++__temp, __last); if (__first == __last || *__first != ')') - __throw_regex_error(); + std::__throw_regex_error(); --__open_count_; ++__first; } else { @@ -3740,7 +3740,7 @@ _ForwardIterator basic_regex<_CharT, _Traits>::__parse_atom(_ForwardIterator __f ++__open_count_; __first = __parse_ecma_exp(__first, __last); if (__first == __last || *__first != ')') - __throw_regex_error(); + std::__throw_regex_error(); __push_end_marked_subexpression(__temp_count); --__open_count_; ++__first; @@ -3750,7 +3750,7 @@ _ForwardIterator basic_regex<_CharT, _Traits>::__parse_atom(_ForwardIterator __f case '+': case '?': case '{': - __throw_regex_error(); + std::__throw_regex_error(); break; default: __first = __parse_pattern_character(__first, __last); @@ -3766,7 +3766,7 @@ _ForwardIterator basic_regex<_CharT, _Traits>::__parse_atom_escape(_ForwardItera if (__first != __last && *__first == '\\') { _ForwardIterator __t1 = std::next(__first); if (__t1 == __last) - __throw_regex_error(); + std::__throw_regex_error(); _ForwardIterator __t2 = __parse_decimal_escape(__t1, __last); if (__t2 != __t1) @@ -3797,11 +3797,11 @@ basic_regex<_CharT, _Traits>::__parse_decimal_escape(_ForwardIterator __first, _ unsigned __v = *__first - '0'; for (++__first; __first != __last && '0' <= *__first && *__first <= '9'; ++__first) { if (__v >= numeric_limits::max() / 10) - __throw_regex_error(); + std::__throw_regex_error(); __v = 10 * __v + *__first - '0'; } if (__v == 0 || __v > mark_count()) - __throw_regex_error(); + std::__throw_regex_error(); __push_back_ref(__v); } } @@ -3905,40 +3905,40 @@ _ForwardIterator basic_regex<_CharT, _Traits>::__parse_character_escape( __push_char(_CharT(*__t % 32)); __first = ++__t; } else - __throw_regex_error(); + std::__throw_regex_error(); } else - __throw_regex_error(); + std::__throw_regex_error(); break; case 'u': ++__first; if (__first == __last) - __throw_regex_error(); + std::__throw_regex_error(); __hd = __traits_.value(*__first, 16); if (__hd == -1) - __throw_regex_error(); + std::__throw_regex_error(); __sum = 16 * __sum + static_cast(__hd); ++__first; if (__first == __last) - __throw_regex_error(); + std::__throw_regex_error(); __hd = __traits_.value(*__first, 16); if (__hd == -1) - __throw_regex_error(); + std::__throw_regex_error(); __sum = 16 * __sum + static_cast(__hd); _LIBCPP_FALLTHROUGH(); case 'x': ++__first; if (__first == __last) - __throw_regex_error(); + std::__throw_regex_error(); __hd = __traits_.value(*__first, 16); if (__hd == -1) - __throw_regex_error(); + std::__throw_regex_error(); __sum = 16 * __sum + static_cast(__hd); ++__first; if (__first == __last) - __throw_regex_error(); + std::__throw_regex_error(); __hd = __traits_.value(*__first, 16); if (__hd == -1) - __throw_regex_error(); + std::__throw_regex_error(); __sum = 16 * __sum + static_cast(__hd); if (__str) *__str = _CharT(__sum); @@ -3961,7 +3961,7 @@ _ForwardIterator basic_regex<_CharT, _Traits>::__parse_character_escape( __push_char(*__first); ++__first; } else - __throw_regex_error(); + std::__throw_regex_error(); break; } } @@ -4057,7 +4057,7 @@ bool basic_regex<_CharT, _Traits>::__test_back_ref(_CharT __c) { unsigned __val = __traits_.value(__c, 10); if (__val >= 1 && __val <= 9) { if (__val > mark_count()) - __throw_regex_error(); + std::__throw_regex_error(); __push_back_ref(__val); return true; } @@ -4778,7 +4778,7 @@ _OutputIter match_results<_BidirectionalIterator, _Allocator>::format( if (__fmt_first + 1 != __fmt_last && '0' <= __fmt_first[1] && __fmt_first[1] <= '9') { ++__fmt_first; if (__idx >= numeric_limits::max() / 10) - __throw_regex_error(); + std::__throw_regex_error(); __idx = 10 * __idx + *__fmt_first - '0'; } __output_iter = std::copy((*this)[__idx].first, (*this)[__idx].second, __output_iter); @@ -4865,7 +4865,7 @@ bool basic_regex<_CharT, _Traits>::__match_at_start_ecma( do { ++__counter; if (__counter % _LIBCPP_REGEX_COMPLEXITY_FACTOR == 0 && __counter / _LIBCPP_REGEX_COMPLEXITY_FACTOR >= __length) - __throw_regex_error(); + std::__throw_regex_error(); __state& __s = __states.back(); if (__s.__node_) __s.__node_->__exec(__s); @@ -4899,7 +4899,7 @@ bool basic_regex<_CharT, _Traits>::__match_at_start_ecma( __states.pop_back(); break; default: - __throw_regex_error(); + std::__throw_regex_error(); break; } } while (!__states.empty()); @@ -4935,7 +4935,7 @@ bool basic_regex<_CharT, _Traits>::__match_at_start_posix_nosubs( do { ++__counter; if (__counter % _LIBCPP_REGEX_COMPLEXITY_FACTOR == 0 && __counter / _LIBCPP_REGEX_COMPLEXITY_FACTOR >= __length) - __throw_regex_error(); + std::__throw_regex_error(); __state& __s = __states.back(); if (__s.__node_) __s.__node_->__exec(__s); @@ -4976,7 +4976,7 @@ bool basic_regex<_CharT, _Traits>::__match_at_start_posix_nosubs( __states.pop_back(); break; default: - __throw_regex_error(); + std::__throw_regex_error(); break; } } while (!__states.empty()); @@ -5025,7 +5025,7 @@ bool basic_regex<_CharT, _Traits>::__match_at_start_posix_subs( do { ++__counter; if (__counter % _LIBCPP_REGEX_COMPLEXITY_FACTOR == 0 && __counter / _LIBCPP_REGEX_COMPLEXITY_FACTOR >= __length) - __throw_regex_error(); + std::__throw_regex_error(); __state& __s = __states.back(); if (__s.__node_) __s.__node_->__exec(__s); @@ -5063,7 +5063,7 @@ bool basic_regex<_CharT, _Traits>::__match_at_start_posix_subs( __states.pop_back(); break; default: - __throw_regex_error(); + std::__throw_regex_error(); break; } } while (!__states.empty()); diff --git a/libcxx/include/set b/libcxx/include/set index 3c6ea360bd06..bd7bfef1f3e2 100644 --- a/libcxx/include/set +++ b/libcxx/include/set @@ -709,7 +709,7 @@ public: } # endif // _LIBCPP_CXX03_LANG - _LIBCPP_HIDE_FROM_ABI ~set() { static_assert(sizeof(__diagnose_non_const_comparator<_Key, _Compare>()), ""); } + _LIBCPP_HIDE_FROM_ABI ~set() { static_assert(sizeof(std::__diagnose_non_const_comparator<_Key, _Compare>()), ""); } _LIBCPP_HIDE_FROM_ABI iterator begin() _NOEXCEPT { return __tree_.begin(); } _LIBCPP_HIDE_FROM_ABI const_iterator begin() const _NOEXCEPT { return __tree_.begin(); } @@ -1174,7 +1174,9 @@ public: } # endif // _LIBCPP_CXX03_LANG - _LIBCPP_HIDE_FROM_ABI ~multiset() { static_assert(sizeof(__diagnose_non_const_comparator<_Key, _Compare>()), ""); } + _LIBCPP_HIDE_FROM_ABI ~multiset() { + static_assert(sizeof(std::__diagnose_non_const_comparator<_Key, _Compare>()), ""); + } _LIBCPP_HIDE_FROM_ABI iterator begin() _NOEXCEPT { return __tree_.begin(); } _LIBCPP_HIDE_FROM_ABI const_iterator begin() const _NOEXCEPT { return __tree_.begin(); } diff --git a/libcxx/include/shared_mutex b/libcxx/include/shared_mutex index 6738efeedb3c..b1e2a5d43440 100644 --- a/libcxx/include/shared_mutex +++ b/libcxx/include/shared_mutex @@ -400,9 +400,9 @@ _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(shared_lock); template void shared_lock<_Mutex>::lock() { if (__m_ == nullptr) - __throw_system_error(EPERM, "shared_lock::lock: references null mutex"); + std::__throw_system_error(EPERM, "shared_lock::lock: references null mutex"); if (__owns_) - __throw_system_error(EDEADLK, "shared_lock::lock: already locked"); + std::__throw_system_error(EDEADLK, "shared_lock::lock: already locked"); __m_->lock_shared(); __owns_ = true; } @@ -410,9 +410,9 @@ void shared_lock<_Mutex>::lock() { template bool shared_lock<_Mutex>::try_lock() { if (__m_ == nullptr) - __throw_system_error(EPERM, "shared_lock::try_lock: references null mutex"); + std::__throw_system_error(EPERM, "shared_lock::try_lock: references null mutex"); if (__owns_) - __throw_system_error(EDEADLK, "shared_lock::try_lock: already locked"); + std::__throw_system_error(EDEADLK, "shared_lock::try_lock: already locked"); __owns_ = __m_->try_lock_shared(); return __owns_; } @@ -421,9 +421,9 @@ template template bool shared_lock<_Mutex>::try_lock_for(const chrono::duration<_Rep, _Period>& __d) { if (__m_ == nullptr) - __throw_system_error(EPERM, "shared_lock::try_lock_for: references null mutex"); + std::__throw_system_error(EPERM, "shared_lock::try_lock_for: references null mutex"); if (__owns_) - __throw_system_error(EDEADLK, "shared_lock::try_lock_for: already locked"); + std::__throw_system_error(EDEADLK, "shared_lock::try_lock_for: already locked"); __owns_ = __m_->try_lock_shared_for(__d); return __owns_; } @@ -432,9 +432,9 @@ template template bool shared_lock<_Mutex>::try_lock_until(const chrono::time_point<_Clock, _Duration>& __t) { if (__m_ == nullptr) - __throw_system_error(EPERM, "shared_lock::try_lock_until: references null mutex"); + std::__throw_system_error(EPERM, "shared_lock::try_lock_until: references null mutex"); if (__owns_) - __throw_system_error(EDEADLK, "shared_lock::try_lock_until: already locked"); + std::__throw_system_error(EDEADLK, "shared_lock::try_lock_until: already locked"); __owns_ = __m_->try_lock_shared_until(__t); return __owns_; } @@ -442,7 +442,7 @@ bool shared_lock<_Mutex>::try_lock_until(const chrono::time_point<_Clock, _Durat template void shared_lock<_Mutex>::unlock() { if (!__owns_) - __throw_system_error(EPERM, "shared_lock::unlock: not locked"); + std::__throw_system_error(EPERM, "shared_lock::unlock: not locked"); __m_->unlock_shared(); __owns_ = false; } diff --git a/libcxx/include/string b/libcxx/include/string index 3f43e8fd8d58..e2968621bb31 100644 --- a/libcxx/include/string +++ b/libcxx/include/string @@ -907,7 +907,7 @@ private: __uninitialized_size_tag, size_type __size, const allocator_type& __a) : __alloc_(__a) { if (__size > max_size()) - __throw_length_error(); + this->__throw_length_error(); if (__fits_in_sso(__size)) { __rep_ = __rep(); __set_short_size(__size); @@ -1076,7 +1076,7 @@ public: basic_string&& __str, size_type __pos, size_type __n, const _Allocator& __alloc = _Allocator()) : __alloc_(__alloc) { if (__pos > __str.size()) - __throw_out_of_range(); + this->__throw_out_of_range(); auto __len = std::min(__n, __str.size() - __pos); if (__alloc_traits::is_always_equal::value || __alloc == __str.__alloc_) { @@ -1099,7 +1099,7 @@ public: : __alloc_(__a) { size_type __str_sz = __str.size(); if (__pos > __str_sz) - __throw_out_of_range(); + this->__throw_out_of_range(); __init(__str.data() + __pos, std::min(__n, __str_sz - __pos)); } @@ -1108,7 +1108,7 @@ public: : __alloc_(__a) { size_type __str_sz = __str.size(); if (__pos > __str_sz) - __throw_out_of_range(); + this->__throw_out_of_range(); __init(__str.data() + __pos, __str_sz - __pos); } @@ -2455,7 +2455,7 @@ basic_string<_CharT, _Traits, _Allocator>::__init(const value_type* __s, size_ty if (__libcpp_is_constant_evaluated()) __rep_ = __rep(); if (__sz > max_size()) - __throw_length_error(); + this->__throw_length_error(); pointer __p; if (__fits_in_sso(__sz)) { __set_short_size(__sz); @@ -2485,7 +2485,7 @@ basic_string<_CharT, _Traits, _Allocator>::__init_copy_ctor_external(const value __set_short_size(__sz); } else { if (__sz > max_size()) - __throw_length_error(); + this->__throw_length_error(); auto __allocation = std::__allocate_at_least(__alloc_, __recommend(__sz) + 1); __p = __allocation.ptr; __begin_lifetime(__p, __allocation.count); @@ -2503,7 +2503,7 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 void basic_string<_CharT, _Traits, _Allocator>::__ __rep_ = __rep(); if (__n > max_size()) - __throw_length_error(); + this->__throw_length_error(); pointer __p; if (__fits_in_sso(__n)) { __set_short_size(__n); @@ -2566,7 +2566,7 @@ basic_string<_CharT, _Traits, _Allocator>::__init_with_size(_InputIterator __fir __rep_ = __rep(); if (__sz > max_size()) - __throw_length_error(); + this->__throw_length_error(); pointer __p; if (__fits_in_sso(__sz)) { @@ -2608,7 +2608,7 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 void basic_string<_CharT, _Traits, _Allocator>::__ const value_type* __p_new_stuff) { size_type __ms = max_size(); if (__delta_cap > __ms - __old_cap - 1) - __throw_length_error(); + this->__throw_length_error(); pointer __old_p = __get_pointer(); size_type __cap = __old_cap < __ms / 2 - __alignment ? __recommend(std::max(__old_cap + __delta_cap, 2 * __old_cap)) : __ms - 1; @@ -2651,7 +2651,7 @@ _LIBCPP_DEPRECATED_("use __grow_by_without_replace") basic_string<_CharT, _Trait size_type __n_add) { size_type __ms = max_size(); if (__delta_cap > __ms - __old_cap) - __throw_length_error(); + this->__throw_length_error(); pointer __old_p = __get_pointer(); size_type __cap = __old_cap < __ms / 2 - __alignment ? __recommend(std::max(__old_cap + __delta_cap, 2 * __old_cap)) : __ms - 1; @@ -2921,7 +2921,7 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<_CharT, _Traits, _Allocator>& basic_string<_CharT, _Traits, _Allocator>::assign(const basic_string& __str, size_type __pos, size_type __n) { size_type __sz = __str.size(); if (__pos > __sz) - __throw_out_of_range(); + this->__throw_out_of_range(); return assign(__str.data() + __pos, std::min(__n, __sz - __pos)); } @@ -2935,7 +2935,7 @@ basic_string<_CharT, _Traits, _Allocator>::assign(const _Tp& __t, size_type __po __self_view __sv = __t; size_type __sz = __sv.size(); if (__pos > __sz) - __throw_out_of_range(); + this->__throw_out_of_range(); return assign(__sv.data() + __pos, std::min(__n, __sz - __pos)); } @@ -3068,7 +3068,7 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<_CharT, _Traits, _Allocator>& basic_string<_CharT, _Traits, _Allocator>::append(const basic_string& __str, size_type __pos, size_type __n) { size_type __sz = __str.size(); if (__pos > __sz) - __throw_out_of_range(); + this->__throw_out_of_range(); return append(__str.data() + __pos, std::min(__n, __sz - __pos)); } @@ -3082,7 +3082,7 @@ basic_string<_CharT, _Traits, _Allocator>::append(const _Tp& __t, size_type __po __self_view __sv = __t; size_type __sz = __sv.size(); if (__pos > __sz) - __throw_out_of_range(); + this->__throw_out_of_range(); return append(__sv.data() + __pos, std::min(__n, __sz - __pos)); } @@ -3101,7 +3101,7 @@ basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos, const value_t _LIBCPP_ASSERT_NON_NULL(__n == 0 || __s != nullptr, "string::insert received nullptr"); size_type __sz = size(); if (__pos > __sz) - __throw_out_of_range(); + this->__throw_out_of_range(); size_type __cap = capacity(); if (__cap - __sz >= __n) { if (__n) { @@ -3128,7 +3128,7 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<_CharT, _Traits, _Allocator>& basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos, size_type __n, value_type __c) { size_type __sz = size(); if (__pos > __sz) - __throw_out_of_range(); + this->__throw_out_of_range(); if (__n) { size_type __cap = capacity(); value_type* __p; @@ -3190,7 +3190,7 @@ basic_string<_CharT, _Traits, _Allocator>::insert( size_type __pos1, const basic_string& __str, size_type __pos2, size_type __n) { size_type __str_sz = __str.size(); if (__pos2 > __str_sz) - __throw_out_of_range(); + this->__throw_out_of_range(); return insert(__pos1, __str.data() + __pos2, std::min(__n, __str_sz - __pos2)); } @@ -3204,7 +3204,7 @@ basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos1, const _Tp& _ __self_view __sv = __t; size_type __str_sz = __sv.size(); if (__pos2 > __str_sz) - __throw_out_of_range(); + this->__throw_out_of_range(); return insert(__pos1, __sv.data() + __pos2, std::min(__n, __str_sz - __pos2)); } @@ -3248,7 +3248,7 @@ basic_string<_CharT, _Traits, _Allocator>::replace( _LIBCPP_ASSERT_NON_NULL(__n2 == 0 || __s != nullptr, "string::replace received nullptr"); size_type __sz = size(); if (__pos > __sz) - __throw_out_of_range(); + this->__throw_out_of_range(); __n1 = std::min(__n1, __sz - __pos); size_type __cap = capacity(); if (__cap - __sz + __n1 >= __n2) { @@ -3290,7 +3290,7 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<_CharT, _Traits, _Allocator>& basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos, size_type __n1, size_type __n2, value_type __c) { size_type __sz = size(); if (__pos > __sz) - __throw_out_of_range(); + this->__throw_out_of_range(); __n1 = std::min(__n1, __sz - __pos); size_type __cap = capacity(); value_type* __p; @@ -3326,7 +3326,7 @@ basic_string<_CharT, _Traits, _Allocator>::replace( size_type __pos1, size_type __n1, const basic_string& __str, size_type __pos2, size_type __n2) { size_type __str_sz = __str.size(); if (__pos2 > __str_sz) - __throw_out_of_range(); + this->__throw_out_of_range(); return replace(__pos1, __n1, __str.data() + __pos2, std::min(__n2, __str_sz - __pos2)); } @@ -3341,7 +3341,7 @@ basic_string<_CharT, _Traits, _Allocator>::replace( __self_view __sv = __t; size_type __str_sz = __sv.size(); if (__pos2 > __str_sz) - __throw_out_of_range(); + this->__throw_out_of_range(); return replace(__pos1, __n1, __sv.data() + __pos2, std::min(__n2, __str_sz - __pos2)); } @@ -3374,7 +3374,7 @@ template _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<_CharT, _Traits, _Allocator>& basic_string<_CharT, _Traits, _Allocator>::erase(size_type __pos, size_type __n) { if (__pos > size()) - __throw_out_of_range(); + this->__throw_out_of_range(); if (__n == npos) { __erase_to_end(__pos); } else { @@ -3445,7 +3445,7 @@ basic_string<_CharT, _Traits, _Allocator>::__resize_default_init(size_type __n) template _LIBCPP_CONSTEXPR_SINCE_CXX20 void basic_string<_CharT, _Traits, _Allocator>::reserve(size_type __requested_capacity) { if (__requested_capacity > max_size()) - __throw_length_error(); + this->__throw_length_error(); // Make sure reserve(n) never shrinks. This is technically only required in C++20 // and later (since P0966R1), however we provide consistent behavior in all Standard @@ -3517,7 +3517,7 @@ template _LIBCPP_CONSTEXPR_SINCE_CXX20 typename basic_string<_CharT, _Traits, _Allocator>::const_reference basic_string<_CharT, _Traits, _Allocator>::at(size_type __n) const { if (__n >= size()) - __throw_out_of_range(); + this->__throw_out_of_range(); return (*this)[__n]; } @@ -3525,7 +3525,7 @@ template _LIBCPP_CONSTEXPR_SINCE_CXX20 typename basic_string<_CharT, _Traits, _Allocator>::reference basic_string<_CharT, _Traits, _Allocator>::at(size_type __n) { if (__n >= size()) - __throw_out_of_range(); + this->__throw_out_of_range(); return (*this)[__n]; } @@ -3534,7 +3534,7 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 typename basic_string<_CharT, _Traits, _Allocator> basic_string<_CharT, _Traits, _Allocator>::copy(value_type* __s, size_type __n, size_type __pos) const { size_type __sz = size(); if (__pos > __sz) - __throw_out_of_range(); + this->__throw_out_of_range(); size_type __rlen = std::min(__n, __sz - __pos); traits_type::copy(__s, data() + __pos, __rlen); return __rlen; @@ -3588,7 +3588,7 @@ inline _LIBCPP_CONSTEXPR_SINCE_CXX20 int basic_string<_CharT, _Traits, _Allocato _LIBCPP_ASSERT_NON_NULL(__n2 == 0 || __s != nullptr, "string::compare(): received nullptr"); size_type __sz = size(); if (__pos1 > __sz || __n2 == npos) - __throw_out_of_range(); + this->__throw_out_of_range(); size_type __rlen = std::min(__n1, __sz - __pos1); int __r = traits_type::compare(data() + __pos1, __s, std::min(__rlen, __n2)); if (__r == 0) { diff --git a/libcxx/include/string_view b/libcxx/include/string_view index e79746318cfa..c640ae4e7986 100644 --- a/libcxx/include/string_view +++ b/libcxx/include/string_view @@ -447,7 +447,7 @@ public: _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type copy(_CharT* __s, size_type __n, size_type __pos = 0) const { if (__pos > size()) - __throw_out_of_range("string_view::copy"); + std::__throw_out_of_range("string_view::copy"); size_type __rlen = std::min(__n, size() - __pos); _Traits::copy(__s, data() + __pos, __rlen); return __rlen; diff --git a/libcxx/include/unordered_map b/libcxx/include/unordered_map index 76623d024275..be36b65cb85b 100644 --- a/libcxx/include/unordered_map +++ b/libcxx/include/unordered_map @@ -1784,7 +1784,7 @@ template _Tp& unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::at(const key_type& __k) { iterator __i = find(__k); if (__i == end()) - __throw_out_of_range("unordered_map::at: key not found"); + std::__throw_out_of_range("unordered_map::at: key not found"); return __i->second; } @@ -1792,7 +1792,7 @@ template const _Tp& unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::at(const key_type& __k) const { const_iterator __i = find(__k); if (__i == end()) - __throw_out_of_range("unordered_map::at: key not found"); + std::__throw_out_of_range("unordered_map::at: key not found"); return __i->second; } diff --git a/libcxx/include/variant b/libcxx/include/variant index 9998d4a45771..9e78ff2cc1a4 100644 --- a/libcxx/include/variant +++ b/libcxx/include/variant @@ -409,7 +409,8 @@ template <> struct __find_unambiguous_index_sfinae_impl<__ambiguous> {}; template -struct __find_unambiguous_index_sfinae : __find_unambiguous_index_sfinae_impl<__find_index<_Tp, _Types...>()> {}; +struct __find_unambiguous_index_sfinae + : __find_unambiguous_index_sfinae_impl<__find_detail::__find_index<_Tp, _Types...>()> {}; } // namespace __find_detail @@ -1341,7 +1342,7 @@ template _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS constexpr auto&& __generic_get(_Vp&& __v) { using __variant_detail::__access::__variant; if (!std::__holds_alternative<_Ip>(__v)) { - __throw_bad_variant_access(); + std::__throw_bad_variant_access(); } return __variant::__get_alt<_Ip>(std::forward<_Vp>(__v)).__value; } @@ -1554,7 +1555,7 @@ template _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS constexpr void __throw_if_valueless(_Vs&&... __vs) { const bool __valueless = (... || std::__as_variant(__vs).valueless_by_exception()); if (__valueless) { - __throw_bad_variant_access(); + std::__throw_bad_variant_access(); } } diff --git a/libcxx/src/chrono.cpp b/libcxx/src/chrono.cpp index dbc0f617b4fc..20387ea76124 100644 --- a/libcxx/src/chrono.cpp +++ b/libcxx/src/chrono.cpp @@ -124,7 +124,7 @@ static system_clock::time_point __libcpp_system_clock_now() { static system_clock::time_point __libcpp_system_clock_now() { struct timespec ts; if (timespec_get(&ts, TIME_UTC) != TIME_UTC) - __throw_system_error(errno, "timespec_get(TIME_UTC) failed"); + std::__throw_system_error(errno, "timespec_get(TIME_UTC) failed"); return system_clock::time_point(seconds(ts.tv_sec) + microseconds(ts.tv_nsec / 1000)); } @@ -133,7 +133,7 @@ static system_clock::time_point __libcpp_system_clock_now() { static system_clock::time_point __libcpp_system_clock_now() { struct timespec tp; if (0 != clock_gettime(CLOCK_REALTIME, &tp)) - __throw_system_error(errno, "clock_gettime(CLOCK_REALTIME) failed"); + std::__throw_system_error(errno, "clock_gettime(CLOCK_REALTIME) failed"); return system_clock::time_point(seconds(tp.tv_sec) + microseconds(tp.tv_nsec / 1000)); } @@ -180,7 +180,7 @@ system_clock::time_point system_clock::from_time_t(time_t t) noexcept { return s static steady_clock::time_point __libcpp_steady_clock_now() { struct timespec tp; if (0 != clock_gettime(CLOCK_MONOTONIC_RAW, &tp)) - __throw_system_error(errno, "clock_gettime(CLOCK_MONOTONIC_RAW) failed"); + std::__throw_system_error(errno, "clock_gettime(CLOCK_MONOTONIC_RAW) failed"); return steady_clock::time_point(seconds(tp.tv_sec) + nanoseconds(tp.tv_nsec)); } @@ -213,7 +213,7 @@ static steady_clock::time_point __libcpp_steady_clock_now() { static steady_clock::time_point __libcpp_steady_clock_now() { struct timespec64 ts; if (0 != gettimeofdayMonotonic(&ts)) - __throw_system_error(errno, "failed to obtain time of day"); + std::__throw_system_error(errno, "failed to obtain time of day"); return steady_clock::time_point(seconds(ts.tv_sec) + nanoseconds(ts.tv_nsec)); } @@ -234,7 +234,7 @@ static steady_clock::time_point __libcpp_steady_clock_now() noexcept { static steady_clock::time_point __libcpp_steady_clock_now() { struct timespec ts; if (timespec_get(&ts, TIME_MONOTONIC) != TIME_MONOTONIC) - __throw_system_error(errno, "timespec_get(TIME_MONOTONIC) failed"); + std::__throw_system_error(errno, "timespec_get(TIME_MONOTONIC) failed"); return steady_clock::time_point(seconds(ts.tv_sec) + microseconds(ts.tv_nsec / 1000)); } @@ -243,7 +243,7 @@ static steady_clock::time_point __libcpp_steady_clock_now() { static steady_clock::time_point __libcpp_steady_clock_now() { struct timespec tp; if (0 != clock_gettime(CLOCK_MONOTONIC, &tp)) - __throw_system_error(errno, "clock_gettime(CLOCK_MONOTONIC) failed"); + std::__throw_system_error(errno, "clock_gettime(CLOCK_MONOTONIC) failed"); return steady_clock::time_point(seconds(tp.tv_sec) + nanoseconds(tp.tv_nsec)); } diff --git a/libcxx/src/condition_variable.cpp b/libcxx/src/condition_variable.cpp index db60571cf5f5..b3747603dd34 100644 --- a/libcxx/src/condition_variable.cpp +++ b/libcxx/src/condition_variable.cpp @@ -26,17 +26,17 @@ void condition_variable::notify_all() noexcept { __libcpp_condvar_broadcast(&__c void condition_variable::wait(unique_lock& lk) noexcept { if (!lk.owns_lock()) - __throw_system_error(EPERM, "condition_variable::wait: mutex not locked"); + std::__throw_system_error(EPERM, "condition_variable::wait: mutex not locked"); int ec = __libcpp_condvar_wait(&__cv_, lk.mutex()->native_handle()); if (ec) - __throw_system_error(ec, "condition_variable wait failed"); + std::__throw_system_error(ec, "condition_variable wait failed"); } void condition_variable::__do_timed_wait(unique_lock& lk, chrono::time_point tp) noexcept { using namespace chrono; if (!lk.owns_lock()) - __throw_system_error(EPERM, "condition_variable::timed wait: mutex not locked"); + std::__throw_system_error(EPERM, "condition_variable::timed wait: mutex not locked"); nanoseconds d = tp.time_since_epoch(); if (d > nanoseconds(0x59682F000000E941)) d = nanoseconds(0x59682F000000E941); @@ -53,7 +53,7 @@ void condition_variable::__do_timed_wait(unique_lock& lk, } int ec = __libcpp_condvar_timedwait(&__cv_, lk.mutex()->native_handle(), &ts); if (ec != 0 && ec != ETIMEDOUT) - __throw_system_error(ec, "condition_variable timed_wait failed"); + std::__throw_system_error(ec, "condition_variable timed_wait failed"); } void notify_all_at_thread_exit(condition_variable& cond, unique_lock lk) { diff --git a/libcxx/src/filesystem/error.h b/libcxx/src/filesystem/error.h index c0213910b378..7d81d4b6d214 100644 --- a/libcxx/src/filesystem/error.h +++ b/libcxx/src/filesystem/error.h @@ -96,11 +96,11 @@ struct ErrorHandler { string what = string("in ") + func_name_; switch (bool(p1_) + bool(p2_)) { case 0: - __throw_filesystem_error(what, ec); + filesystem::__throw_filesystem_error(what, ec); case 1: - __throw_filesystem_error(what, *p1_, ec); + filesystem::__throw_filesystem_error(what, *p1_, ec); case 2: - __throw_filesystem_error(what, *p1_, *p2_, ec); + filesystem::__throw_filesystem_error(what, *p1_, *p2_, ec); } __libcpp_unreachable(); } @@ -114,11 +114,11 @@ struct ErrorHandler { string what = string("in ") + func_name_ + ": " + detail::vformat_string(msg, ap); switch (bool(p1_) + bool(p2_)) { case 0: - __throw_filesystem_error(what, ec); + filesystem::__throw_filesystem_error(what, ec); case 1: - __throw_filesystem_error(what, *p1_, ec); + filesystem::__throw_filesystem_error(what, *p1_, ec); case 2: - __throw_filesystem_error(what, *p1_, *p2_, ec); + filesystem::__throw_filesystem_error(what, *p1_, *p2_, ec); } __libcpp_unreachable(); } diff --git a/libcxx/src/filesystem/filesystem_clock.cpp b/libcxx/src/filesystem/filesystem_clock.cpp index e1f887072201..bec082f61c9d 100644 --- a/libcxx/src/filesystem/filesystem_clock.cpp +++ b/libcxx/src/filesystem/filesystem_clock.cpp @@ -58,13 +58,13 @@ _FilesystemClock::time_point _FilesystemClock::now() noexcept { typedef chrono::duration __nsecs; struct timespec ts; if (timespec_get(&ts, TIME_UTC) != TIME_UTC) - __throw_system_error(errno, "timespec_get(TIME_UTC) failed"); + std::__throw_system_error(errno, "timespec_get(TIME_UTC) failed"); return time_point(__secs(ts.tv_sec) + chrono::duration_cast(__nsecs(ts.tv_nsec))); #elif defined(_LIBCPP_HAS_CLOCK_GETTIME) typedef chrono::duration __nsecs; struct timespec tp; if (0 != clock_gettime(CLOCK_REALTIME, &tp)) - __throw_system_error(errno, "clock_gettime(CLOCK_REALTIME) failed"); + std::__throw_system_error(errno, "clock_gettime(CLOCK_REALTIME) failed"); return time_point(__secs(tp.tv_sec) + chrono::duration_cast(__nsecs(tp.tv_nsec))); #else typedef chrono::duration __microsecs; diff --git a/libcxx/src/future.cpp b/libcxx/src/future.cpp index 04e6fb8db645..7bba635e9006 100644 --- a/libcxx/src/future.cpp +++ b/libcxx/src/future.cpp @@ -62,7 +62,7 @@ void __assoc_sub_state::__on_zero_shared() noexcept { delete this; } void __assoc_sub_state::set_value() { unique_lock __lk(__mut_); if (__has_value()) - __throw_future_error(future_errc::promise_already_satisfied); + std::__throw_future_error(future_errc::promise_already_satisfied); __state_ |= __constructed | ready; __cv_.notify_all(); } @@ -70,7 +70,7 @@ void __assoc_sub_state::set_value() { void __assoc_sub_state::set_value_at_thread_exit() { unique_lock __lk(__mut_); if (__has_value()) - __throw_future_error(future_errc::promise_already_satisfied); + std::__throw_future_error(future_errc::promise_already_satisfied); __state_ |= __constructed; __thread_local_data()->__make_ready_at_thread_exit(this); } @@ -78,7 +78,7 @@ void __assoc_sub_state::set_value_at_thread_exit() { void __assoc_sub_state::set_exception(exception_ptr __p) { unique_lock __lk(__mut_); if (__has_value()) - __throw_future_error(future_errc::promise_already_satisfied); + std::__throw_future_error(future_errc::promise_already_satisfied); __exception_ = __p; __state_ |= ready; __cv_.notify_all(); @@ -87,7 +87,7 @@ void __assoc_sub_state::set_exception(exception_ptr __p) { void __assoc_sub_state::set_exception_at_thread_exit(exception_ptr __p) { unique_lock __lk(__mut_); if (__has_value()) - __throw_future_error(future_errc::promise_already_satisfied); + std::__throw_future_error(future_errc::promise_already_satisfied); __exception_ = __p; __thread_local_data()->__make_ready_at_thread_exit(this); } @@ -122,7 +122,7 @@ void __assoc_sub_state::__sub_wait(unique_lock& __lk) { } } -void __assoc_sub_state::__execute() { __throw_future_error(future_errc::no_state); } +void __assoc_sub_state::__execute() { std::__throw_future_error(future_errc::no_state); } future::future(__assoc_sub_state* __state) : __state_(__state) { __state_->__attach_future(); } @@ -152,31 +152,31 @@ promise::~promise() { future promise::get_future() { if (__state_ == nullptr) - __throw_future_error(future_errc::no_state); + std::__throw_future_error(future_errc::no_state); return future(__state_); } void promise::set_value() { if (__state_ == nullptr) - __throw_future_error(future_errc::no_state); + std::__throw_future_error(future_errc::no_state); __state_->set_value(); } void promise::set_exception(exception_ptr __p) { if (__state_ == nullptr) - __throw_future_error(future_errc::no_state); + std::__throw_future_error(future_errc::no_state); __state_->set_exception(__p); } void promise::set_value_at_thread_exit() { if (__state_ == nullptr) - __throw_future_error(future_errc::no_state); + std::__throw_future_error(future_errc::no_state); __state_->set_value_at_thread_exit(); } void promise::set_exception_at_thread_exit(exception_ptr __p) { if (__state_ == nullptr) - __throw_future_error(future_errc::no_state); + std::__throw_future_error(future_errc::no_state); __state_->set_exception_at_thread_exit(__p); } diff --git a/libcxx/src/hash.cpp b/libcxx/src/hash.cpp index 34b02b8eafc2..41c4eb480a5f 100644 --- a/libcxx/src/hash.cpp +++ b/libcxx/src/hash.cpp @@ -55,13 +55,13 @@ const unsigned indices[] = { template inline _LIBCPP_HIDE_FROM_ABI typename enable_if<_Sz == 4, void>::type __check_for_overflow(size_t N) { if (N > 0xFFFFFFFB) - __throw_overflow_error("__next_prime overflow"); + std::__throw_overflow_error("__next_prime overflow"); } template inline _LIBCPP_HIDE_FROM_ABI typename enable_if<_Sz == 8, void>::type __check_for_overflow(size_t N) { if (N > 0xFFFFFFFFFFFFFFC5ull) - __throw_overflow_error("__next_prime overflow"); + std::__throw_overflow_error("__next_prime overflow"); } size_t __next_prime(size_t n) { diff --git a/libcxx/src/ios.cpp b/libcxx/src/ios.cpp index 4bb6f80e0ec3..02ce4841187f 100644 --- a/libcxx/src/ios.cpp +++ b/libcxx/src/ios.cpp @@ -217,7 +217,7 @@ void ios_base::clear(iostate state) { __rdstate_ = state | badbit; if (((state | (__rdbuf_ ? goodbit : badbit)) & __exceptions_) != 0) - __throw_failure("ios_base::clear"); + std::__throw_failure("ios_base::clear"); } // init @@ -253,24 +253,24 @@ void ios_base::copyfmt(const ios_base& rhs) { size_t newesize = sizeof(event_callback) * rhs.__event_size_; new_callbacks.reset(static_cast(malloc(newesize))); if (!new_callbacks) - __throw_bad_alloc(); + std::__throw_bad_alloc(); size_t newisize = sizeof(int) * rhs.__event_size_; new_ints.reset(static_cast(malloc(newisize))); if (!new_ints) - __throw_bad_alloc(); + std::__throw_bad_alloc(); } if (__iarray_cap_ < rhs.__iarray_size_) { size_t newsize = sizeof(long) * rhs.__iarray_size_; new_longs.reset(static_cast(malloc(newsize))); if (!new_longs) - __throw_bad_alloc(); + std::__throw_bad_alloc(); } if (__parray_cap_ < rhs.__parray_size_) { size_t newsize = sizeof(void*) * rhs.__parray_size_; new_pointers.reset(static_cast(malloc(newsize))); if (!new_pointers) - __throw_bad_alloc(); + std::__throw_bad_alloc(); } // Got everything we need. Copy everything but __rdstate_, __rdbuf_ and __exceptions_ __fmtflags_ = rhs.__fmtflags_; diff --git a/libcxx/src/locale.cpp b/libcxx/src/locale.cpp index b5908bf8be72..9ea59a3a19ca 100644 --- a/libcxx/src/locale.cpp +++ b/libcxx/src/locale.cpp @@ -482,7 +482,7 @@ void locale::__imp::install(facet* f, long id) { const locale::facet* locale::__imp::use_facet(long id) const { if (!has_facet(id)) - __throw_bad_cast(); + std::__throw_bad_cast(); return facets_[static_cast(id)]; } @@ -602,7 +602,7 @@ long locale::id::__get() { collate_byname::collate_byname(const char* n, size_t refs) : collate(refs), __l_(__locale::__newlocale(_LIBCPP_ALL_MASK, n, 0)) { if (__l_ == 0) - __throw_runtime_error( + std::__throw_runtime_error( ("collate_byname::collate_byname" " failed to construct for " + string(n)) @@ -612,7 +612,7 @@ collate_byname::collate_byname(const char* n, size_t refs) collate_byname::collate_byname(const string& name, size_t refs) : collate(refs), __l_(__locale::__newlocale(_LIBCPP_ALL_MASK, name.c_str(), 0)) { if (__l_ == 0) - __throw_runtime_error( + std::__throw_runtime_error( ("collate_byname::collate_byname" " failed to construct for " + name) @@ -646,7 +646,7 @@ collate_byname::string_type collate_byname::do_transform(const char_ collate_byname::collate_byname(const char* n, size_t refs) : collate(refs), __l_(__locale::__newlocale(_LIBCPP_ALL_MASK, n, 0)) { if (__l_ == 0) - __throw_runtime_error( + std::__throw_runtime_error( ("collate_byname::collate_byname(size_t refs)" " failed to construct for " + string(n)) @@ -656,7 +656,7 @@ collate_byname::collate_byname(const char* n, size_t refs) collate_byname::collate_byname(const string& name, size_t refs) : collate(refs), __l_(__locale::__newlocale(_LIBCPP_ALL_MASK, name.c_str(), 0)) { if (__l_ == 0) - __throw_runtime_error( + std::__throw_runtime_error( ("collate_byname::collate_byname(size_t refs)" " failed to construct for " + name) @@ -1049,7 +1049,7 @@ const unsigned short* ctype::__classic_upper_table() _NOEXCEPT { ctype_byname::ctype_byname(const char* name, size_t refs) : ctype(0, false, refs), __l_(__locale::__newlocale(_LIBCPP_ALL_MASK, name, 0)) { if (__l_ == 0) - __throw_runtime_error( + std::__throw_runtime_error( ("ctype_byname::ctype_byname" " failed to construct for " + string(name)) @@ -1059,7 +1059,7 @@ ctype_byname::ctype_byname(const char* name, size_t refs) ctype_byname::ctype_byname(const string& name, size_t refs) : ctype(0, false, refs), __l_(__locale::__newlocale(_LIBCPP_ALL_MASK, name.c_str(), 0)) { if (__l_ == 0) - __throw_runtime_error( + std::__throw_runtime_error( ("ctype_byname::ctype_byname" " failed to construct for " + name) @@ -1094,7 +1094,7 @@ const char* ctype_byname::do_tolower(char_type* low, const char_type* high ctype_byname::ctype_byname(const char* name, size_t refs) : ctype(refs), __l_(__locale::__newlocale(_LIBCPP_ALL_MASK, name, 0)) { if (__l_ == 0) - __throw_runtime_error( + std::__throw_runtime_error( ("ctype_byname::ctype_byname" " failed to construct for " + string(name)) @@ -1104,7 +1104,7 @@ ctype_byname::ctype_byname(const char* name, size_t refs) ctype_byname::ctype_byname(const string& name, size_t refs) : ctype(refs), __l_(__locale::__newlocale(_LIBCPP_ALL_MASK, name.c_str(), 0)) { if (__l_ == 0) - __throw_runtime_error( + std::__throw_runtime_error( ("ctype_byname::ctype_byname" " failed to construct for " + name) @@ -1344,7 +1344,7 @@ codecvt::codecvt(size_t refs) : locale::facet(refs), _ codecvt::codecvt(const char* nm, size_t refs) : locale::facet(refs), __l_(__locale::__newlocale(_LIBCPP_ALL_MASK, nm, 0)) { if (__l_ == 0) - __throw_runtime_error( + std::__throw_runtime_error( ("codecvt_byname::codecvt_byname" " failed to construct for " + string(nm)) @@ -4061,7 +4061,7 @@ void numpunct_byname::__init(const char* nm) { if (strcmp(nm, "C") != 0) { __libcpp_unique_locale loc(nm); if (!loc) - __throw_runtime_error( + std::__throw_runtime_error( ("numpunct_byname::numpunct_byname" " failed to construct for " + string(nm)) @@ -4092,7 +4092,7 @@ void numpunct_byname::__init(const char* nm) { if (strcmp(nm, "C") != 0) { __libcpp_unique_locale loc(nm); if (!loc) - __throw_runtime_error( + std::__throw_runtime_error( ("numpunct_byname::numpunct_byname" " failed to construct for " + string(nm)) @@ -4444,12 +4444,12 @@ const wstring& __time_get_c_storage::__r() const { __time_get::__time_get(const char* nm) : __loc_(__locale::__newlocale(_LIBCPP_ALL_MASK, nm, 0)) { if (__loc_ == 0) - __throw_runtime_error(("time_get_byname failed to construct for " + string(nm)).c_str()); + std::__throw_runtime_error(("time_get_byname failed to construct for " + string(nm)).c_str()); } __time_get::__time_get(const string& nm) : __loc_(__locale::__newlocale(_LIBCPP_ALL_MASK, nm.c_str(), 0)) { if (__loc_ == 0) - __throw_runtime_error(("time_get_byname failed to construct for " + nm).c_str()); + std::__throw_runtime_error(("time_get_byname failed to construct for " + nm).c_str()); } __time_get::~__time_get() { __locale::__freelocale(__loc_); } @@ -4610,7 +4610,7 @@ wstring __time_get_storage::__analyze(char fmt, const ctype& c const char* bb = buf; size_t j = __locale::__mbsrtowcs(wbb, &bb, countof(wbuf), &mb, __loc_); if (j == size_t(-1)) - __throw_runtime_error("locale not supported"); + std::__throw_runtime_error("locale not supported"); wchar_t* wbe = wbb + j; wstring result; while (wbb != wbe) { @@ -4771,7 +4771,7 @@ void __time_get_storage::init(const ctype& ct) { const char* bb = buf; size_t j = __locale::__mbsrtowcs(wbuf, &bb, countof(wbuf), &mb, __loc_); if (j == size_t(-1) || j == 0) - __throw_runtime_error("locale not supported"); + std::__throw_runtime_error("locale not supported"); wbe = wbuf + j; __weeks_[i].assign(wbuf, wbe); __locale::__strftime(buf, countof(buf), "%a", &t, __loc_); @@ -4779,7 +4779,7 @@ void __time_get_storage::init(const ctype& ct) { bb = buf; j = __locale::__mbsrtowcs(wbuf, &bb, countof(wbuf), &mb, __loc_); if (j == size_t(-1) || j == 0) - __throw_runtime_error("locale not supported"); + std::__throw_runtime_error("locale not supported"); wbe = wbuf + j; __weeks_[i + 7].assign(wbuf, wbe); } @@ -4791,7 +4791,7 @@ void __time_get_storage::init(const ctype& ct) { const char* bb = buf; size_t j = __locale::__mbsrtowcs(wbuf, &bb, countof(wbuf), &mb, __loc_); if (j == size_t(-1) || j == 0) - __throw_runtime_error("locale not supported"); + std::__throw_runtime_error("locale not supported"); wbe = wbuf + j; __months_[i].assign(wbuf, wbe); __locale::__strftime(buf, countof(buf), "%b", &t, __loc_); @@ -4799,7 +4799,7 @@ void __time_get_storage::init(const ctype& ct) { bb = buf; j = __locale::__mbsrtowcs(wbuf, &bb, countof(wbuf), &mb, __loc_); if (j == size_t(-1) || j == 0) - __throw_runtime_error("locale not supported"); + std::__throw_runtime_error("locale not supported"); wbe = wbuf + j; __months_[i + 12].assign(wbuf, wbe); } @@ -4810,7 +4810,7 @@ void __time_get_storage::init(const ctype& ct) { const char* bb = buf; size_t j = __locale::__mbsrtowcs(wbuf, &bb, countof(wbuf), &mb, __loc_); if (j == size_t(-1)) - __throw_runtime_error("locale not supported"); + std::__throw_runtime_error("locale not supported"); wbe = wbuf + j; __am_pm_[0].assign(wbuf, wbe); t.tm_hour = 13; @@ -4819,7 +4819,7 @@ void __time_get_storage::init(const ctype& ct) { bb = buf; j = __locale::__mbsrtowcs(wbuf, &bb, countof(wbuf), &mb, __loc_); if (j == size_t(-1)) - __throw_runtime_error("locale not supported"); + std::__throw_runtime_error("locale not supported"); wbe = wbuf + j; __am_pm_[1].assign(wbuf, wbe); __c_ = __analyze('c', ct); @@ -5029,12 +5029,12 @@ time_base::dateorder __time_get_storage::__do_date_order() const { __time_put::__time_put(const char* nm) : __loc_(__locale::__newlocale(_LIBCPP_ALL_MASK, nm, 0)) { if (__loc_ == 0) - __throw_runtime_error(("time_put_byname failed to construct for " + string(nm)).c_str()); + std::__throw_runtime_error(("time_put_byname failed to construct for " + string(nm)).c_str()); } __time_put::__time_put(const string& nm) : __loc_(__locale::__newlocale(_LIBCPP_ALL_MASK, nm.c_str(), 0)) { if (__loc_ == 0) - __throw_runtime_error(("time_put_byname failed to construct for " + nm).c_str()); + std::__throw_runtime_error(("time_put_byname failed to construct for " + nm).c_str()); } __time_put::~__time_put() { @@ -5059,7 +5059,7 @@ void __time_put::__do_put(wchar_t* __wb, wchar_t*& __we, const tm* __tm, char __ const char* __nb = __nar; size_t j = __locale::__mbsrtowcs(__wb, &__nb, countof(__wb, __we), &mb, __loc_); if (j == size_t(-1)) - __throw_runtime_error("locale not supported"); + std::__throw_runtime_error("locale not supported"); __we = __wb + j; } #endif // _LIBCPP_HAS_WIDE_CHARACTERS @@ -5431,7 +5431,7 @@ void moneypunct_byname::init(const char* nm) { typedef moneypunct base; __libcpp_unique_locale loc(nm); if (!loc) - __throw_runtime_error(("moneypunct_byname failed to construct for " + string(nm)).c_str()); + std::__throw_runtime_error(("moneypunct_byname failed to construct for " + string(nm)).c_str()); __locale::__lconv_t* lc = __locale::__localeconv(loc.get()); if (!checked_string_to_char_convert(__decimal_point_, lc->mon_decimal_point, loc.get())) @@ -5466,7 +5466,7 @@ void moneypunct_byname::init(const char* nm) { typedef moneypunct base; __libcpp_unique_locale loc(nm); if (!loc) - __throw_runtime_error(("moneypunct_byname failed to construct for " + string(nm)).c_str()); + std::__throw_runtime_error(("moneypunct_byname failed to construct for " + string(nm)).c_str()); __locale::__lconv_t* lc = __locale::__localeconv(loc.get()); if (!checked_string_to_char_convert(__decimal_point_, lc->mon_decimal_point, loc.get())) @@ -5522,7 +5522,7 @@ void moneypunct_byname::init(const char* nm) { typedef moneypunct base; __libcpp_unique_locale loc(nm); if (!loc) - __throw_runtime_error(("moneypunct_byname failed to construct for " + string(nm)).c_str()); + std::__throw_runtime_error(("moneypunct_byname failed to construct for " + string(nm)).c_str()); __locale::__lconv_t* lc = __locale::__localeconv(loc.get()); if (!checked_string_to_wchar_convert(__decimal_point_, lc->mon_decimal_point, loc.get())) __decimal_point_ = base::do_decimal_point(); @@ -5534,7 +5534,7 @@ void moneypunct_byname::init(const char* nm) { const char* bb = lc->currency_symbol; size_t j = __locale::__mbsrtowcs(wbuf, &bb, countof(wbuf), &mb, loc.get()); if (j == size_t(-1)) - __throw_runtime_error("locale not supported"); + std::__throw_runtime_error("locale not supported"); wchar_t* wbe = wbuf + j; __curr_symbol_.assign(wbuf, wbe); if (lc->frac_digits != CHAR_MAX) @@ -5548,7 +5548,7 @@ void moneypunct_byname::init(const char* nm) { bb = lc->positive_sign; j = __locale::__mbsrtowcs(wbuf, &bb, countof(wbuf), &mb, loc.get()); if (j == size_t(-1)) - __throw_runtime_error("locale not supported"); + std::__throw_runtime_error("locale not supported"); wbe = wbuf + j; __positive_sign_.assign(wbuf, wbe); } @@ -5559,7 +5559,7 @@ void moneypunct_byname::init(const char* nm) { bb = lc->negative_sign; j = __locale::__mbsrtowcs(wbuf, &bb, countof(wbuf), &mb, loc.get()); if (j == size_t(-1)) - __throw_runtime_error("locale not supported"); + std::__throw_runtime_error("locale not supported"); wbe = wbuf + j; __negative_sign_.assign(wbuf, wbe); } @@ -5576,7 +5576,7 @@ void moneypunct_byname::init(const char* nm) { typedef moneypunct base; __libcpp_unique_locale loc(nm); if (!loc) - __throw_runtime_error(("moneypunct_byname failed to construct for " + string(nm)).c_str()); + std::__throw_runtime_error(("moneypunct_byname failed to construct for " + string(nm)).c_str()); __locale::__lconv_t* lc = __locale::__localeconv(loc.get()); if (!checked_string_to_wchar_convert(__decimal_point_, lc->mon_decimal_point, loc.get())) @@ -5589,7 +5589,7 @@ void moneypunct_byname::init(const char* nm) { const char* bb = lc->int_curr_symbol; size_t j = __locale::__mbsrtowcs(wbuf, &bb, countof(wbuf), &mb, loc.get()); if (j == size_t(-1)) - __throw_runtime_error("locale not supported"); + std::__throw_runtime_error("locale not supported"); wchar_t* wbe = wbuf + j; __curr_symbol_.assign(wbuf, wbe); if (lc->int_frac_digits != CHAR_MAX) @@ -5607,7 +5607,7 @@ void moneypunct_byname::init(const char* nm) { bb = lc->positive_sign; j = __locale::__mbsrtowcs(wbuf, &bb, countof(wbuf), &mb, loc.get()); if (j == size_t(-1)) - __throw_runtime_error("locale not supported"); + std::__throw_runtime_error("locale not supported"); wbe = wbuf + j; __positive_sign_.assign(wbuf, wbe); } @@ -5622,7 +5622,7 @@ void moneypunct_byname::init(const char* nm) { bb = lc->negative_sign; j = __locale::__mbsrtowcs(wbuf, &bb, countof(wbuf), &mb, loc.get()); if (j == size_t(-1)) - __throw_runtime_error("locale not supported"); + std::__throw_runtime_error("locale not supported"); wbe = wbuf + j; __negative_sign_.assign(wbuf, wbe); } diff --git a/libcxx/src/memory_resource.cpp b/libcxx/src/memory_resource.cpp index ec9565f731bf..22b5493427f0 100644 --- a/libcxx/src/memory_resource.cpp +++ b/libcxx/src/memory_resource.cpp @@ -48,7 +48,7 @@ class _LIBCPP_HIDDEN __new_delete_memory_resource_imp : public memory_resource { std::byte* result = std::__libcpp_allocate(__element_count(bytes), align); if (!is_aligned_to(result, align)) { std::__libcpp_deallocate(result, __element_count(bytes), align); - __throw_bad_alloc(); + std::__throw_bad_alloc(); } return result; #endif @@ -64,7 +64,7 @@ class _LIBCPP_HIDDEN __new_delete_memory_resource_imp : public memory_resource { // null_memory_resource() class _LIBCPP_HIDDEN __null_memory_resource_imp : public memory_resource { - void* do_allocate(size_t, size_t) override { __throw_bad_alloc(); } + void* do_allocate(size_t, size_t) override { std::__throw_bad_alloc(); } void do_deallocate(void*, size_t, size_t) override {} bool do_is_equal(const memory_resource& other) const noexcept override { return &other == this; } }; diff --git a/libcxx/src/mutex.cpp b/libcxx/src/mutex.cpp index 2f8504d602dc..b2193e2335ee 100644 --- a/libcxx/src/mutex.cpp +++ b/libcxx/src/mutex.cpp @@ -28,7 +28,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD void mutex::lock() { int ec = __libcpp_mutex_lock(&__m_); if (ec) - __throw_system_error(ec, "mutex lock failed"); + std::__throw_system_error(ec, "mutex lock failed"); } bool mutex::try_lock() noexcept { return __libcpp_mutex_trylock(&__m_); } @@ -45,7 +45,7 @@ void mutex::unlock() noexcept { recursive_mutex::recursive_mutex() { int ec = __libcpp_recursive_mutex_init(&__m_); if (ec) - __throw_system_error(ec, "recursive_mutex constructor failed"); + std::__throw_system_error(ec, "recursive_mutex constructor failed"); } recursive_mutex::~recursive_mutex() { @@ -57,7 +57,7 @@ recursive_mutex::~recursive_mutex() { void recursive_mutex::lock() { int ec = __libcpp_recursive_mutex_lock(&__m_); if (ec) - __throw_system_error(ec, "recursive_mutex lock failed"); + std::__throw_system_error(ec, "recursive_mutex lock failed"); } void recursive_mutex::unlock() noexcept { @@ -108,7 +108,7 @@ void recursive_timed_mutex::lock() { unique_lock lk(__m_); if (id == __id_) { if (__count_ == numeric_limits::max()) - __throw_system_error(EAGAIN, "recursive_timed_mutex lock limit reached"); + std::__throw_system_error(EAGAIN, "recursive_timed_mutex lock limit reached"); ++__count_; return; } diff --git a/libcxx/src/print.cpp b/libcxx/src/print.cpp index 4937aafe8417..3f2baa6dcc60 100644 --- a/libcxx/src/print.cpp +++ b/libcxx/src/print.cpp @@ -51,7 +51,7 @@ __write_to_windows_console([[maybe_unused]] FILE* __stream, [[maybe_unused]] wst __view.size(), nullptr, nullptr) == 0) { - __throw_system_error(filesystem::detail::get_last_error(), "failed to write formatted output"); + std::__throw_system_error(filesystem::detail::get_last_error(), "failed to write formatted output"); } } # endif // _LIBCPP_HAS_WIDE_CHARACTERS diff --git a/libcxx/src/random.cpp b/libcxx/src/random.cpp index 3830e3918d2e..ff53a3d786dd 100644 --- a/libcxx/src/random.cpp +++ b/libcxx/src/random.cpp @@ -42,7 +42,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD random_device::random_device(const string& __token) { if (__token != "/dev/urandom") - __throw_system_error(ENOENT, ("random device not supported " + __token).c_str()); + std::__throw_system_error(ENOENT, ("random device not supported " + __token).c_str()); } random_device::~random_device() {} @@ -52,7 +52,7 @@ unsigned random_device::operator()() { size_t n = sizeof(r); int err = getentropy(&r, n); if (err) - __throw_system_error(errno, "random_device getentropy failed"); + std::__throw_system_error(errno, "random_device getentropy failed"); return r; } @@ -68,7 +68,7 @@ unsigned random_device::operator()() { return arc4random(); } random_device::random_device(const string& __token) : __f_(open(__token.c_str(), O_RDONLY)) { if (__f_ < 0) - __throw_system_error(errno, ("random_device failed to open " + __token).c_str()); + std::__throw_system_error(errno, ("random_device failed to open " + __token).c_str()); } random_device::~random_device() { close(__f_); } @@ -80,10 +80,10 @@ unsigned random_device::operator()() { while (n > 0) { ssize_t s = read(__f_, p, n); if (s == 0) - __throw_system_error(ENOMSG, "random_device got EOF"); + std::__throw_system_error(ENOMSG, "random_device got EOF"); if (s == -1) { if (errno != EINTR) - __throw_system_error(errno, "random_device got an unexpected error"); + std::__throw_system_error(errno, "random_device got an unexpected error"); continue; } n -= static_cast(s); @@ -96,10 +96,10 @@ unsigned random_device::operator()() { random_device::random_device(const string& __token) { if (__token != "/dev/urandom") - __throw_system_error(ENOENT, ("random device not supported " + __token).c_str()); + std::__throw_system_error(ENOENT, ("random device not supported " + __token).c_str()); int error = nacl_secure_random_init(); if (error) - __throw_system_error(error, ("random device failed to open " + __token).c_str()); + std::__throw_system_error(error, ("random device failed to open " + __token).c_str()); } random_device::~random_device() {} @@ -110,9 +110,9 @@ unsigned random_device::operator()() { size_t bytes_written; int error = nacl_secure_random(&r, n, &bytes_written); if (error != 0) - __throw_system_error(error, "random_device failed getting bytes"); + std::__throw_system_error(error, "random_device failed getting bytes"); else if (bytes_written != n) - __throw_runtime_error("random_device failed to obtain enough bytes"); + std::__throw_runtime_error("random_device failed to obtain enough bytes"); return r; } @@ -120,7 +120,7 @@ unsigned random_device::operator()() { random_device::random_device(const string& __token) { if (__token != "/dev/urandom") - __throw_system_error(ENOENT, ("random device not supported " + __token).c_str()); + std::__throw_system_error(ENOENT, ("random device not supported " + __token).c_str()); } random_device::~random_device() {} @@ -129,7 +129,7 @@ unsigned random_device::operator()() { unsigned r; errno_t err = rand_s(&r); if (err) - __throw_system_error(err, "random_device rand_s failed."); + std::__throw_system_error(err, "random_device rand_s failed."); return r; } @@ -137,7 +137,7 @@ unsigned random_device::operator()() { random_device::random_device(const string& __token) { if (__token != "/dev/urandom") - __throw_system_error(ENOENT, ("random device not supported " + __token).c_str()); + std::__throw_system_error(ENOENT, ("random device not supported " + __token).c_str()); } random_device::~random_device() {} diff --git a/libcxx/src/std_stream.h b/libcxx/src/std_stream.h index 1bbaee695a22..772e8b91ae34 100644 --- a/libcxx/src/std_stream.h +++ b/libcxx/src/std_stream.h @@ -86,7 +86,7 @@ void __stdinbuf<_CharT>::imbue(const locale& __loc) { __encoding_ = __cv_->encoding(); __always_noconv_ = __cv_->always_noconv(); if (__encoding_ > __limit) - __throw_runtime_error("unsupported locale for standard input"); + std::__throw_runtime_error("unsupported locale for standard input"); } template diff --git a/libcxx/src/thread.cpp b/libcxx/src/thread.cpp index 73f22f12d8cc..db40d9df4f23 100644 --- a/libcxx/src/thread.cpp +++ b/libcxx/src/thread.cpp @@ -46,7 +46,7 @@ void thread::join() { } if (ec) - __throw_system_error(ec, "thread::join failed"); + std::__throw_system_error(ec, "thread::join failed"); } void thread::detach() { @@ -58,7 +58,7 @@ void thread::detach() { } if (ec) - __throw_system_error(ec, "thread::detach failed"); + std::__throw_system_error(ec, "thread::detach failed"); } unsigned thread::hardware_concurrency() noexcept { diff --git a/libcxx/test/tools/clang_tidy_checks/CMakeLists.txt b/libcxx/test/tools/clang_tidy_checks/CMakeLists.txt index 0f8f0e8864d0..f8b523ec0ba9 100644 --- a/libcxx/test/tools/clang_tidy_checks/CMakeLists.txt +++ b/libcxx/test/tools/clang_tidy_checks/CMakeLists.txt @@ -94,7 +94,6 @@ set(SOURCES internal_ftm_use.cpp nodebug_on_aliases.cpp proper_version_checks.cpp - qualify_declval.cpp robust_against_adl.cpp uglify_attributes.cpp diff --git a/libcxx/test/tools/clang_tidy_checks/libcpp_module.cpp b/libcxx/test/tools/clang_tidy_checks/libcpp_module.cpp index bc7c8ce7ec44..32a33dddad63 100644 --- a/libcxx/test/tools/clang_tidy_checks/libcpp_module.cpp +++ b/libcxx/test/tools/clang_tidy_checks/libcpp_module.cpp @@ -15,7 +15,6 @@ #include "internal_ftm_use.hpp" #include "nodebug_on_aliases.hpp" #include "proper_version_checks.hpp" -#include "qualify_declval.hpp" #include "robust_against_adl.hpp" #include "uglify_attributes.hpp" @@ -31,7 +30,6 @@ public: check_factories.registerCheck("libcpp-cpp-version-check"); check_factories.registerCheck("libcpp-robust-against-adl"); check_factories.registerCheck("libcpp-uglify-attributes"); - check_factories.registerCheck("libcpp-qualify-declval"); } }; } // namespace diff --git a/libcxx/test/tools/clang_tidy_checks/qualify_declval.cpp b/libcxx/test/tools/clang_tidy_checks/qualify_declval.cpp deleted file mode 100644 index f1c84ee16e92..000000000000 --- a/libcxx/test/tools/clang_tidy_checks/qualify_declval.cpp +++ /dev/null @@ -1,31 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#include "qualify_declval.hpp" - -namespace { -AST_MATCHER(clang::UnresolvedLookupExpr, requiresADL) { return Node.requiresADL(); } -AST_MATCHER(clang::UnresolvedLookupExpr, isDeclval) { return Node.getName().getAsString() == "declval"; } -} // namespace - -namespace libcpp { -qualify_declval::qualify_declval(llvm::StringRef name, clang::tidy::ClangTidyContext* context) - : clang::tidy::ClangTidyCheck(name, context) {} - -void qualify_declval::registerMatchers(clang::ast_matchers::MatchFinder* finder) { - using namespace clang::ast_matchers; - finder->addMatcher(callExpr(has(unresolvedLookupExpr(requiresADL(), isDeclval()))).bind("ADLcall"), this); -} - -void qualify_declval::check(const clang::ast_matchers::MatchFinder::MatchResult& result) { - if (const auto* call = result.Nodes.getNodeAs("ADLcall"); call != nullptr) { - diag(call->getBeginLoc(), "declval should be qualified to get better error messages") - << clang::FixItHint::CreateInsertion(call->getBeginLoc(), "std::"); - } -} -} // namespace libcpp diff --git a/libcxx/test/tools/clang_tidy_checks/qualify_declval.hpp b/libcxx/test/tools/clang_tidy_checks/qualify_declval.hpp deleted file mode 100644 index 931f9ccf7662..000000000000 --- a/libcxx/test/tools/clang_tidy_checks/qualify_declval.hpp +++ /dev/null @@ -1,18 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#include "clang-tidy/ClangTidyCheck.h" - -namespace libcpp { -class qualify_declval : public clang::tidy::ClangTidyCheck { -public: - qualify_declval(llvm::StringRef, clang::tidy::ClangTidyContext*); - void registerMatchers(clang::ast_matchers::MatchFinder*) override; - void check(const clang::ast_matchers::MatchFinder::MatchResult&) override; -}; -} // namespace libcpp diff --git a/libcxx/test/tools/clang_tidy_checks/robust_against_adl.cpp b/libcxx/test/tools/clang_tidy_checks/robust_against_adl.cpp index 8825c3b77ef9..1bfe96b414b7 100644 --- a/libcxx/test/tools/clang_tidy_checks/robust_against_adl.cpp +++ b/libcxx/test/tools/clang_tidy_checks/robust_against_adl.cpp @@ -36,7 +36,6 @@ void robust_against_adl_check::registerMatchers(clang::ast_matchers::MatchFinder using namespace clang::ast_matchers; finder->addMatcher( callExpr(unless(isOperator()), - unless(argumentCountIs(0)), has(unresolvedLookupExpr(requiresADL(), unless(isCustomizationPoint()))), unless(callee(cxxMethodDecl(isStatic())))) .bind("ADLcall"),