Skip to content

Commit 9bcf239

Browse files
committed
[libc++] Qualify calls to __throw_foo & friends
This is technically not necessary in most cases to prevent issues with ADL, but let's be consistent.
1 parent c492a22 commit 9bcf239

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+292
-292
lines changed

libcxx/include/__condition_variable/condition_variable.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ inline void condition_variable::__do_timed_wait(
210210
unique_lock<mutex>& __lk, chrono::time_point<chrono::steady_clock, chrono::nanoseconds> __tp) _NOEXCEPT {
211211
using namespace chrono;
212212
if (!__lk.owns_lock())
213-
__throw_system_error(EPERM, "condition_variable::timed wait: mutex not locked");
213+
std::__throw_system_error(EPERM, "condition_variable::timed wait: mutex not locked");
214214
nanoseconds __d = __tp.time_since_epoch();
215215
timespec __ts;
216216
seconds __s = duration_cast<seconds>(__d);
@@ -225,7 +225,7 @@ inline void condition_variable::__do_timed_wait(
225225
}
226226
int __ec = pthread_cond_clockwait(&__cv_, __lk.mutex()->native_handle(), CLOCK_MONOTONIC, &__ts);
227227
if (__ec != 0 && __ec != ETIMEDOUT)
228-
__throw_system_error(__ec, "condition_variable timed_wait failed");
228+
std::__throw_system_error(__ec, "condition_variable timed_wait failed");
229229
}
230230
# endif // _LIBCPP_HAS_COND_CLOCKWAIT
231231

libcxx/include/__filesystem/directory_entry.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ class directory_entry {
286286
return;
287287
}
288288
if (__ec && (!__allow_dne || !__is_dne_error(__ec)))
289-
__throw_filesystem_error(__msg, __p_, __ec);
289+
filesystem::__throw_filesystem_error(__msg, __p_, __ec);
290290
}
291291

292292
_LIBCPP_HIDE_FROM_ABI void __refresh(error_code* __ec = nullptr) {

libcxx/include/__functional/function.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ class __value_func<_Rp(_ArgTypes...)> {
427427

428428
_LIBCPP_HIDE_FROM_ABI _Rp operator()(_ArgTypes&&... __args) const {
429429
if (__f_ == nullptr)
430-
__throw_bad_function_call();
430+
std::__throw_bad_function_call();
431431
return (*__f_)(std::forward<_ArgTypes>(__args)...);
432432
}
433433

@@ -602,7 +602,7 @@ struct __policy_invoker<_Rp(_ArgTypes...)> {
602602
_LIBCPP_HIDE_FROM_ABI explicit __policy_invoker(__Call __c) : __call_(__c) {}
603603

604604
_LIBCPP_HIDE_FROM_ABI static _Rp __call_empty(const __policy_storage*, __fast_forward<_ArgTypes>...) {
605-
__throw_bad_function_call();
605+
std::__throw_bad_function_call();
606606
}
607607

608608
template <typename _Fun>

libcxx/include/__locale

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ inline _LIBCPP_HIDE_FROM_ABI locale::locale(const locale& __other, _Facet* __f)
153153
template <class _Facet>
154154
locale locale::combine(const locale& __other) const {
155155
if (!std::has_facet<_Facet>(__other))
156-
__throw_runtime_error("locale::combine: locale missing facet");
156+
std::__throw_runtime_error("locale::combine: locale missing facet");
157157

158158
return locale(*this, &const_cast<_Facet&>(std::use_facet<_Facet>(__other)));
159159
}
@@ -1295,7 +1295,7 @@ struct _LIBCPP_EXPORTED_FROM_ABI __narrow_to_utf8<16> : public codecvt<char16_t,
12951295
const char16_t* __wn = (const char16_t*)__wb;
12961296
__r = do_out(__mb, (const char16_t*)__wb, (const char16_t*)__we, __wn, __buf, __buf + __sz, __bn);
12971297
if (__r == codecvt_base::error || __wn == (const char16_t*)__wb)
1298-
__throw_runtime_error("locale not supported");
1298+
std::__throw_runtime_error("locale not supported");
12991299
for (const char* __p = __buf; __p < __bn; ++__p, ++__s)
13001300
*__s = *__p;
13011301
__wb = (const _CharT*)__wn;
@@ -1323,7 +1323,7 @@ struct _LIBCPP_EXPORTED_FROM_ABI __narrow_to_utf8<32> : public codecvt<char32_t,
13231323
const char32_t* __wn = (const char32_t*)__wb;
13241324
__r = do_out(__mb, (const char32_t*)__wb, (const char32_t*)__we, __wn, __buf, __buf + __sz, __bn);
13251325
if (__r == codecvt_base::error || __wn == (const char32_t*)__wb)
1326-
__throw_runtime_error("locale not supported");
1326+
std::__throw_runtime_error("locale not supported");
13271327
for (const char* __p = __buf; __p < __bn; ++__p, ++__s)
13281328
*__s = *__p;
13291329
__wb = (const _CharT*)__wn;
@@ -1367,7 +1367,7 @@ struct _LIBCPP_EXPORTED_FROM_ABI __widen_from_utf8<16> : public codecvt<char16_t
13671367
const char* __nn = __nb;
13681368
__r = do_in(__mb, __nb, __ne - __nb > __sz ? __nb + __sz : __ne, __nn, __buf, __buf + __sz, __bn);
13691369
if (__r == codecvt_base::error || __nn == __nb)
1370-
__throw_runtime_error("locale not supported");
1370+
std::__throw_runtime_error("locale not supported");
13711371
for (const char16_t* __p = __buf; __p < __bn; ++__p, ++__s)
13721372
*__s = *__p;
13731373
__nb = __nn;
@@ -1395,7 +1395,7 @@ struct _LIBCPP_EXPORTED_FROM_ABI __widen_from_utf8<32> : public codecvt<char32_t
13951395
const char* __nn = __nb;
13961396
__r = do_in(__mb, __nb, __ne - __nb > __sz ? __nb + __sz : __ne, __nn, __buf, __buf + __sz, __bn);
13971397
if (__r == codecvt_base::error || __nn == __nb)
1398-
__throw_runtime_error("locale not supported");
1398+
std::__throw_runtime_error("locale not supported");
13991399
for (const char32_t* __p = __buf; __p < __bn; ++__p, ++__s)
14001400
*__s = *__p;
14011401
__nb = __nn;

libcxx/include/__locale_dir/support/windows.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ struct __locale_guard {
300300
if (std::strcmp(__l.__get_locale(), __lc) != 0) {
301301
__locale_all = _strdup(__lc);
302302
if (__locale_all == nullptr)
303-
__throw_bad_alloc();
303+
std::__throw_bad_alloc();
304304
__setlocale(__l.__get_locale());
305305
}
306306
}
@@ -318,7 +318,7 @@ struct __locale_guard {
318318
_LIBCPP_HIDE_FROM_ABI static const char* __setlocale(const char* __locale) {
319319
const char* __new_locale = setlocale(LC_ALL, __locale);
320320
if (__new_locale == nullptr)
321-
__throw_bad_alloc();
321+
std::__throw_bad_alloc();
322322
return __new_locale;
323323
}
324324
int __status;

libcxx/include/__memory/allocator.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ class _LIBCPP_TEMPLATE_VIS allocator : private __non_trivial_if<!is_void<_Tp>::v
9898
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp* allocate(size_t __n) {
9999
static_assert(sizeof(_Tp) >= 0, "cannot allocate memory for an incomplete type");
100100
if (__n > allocator_traits<allocator>::max_size(*this))
101-
__throw_bad_array_new_length();
101+
std::__throw_bad_array_new_length();
102102
if (__libcpp_is_constant_evaluated()) {
103103
return static_cast<_Tp*>(::operator new(__n * sizeof(_Tp)));
104104
} else {

libcxx/include/__memory/shared_ptr.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,7 @@ class _LIBCPP_SHARED_PTR_TRIVIAL_ABI _LIBCPP_TEMPLATE_VIS shared_ptr {
496496
_LIBCPP_HIDE_FROM_ABI explicit shared_ptr(const weak_ptr<_Yp>& __r)
497497
: __ptr_(__r.__ptr_), __cntrl_(__r.__cntrl_ ? __r.__cntrl_->lock() : __r.__cntrl_) {
498498
if (__cntrl_ == nullptr)
499-
__throw_bad_weak_ptr();
499+
std::__throw_bad_weak_ptr();
500500
}
501501

502502
#if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR)

libcxx/include/__memory_resource/polymorphic_allocator.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ class _LIBCPP_AVAILABILITY_PMR _LIBCPP_TEMPLATE_VIS polymorphic_allocator {
6464

6565
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI _ValueType* allocate(size_t __n) {
6666
if (__n > __max_size()) {
67-
__throw_bad_array_new_length();
67+
std::__throw_bad_array_new_length();
6868
}
6969
return static_cast<_ValueType*>(__res_->allocate(__n * sizeof(_ValueType), alignof(_ValueType)));
7070
}

libcxx/include/__mutex/unique_lock.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -116,19 +116,19 @@ _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(unique_lock);
116116
template <class _Mutex>
117117
_LIBCPP_HIDE_FROM_ABI void unique_lock<_Mutex>::lock() {
118118
if (__m_ == nullptr)
119-
__throw_system_error(EPERM, "unique_lock::lock: references null mutex");
119+
std::__throw_system_error(EPERM, "unique_lock::lock: references null mutex");
120120
if (__owns_)
121-
__throw_system_error(EDEADLK, "unique_lock::lock: already locked");
121+
std::__throw_system_error(EDEADLK, "unique_lock::lock: already locked");
122122
__m_->lock();
123123
__owns_ = true;
124124
}
125125

126126
template <class _Mutex>
127127
_LIBCPP_HIDE_FROM_ABI bool unique_lock<_Mutex>::try_lock() {
128128
if (__m_ == nullptr)
129-
__throw_system_error(EPERM, "unique_lock::try_lock: references null mutex");
129+
std::__throw_system_error(EPERM, "unique_lock::try_lock: references null mutex");
130130
if (__owns_)
131-
__throw_system_error(EDEADLK, "unique_lock::try_lock: already locked");
131+
std::__throw_system_error(EDEADLK, "unique_lock::try_lock: already locked");
132132
__owns_ = __m_->try_lock();
133133
return __owns_;
134134
}
@@ -137,9 +137,9 @@ template <class _Mutex>
137137
template <class _Rep, class _Period>
138138
_LIBCPP_HIDE_FROM_ABI bool unique_lock<_Mutex>::try_lock_for(const chrono::duration<_Rep, _Period>& __d) {
139139
if (__m_ == nullptr)
140-
__throw_system_error(EPERM, "unique_lock::try_lock_for: references null mutex");
140+
std::__throw_system_error(EPERM, "unique_lock::try_lock_for: references null mutex");
141141
if (__owns_)
142-
__throw_system_error(EDEADLK, "unique_lock::try_lock_for: already locked");
142+
std::__throw_system_error(EDEADLK, "unique_lock::try_lock_for: already locked");
143143
__owns_ = __m_->try_lock_for(__d);
144144
return __owns_;
145145
}
@@ -148,17 +148,17 @@ template <class _Mutex>
148148
template <class _Clock, class _Duration>
149149
_LIBCPP_HIDE_FROM_ABI bool unique_lock<_Mutex>::try_lock_until(const chrono::time_point<_Clock, _Duration>& __t) {
150150
if (__m_ == nullptr)
151-
__throw_system_error(EPERM, "unique_lock::try_lock_until: references null mutex");
151+
std::__throw_system_error(EPERM, "unique_lock::try_lock_until: references null mutex");
152152
if (__owns_)
153-
__throw_system_error(EDEADLK, "unique_lock::try_lock_until: already locked");
153+
std::__throw_system_error(EDEADLK, "unique_lock::try_lock_until: already locked");
154154
__owns_ = __m_->try_lock_until(__t);
155155
return __owns_;
156156
}
157157

158158
template <class _Mutex>
159159
_LIBCPP_HIDE_FROM_ABI void unique_lock<_Mutex>::unlock() {
160160
if (!__owns_)
161-
__throw_system_error(EPERM, "unique_lock::unlock: not locked");
161+
std::__throw_system_error(EPERM, "unique_lock::unlock: not locked");
162162
__m_->unlock();
163163
__owns_ = false;
164164
}

libcxx/include/__ostream/basic_ostream.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const char* __strn) {
407407
if (__len > __bs) {
408408
__wb = (_CharT*)malloc(__len * sizeof(_CharT));
409409
if (__wb == 0)
410-
__throw_bad_alloc();
410+
std::__throw_bad_alloc();
411411
__h.reset(__wb);
412412
}
413413
for (_CharT* __p = __wb; *__strn != '\0'; ++__strn, ++__p)

libcxx/include/__thread/thread.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ template <class _Tp>
100100
__thread_specific_ptr<_Tp>::__thread_specific_ptr() {
101101
int __ec = __libcpp_tls_create(&__key_, &__thread_specific_ptr::__at_thread_exit);
102102
if (__ec)
103-
__throw_system_error(__ec, "__thread_specific_ptr construction failed");
103+
std::__throw_system_error(__ec, "__thread_specific_ptr construction failed");
104104
}
105105

106106
template <class _Tp>
@@ -219,7 +219,7 @@ thread::thread(_Fp&& __f, _Args&&... __args) {
219219
if (__ec == 0)
220220
__p.release();
221221
else
222-
__throw_system_error(__ec, "thread constructor failed");
222+
std::__throw_system_error(__ec, "thread constructor failed");
223223
}
224224

225225
# else // _LIBCPP_CXX03_LANG
@@ -251,7 +251,7 @@ thread::thread(_Fp __f) {
251251
if (__ec == 0)
252252
__pp.release();
253253
else
254-
__throw_system_error(__ec, "thread constructor failed");
254+
std::__throw_system_error(__ec, "thread constructor failed");
255255
}
256256

257257
# endif // _LIBCPP_CXX03_LANG

libcxx/include/__vector/vector.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -550,7 +550,7 @@ class _LIBCPP_TEMPLATE_VIS vector {
550550
// Postcondition: size() == 0
551551
_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __vallocate(size_type __n) {
552552
if (__n > max_size())
553-
__throw_length_error();
553+
this->__throw_length_error();
554554
auto __allocation = std::__allocate_at_least(this->__alloc_, __n);
555555
__begin_ = __allocation.ptr;
556556
__end_ = __allocation.ptr;

libcxx/include/__vector/vector_bool.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,7 @@ class _LIBCPP_TEMPLATE_VIS vector<bool, _Allocator> {
441441
// Postcondition: size() == 0
442442
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __vallocate(size_type __n) {
443443
if (__n > max_size())
444-
__throw_length_error();
444+
this->__throw_length_error();
445445
auto __allocation = std::__allocate_at_least(__alloc_, __external_cap_to_internal(__n));
446446
__begin_ = __allocation.ptr;
447447
__size_ = 0;

libcxx/include/any

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,7 @@ inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST _ValueType
526526
"or a CopyConstructible type");
527527
auto __tmp = std::any_cast<add_const_t<_RawValueType>>(&__v);
528528
if (__tmp == nullptr)
529-
__throw_bad_any_cast();
529+
std::__throw_bad_any_cast();
530530
return static_cast<_ValueType>(*__tmp);
531531
}
532532

@@ -538,7 +538,7 @@ inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST _ValueType
538538
"or a CopyConstructible type");
539539
auto __tmp = std::any_cast<_RawValueType>(&__v);
540540
if (__tmp == nullptr)
541-
__throw_bad_any_cast();
541+
std::__throw_bad_any_cast();
542542
return static_cast<_ValueType>(*__tmp);
543543
}
544544

@@ -550,7 +550,7 @@ inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST _ValueType
550550
"or a CopyConstructible type");
551551
auto __tmp = std::any_cast<_RawValueType>(&__v);
552552
if (__tmp == nullptr)
553-
__throw_bad_any_cast();
553+
std::__throw_bad_any_cast();
554554
return static_cast<_ValueType>(std::move(*__tmp));
555555
}
556556

libcxx/include/array

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -276,13 +276,13 @@ struct _LIBCPP_TEMPLATE_VIS array {
276276

277277
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reference at(size_type __n) {
278278
if (__n >= _Size)
279-
__throw_out_of_range("array::at");
279+
std::__throw_out_of_range("array::at");
280280
return __elems_[__n];
281281
}
282282

283283
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const_reference at(size_type __n) const {
284284
if (__n >= _Size)
285-
__throw_out_of_range("array::at");
285+
std::__throw_out_of_range("array::at");
286286
return __elems_[__n];
287287
}
288288

@@ -407,12 +407,12 @@ struct _LIBCPP_TEMPLATE_VIS array<_Tp, 0> {
407407
}
408408

409409
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reference at(size_type) {
410-
__throw_out_of_range("array<T, 0>::at");
410+
std::__throw_out_of_range("array<T, 0>::at");
411411
__libcpp_unreachable();
412412
}
413413

414414
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const_reference at(size_type) const {
415-
__throw_out_of_range("array<T, 0>::at");
415+
std::__throw_out_of_range("array<T, 0>::at");
416416
__libcpp_unreachable();
417417
}
418418

libcxx/include/bitset

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ __bitset<_N_words, _Size>::to_ulong(false_type) const {
341341
__const_iterator __e = __make_iter(_Size);
342342
__const_iterator __i = std::find(__make_iter(sizeof(unsigned long) * CHAR_BIT), __e, true);
343343
if (__i != __e)
344-
__throw_overflow_error("bitset to_ulong overflow error");
344+
std::__throw_overflow_error("bitset to_ulong overflow error");
345345

346346
return __first_[0];
347347
}
@@ -358,7 +358,7 @@ __bitset<_N_words, _Size>::to_ullong(false_type) const {
358358
__const_iterator __e = __make_iter(_Size);
359359
__const_iterator __i = std::find(__make_iter(sizeof(unsigned long long) * CHAR_BIT), __e, true);
360360
if (__i != __e)
361-
__throw_overflow_error("bitset to_ullong overflow error");
361+
std::__throw_overflow_error("bitset to_ullong overflow error");
362362

363363
return to_ullong(true_type());
364364
}
@@ -647,7 +647,7 @@ public:
647647
_CharT __zero = _CharT('0'),
648648
_CharT __one = _CharT('1')) {
649649
if (__pos > __str.size())
650-
__throw_out_of_range("bitset string pos out of range");
650+
std::__throw_out_of_range("bitset string pos out of range");
651651

652652
size_t __rlen = std::min(__n, __str.size() - __pos);
653653
__init_from_string_view(basic_string_view<_CharT, _Traits>(__str.data() + __pos, __rlen), __zero, __one);
@@ -792,7 +792,7 @@ inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset<_Size>& bitset
792792
template <size_t _Size>
793793
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset<_Size>& bitset<_Size>::set(size_t __pos, bool __val) {
794794
if (__pos >= _Size)
795-
__throw_out_of_range("bitset set argument out of range");
795+
std::__throw_out_of_range("bitset set argument out of range");
796796

797797
(*this)[__pos] = __val;
798798
return *this;
@@ -807,7 +807,7 @@ inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset<_Size>& bitset
807807
template <size_t _Size>
808808
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset<_Size>& bitset<_Size>::reset(size_t __pos) {
809809
if (__pos >= _Size)
810-
__throw_out_of_range("bitset reset argument out of range");
810+
std::__throw_out_of_range("bitset reset argument out of range");
811811

812812
(*this)[__pos] = false;
813813
return *this;
@@ -829,7 +829,7 @@ inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset<_Size>& bitset
829829
template <size_t _Size>
830830
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset<_Size>& bitset<_Size>::flip(size_t __pos) {
831831
if (__pos >= _Size)
832-
__throw_out_of_range("bitset flip argument out of range");
832+
std::__throw_out_of_range("bitset flip argument out of range");
833833

834834
reference __r = __base::__make_ref(__pos);
835835
__r = ~__r;
@@ -901,7 +901,7 @@ inline _LIBCPP_HIDE_FROM_ABI bool bitset<_Size>::operator!=(const bitset& __rhs)
901901
template <size_t _Size>
902902
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool bitset<_Size>::test(size_t __pos) const {
903903
if (__pos >= _Size)
904-
__throw_out_of_range("bitset test argument out of range");
904+
std::__throw_out_of_range("bitset test argument out of range");
905905

906906
return (*this)[__pos];
907907
}

0 commit comments

Comments
 (0)