diff --git a/libcxx/.clang-tidy b/libcxx/.clang-tidy --- a/libcxx/.clang-tidy +++ b/libcxx/.clang-tidy @@ -46,6 +46,10 @@ value: __ - key: readability-identifier-naming.PrivateMemberSuffix value: _ + - key: readability-identifier-naming.LocalVariableCase + value: lower_case + - key: readability-identifier-naming.LocalVariablePrefix + value: __ # TODO: investigate these checks # bugprone-branch-clone, diff --git a/libcxx/include/__algorithm/sort.h b/libcxx/include/__algorithm/sort.h --- a/libcxx/include/__algorithm/sort.h +++ b/libcxx/include/__algorithm/sort.h @@ -400,11 +400,11 @@ // Swap one pair on each iteration as long as both bitsets have at least one // element for swapping. while (__left_bitset != 0 && __right_bitset != 0) { - difference_type tz_left = __libcpp_ctz(__left_bitset); - __left_bitset = __libcpp_blsr(__left_bitset); - difference_type tz_right = __libcpp_ctz(__right_bitset); - __right_bitset = __libcpp_blsr(__right_bitset); - _Ops::iter_swap(__first + tz_left, __last - tz_right); + difference_type __tz_left = __libcpp_ctz(__left_bitset); + __left_bitset = __libcpp_blsr(__left_bitset); + difference_type __tz_right = __libcpp_ctz(__right_bitset); + __right_bitset = __libcpp_blsr(__right_bitset); + _Ops::iter_swap(__first + __tz_left, __last - __tz_right); } } @@ -469,9 +469,9 @@ // Record the comparison outcomes for the elements currently on the left side. if (__left_bitset == 0) { _RandomAccessIterator __iter = __first; - for (int j = 0; j < __l_size; j++) { + for (int __j = 0; __j < __l_size; __j++) { bool __comp_result = !__comp(*__iter, __pivot); - __left_bitset |= (static_cast(__comp_result) << j); + __left_bitset |= (static_cast(__comp_result) << __j); ++__iter; } } @@ -479,9 +479,9 @@ // side. if (__right_bitset == 0) { _RandomAccessIterator __iter = __lm1; - for (int j = 0; j < __r_size; j++) { + for (int __j = 0; __j < __r_size; __j++) { bool __comp_result = __comp(*__iter, __pivot); - __right_bitset |= (static_cast(__comp_result) << j); + __right_bitset |= (static_cast(__comp_result) << __j); --__iter; } } @@ -501,9 +501,9 @@ while (__left_bitset != 0) { difference_type __tz_left = __detail::__block_size - 1 - __libcpp_clz(__left_bitset); __left_bitset &= (static_cast(1) << __tz_left) - 1; - _RandomAccessIterator it = __first + __tz_left; - if (it != __lm1) { - _Ops::iter_swap(it, __lm1); + _RandomAccessIterator __it = __first + __tz_left; + if (__it != __lm1) { + _Ops::iter_swap(__it, __lm1); } --__lm1; } @@ -514,9 +514,9 @@ while (__right_bitset != 0) { difference_type __tz_right = __detail::__block_size - 1 - __libcpp_clz(__right_bitset); __right_bitset &= (static_cast(1) << __tz_right) - 1; - _RandomAccessIterator it = __lm1 - __tz_right; - if (it != __first) { - _Ops::iter_swap(it, __first); + _RandomAccessIterator __it = __lm1 - __tz_right; + if (__it != __first) { + _Ops::iter_swap(__it, __first); } ++__first; } diff --git a/libcxx/include/__bit/bit_ceil.h b/libcxx/include/__bit/bit_ceil.h --- a/libcxx/include/__bit/bit_ceil.h +++ b/libcxx/include/__bit/bit_ceil.h @@ -34,8 +34,8 @@ return _Tp{1} << __n; else { const unsigned __extra = numeric_limits::digits - numeric_limits<_Tp>::digits; - const unsigned __retVal = 1u << (__n + __extra); - return (_Tp)(__retVal >> __extra); + const unsigned __ret_val = 1u << (__n + __extra); + return (_Tp)(__ret_val >> __extra); } } diff --git a/libcxx/include/__chrono/duration.h b/libcxx/include/__chrono/duration.h --- a/libcxx/include/__chrono/duration.h +++ b/libcxx/include/__chrono/duration.h @@ -186,11 +186,11 @@ { _ToDuration __lower = chrono::floor<_ToDuration>(__d); _ToDuration __upper = __lower + _ToDuration{1}; - auto __lowerDiff = __d - __lower; - auto __upperDiff = __upper - __d; - if (__lowerDiff < __upperDiff) + auto __lower_diff = __d - __lower; + auto __upper_diff = __upper - __d; + if (__lower_diff < __upper_diff) return __lower; - if (__lowerDiff > __upperDiff) + if (__lower_diff > __upper_diff) return __upper; return __lower.count() & 1 ? __upper : __lower; } diff --git a/libcxx/include/__compare/common_comparison_category.h b/libcxx/include/__compare/common_comparison_category.h --- a/libcxx/include/__compare/common_comparison_category.h +++ b/libcxx/include/__compare/common_comparison_category.h @@ -65,14 +65,14 @@ constexpr auto __get_comp_type() { using _CCC = _ClassifyCompCategory; constexpr _CCC __type_kinds[] = {_StrongOrd, __type_to_enum<_Ts>()...}; - constexpr _CCC _Cat = __comp_detail::__compute_comp_type(__type_kinds); - if constexpr (_Cat == _None) + constexpr _CCC __cat = __comp_detail::__compute_comp_type(__type_kinds); + if constexpr (__cat == _None) return void(); - else if constexpr (_Cat == _PartialOrd) + else if constexpr (__cat == _PartialOrd) return partial_ordering::equivalent; - else if constexpr (_Cat == _WeakOrd) + else if constexpr (__cat == _WeakOrd) return weak_ordering::equivalent; - else if constexpr (_Cat == _StrongOrd) + else if constexpr (__cat == _StrongOrd) return strong_ordering::equivalent; else static_assert(_False, "unhandled case"); diff --git a/libcxx/include/__functional/bind.h b/libcxx/include/__functional/bind.h --- a/libcxx/include/__functional/bind.h +++ b/libcxx/include/__functional/bind.h @@ -132,8 +132,8 @@ >::type __mu(_Ti&, _Uj& __uj) { - const size_t _Indx = is_placeholder<_Ti>::value - 1; - return _VSTD::forward::type>(_VSTD::get<_Indx>(__uj)); + const size_t __indx = is_placeholder<_Ti>::value - 1; + return _VSTD::forward::type>(_VSTD::get<__indx>(__uj)); } template diff --git a/libcxx/include/__functional/function.h b/libcxx/include/__functional/function.h --- a/libcxx/include/__functional/function.h +++ b/libcxx/include/__functional/function.h @@ -614,15 +614,15 @@ _LIBCPP_INLINE_VISIBILITY static const __policy* __create_empty() { - static const _LIBCPP_CONSTEXPR __policy __policy_ = {nullptr, nullptr, - true, + static const _LIBCPP_CONSTEXPR __policy __policy = {nullptr, nullptr, + true, #ifndef _LIBCPP_HAS_NO_RTTI - &typeid(void) + &typeid(void) #else - nullptr + nullptr #endif }; - return &__policy_; + return &__policy; } private: @@ -640,7 +640,7 @@ template _LIBCPP_INLINE_VISIBILITY static const __policy* __choose_policy(/* is_small = */ false_type) { - static const _LIBCPP_CONSTEXPR __policy __policy_ = { + static const _LIBCPP_CONSTEXPR __policy __policy = { &__large_clone<_Fun>, &__large_destroy<_Fun>, false, #ifndef _LIBCPP_HAS_NO_RTTI &typeid(typename _Fun::_Target) @@ -648,14 +648,14 @@ nullptr #endif }; - return &__policy_; + return &__policy; } template _LIBCPP_INLINE_VISIBILITY static const __policy* __choose_policy(/* is_small = */ true_type) { - static const _LIBCPP_CONSTEXPR __policy __policy_ = { + static const _LIBCPP_CONSTEXPR __policy __policy = { nullptr, nullptr, false, #ifndef _LIBCPP_HAS_NO_RTTI &typeid(typename _Fun::_Target) @@ -663,7 +663,7 @@ nullptr #endif }; - return &__policy_; + return &__policy; } }; diff --git a/libcxx/include/__iterator/advance.h b/libcxx/include/__iterator/advance.h --- a/libcxx/include/__iterator/advance.h +++ b/libcxx/include/__iterator/advance.h @@ -159,9 +159,9 @@ __a > 0 ? __a >= __b : __a <= __b; }; - if (const auto __M = __bound_sentinel - __i; __magnitude_geq(__n, __M)) { + if (const auto __m = __bound_sentinel - __i; __magnitude_geq(__n, __m)) { (*this)(__i, __bound_sentinel); - return __n - __M; + return __n - __m; } // Otherwise, equivalent to `ranges::advance(i, n)`. diff --git a/libcxx/include/__random/clamp_to_integral.h b/libcxx/include/__random/clamp_to_integral.h --- a/libcxx/include/__random/clamp_to_integral.h +++ b/libcxx/include/__random/clamp_to_integral.h @@ -44,8 +44,8 @@ _LIBCPP_INLINE_VISIBILITY _IntT __clamp_to_integral(_RealT __r) _NOEXCEPT { using _Lim = numeric_limits<_IntT>; - const _IntT _MaxVal = __max_representable_int_for_float<_IntT, _RealT>(); - if (__r >= ::nextafter(static_cast<_RealT>(_MaxVal), INFINITY)) { + const _IntT __max_val = __max_representable_int_for_float<_IntT, _RealT>(); + if (__r >= ::nextafter(static_cast<_RealT>(__max_val), INFINITY)) { return _Lim::max(); } else if (__r <= _Lim::lowest()) { return _Lim::min(); diff --git a/libcxx/include/__random/generate_canonical.h b/libcxx/include/__random/generate_canonical.h --- a/libcxx/include/__random/generate_canonical.h +++ b/libcxx/include/__random/generate_canonical.h @@ -30,20 +30,20 @@ _LIBCPP_HIDE_FROM_ABI _RealType generate_canonical(_URNG& __g) { - const size_t _Dt = numeric_limits<_RealType>::digits; - const size_t __b = _Dt < __bits ? _Dt : __bits; + const size_t __dt = numeric_limits<_RealType>::digits; + const size_t __b = __dt < __bits ? __dt : __bits; #ifdef _LIBCPP_CXX03_LANG - const size_t __logR = __log2::value; + const size_t __log_r = __log2::value; #else - const size_t __logR = __log2::value; + const size_t __log_r = __log2::value; #endif - const size_t __k = __b / __logR + (__b % __logR != 0) + (__b == 0); - const _RealType _Rp = static_cast<_RealType>(_URNG::max() - _URNG::min()) + _RealType(1); - _RealType __base = _Rp; - _RealType _Sp = __g() - _URNG::min(); - for (size_t __i = 1; __i < __k; ++__i, __base *= _Rp) - _Sp += (__g() - _URNG::min()) * __base; - return _Sp / __base; + const size_t __k = __b / __log_r + (__b % __log_r != 0) + (__b == 0); + const _RealType __rp = static_cast<_RealType>(_URNG::max() - _URNG::min()) + _RealType(1); + _RealType __base = __rp; + _RealType __sp = __g() - _URNG::min(); + for (size_t __i = 1; __i < __k; ++__i, __base *= __rp) + __sp += (__g() - _URNG::min()) * __base; + return __sp / __base; } _LIBCPP_END_NAMESPACE_STD diff --git a/libcxx/include/__random/independent_bits_engine.h b/libcxx/include/__random/independent_bits_engine.h --- a/libcxx/include/__random/independent_bits_engine.h +++ b/libcxx/include/__random/independent_bits_engine.h @@ -196,7 +196,7 @@ _UIntType independent_bits_engine<_Engine, __w, _UIntType>::__eval(true_type) { - result_type _Sp = 0; + result_type __sp = 0; for (size_t __k = 0; __k < __n0; ++__k) { _Engine_result_type __u; @@ -204,7 +204,7 @@ { __u = __e_() - _Engine::min(); } while (__u >= __y0); - _Sp = static_cast(__lshift<__w0>(_Sp) + (__u & __mask0)); + __sp = static_cast(__lshift<__w0>(__sp) + (__u & __mask0)); } for (size_t __k = __n0; __k < __n; ++__k) { @@ -213,9 +213,9 @@ { __u = __e_() - _Engine::min(); } while (__u >= __y1); - _Sp = static_cast(__lshift<__w0+1>(_Sp) + (__u & __mask1)); + __sp = static_cast(__lshift<__w0+1>(__sp) + (__u & __mask1)); } - return _Sp; + return __sp; } template diff --git a/libcxx/include/__random/mersenne_twister_engine.h b/libcxx/include/__random/mersenne_twister_engine.h --- a/libcxx/include/__random/mersenne_twister_engine.h +++ b/libcxx/include/__random/mersenne_twister_engine.h @@ -403,9 +403,9 @@ const size_t __j = (__i_ + 1) % __n; const result_type __mask = __r == _Dt ? result_type(~0) : (result_type(1) << __r) - result_type(1); - const result_type _Yp = (__x_[__i_] & ~__mask) | (__x_[__j] & __mask); + const result_type __yp = (__x_[__i_] & ~__mask) | (__x_[__j] & __mask); const size_t __k = (__i_ + __m) % __n; - __x_[__i_] = __x_[__k] ^ __rshift<1>(_Yp) ^ (__a * (_Yp & 1)); + __x_[__i_] = __x_[__k] ^ __rshift<1>(__yp) ^ (__a * (__yp & 1)); result_type __z = __x_[__i_] ^ (__rshift<__u>(__x_[__i_]) & __d); __i_ = __j; __z ^= __lshift<__s>(__z) & __b; diff --git a/libcxx/include/__random/normal_distribution.h b/libcxx/include/__random/normal_distribution.h --- a/libcxx/include/__random/normal_distribution.h +++ b/libcxx/include/__random/normal_distribution.h @@ -133,30 +133,30 @@ normal_distribution<_RealType>::operator()(_URNG& __g, const param_type& __p) { static_assert(__libcpp_random_is_valid_urng<_URNG>::value, ""); - result_type _Up; + result_type __up; if (__v_hot_) { __v_hot_ = false; - _Up = __v_; + __up = __v_; } else { - uniform_real_distribution _Uni(-1, 1); + uniform_real_distribution __uni(-1, 1); result_type __u; result_type __v; result_type __s; do { - __u = _Uni(__g); - __v = _Uni(__g); + __u = __uni(__g); + __v = __uni(__g); __s = __u * __u + __v * __v; } while (__s > 1 || __s == 0); - result_type _Fp = _VSTD::sqrt(-2 * _VSTD::log(__s) / __s); - __v_ = __v * _Fp; + result_type __fp = _VSTD::sqrt(-2 * _VSTD::log(__s) / __s); + __v_ = __v * __fp; __v_hot_ = true; - _Up = __u * _Fp; + __up = __u * __fp; } - return _Up * __p.stddev() + __p.mean(); + return __up * __p.stddev() + __p.mean(); } template @@ -189,16 +189,16 @@ __is.flags(_Istream::dec | _Istream::skipws); result_type __mean; result_type __stddev; - result_type _Vp = 0; - bool _V_hot = false; - __is >> __mean >> __stddev >> _V_hot; - if (_V_hot) - __is >> _Vp; + result_type __vp = 0; + bool __v_hot = false; + __is >> __mean >> __stddev >> __v_hot; + if (__v_hot) + __is >> __vp; if (!__is.fail()) { __x.param(param_type(__mean, __stddev)); - __x.__v_hot_ = _V_hot; - __x.__v_ = _Vp; + __x.__v_hot_ = __v_hot; + __x.__v_ = __vp; } return __is; } diff --git a/libcxx/include/__random/piecewise_linear_distribution.h b/libcxx/include/__random/piecewise_linear_distribution.h --- a/libcxx/include/__random/piecewise_linear_distribution.h +++ b/libcxx/include/__random/piecewise_linear_distribution.h @@ -188,23 +188,23 @@ piecewise_linear_distribution<_RealType>::param_type::__init() { __areas_.assign(__densities_.size() - 1, result_type()); - result_type _Sp = 0; + result_type __sp = 0; for (size_t __i = 0; __i < __areas_.size(); ++__i) { __areas_[__i] = (__densities_[__i+1] + __densities_[__i]) * (__b_[__i+1] - __b_[__i]) * .5; - _Sp += __areas_[__i]; + __sp += __areas_[__i]; } for (size_t __i = __areas_.size(); __i > 1;) { --__i; - __areas_[__i] = __areas_[__i-1] / _Sp; + __areas_[__i] = __areas_[__i-1] / __sp; } __areas_[0] = 0; for (size_t __i = 1; __i < __areas_.size(); ++__i) __areas_[__i] += __areas_[__i-1]; for (size_t __i = 0; __i < __densities_.size(); ++__i) - __densities_[__i] /= _Sp; + __densities_[__i] /= __sp; } template diff --git a/libcxx/include/__random/poisson_distribution.h b/libcxx/include/__random/poisson_distribution.h --- a/libcxx/include/__random/poisson_distribution.h +++ b/libcxx/include/__random/poisson_distribution.h @@ -144,12 +144,12 @@ __d_ = 6 * __mean_ * __mean_; __l_ = _VSTD::trunc(__mean_ - 1.1484); __omega_ = .3989423 / __s_; - double __b1_ = .4166667E-1 / __mean_; - double __b2_ = .3 * __b1_ * __b1_; - __c3_ = .1428571 * __b1_ * __b2_; - __c2_ = __b2_ - 15. * __c3_; - __c1_ = __b1_ - 6. * __b2_ + 45. * __c3_; - __c0_ = 1. - __b1_ + 3. * __b2_ - 15. * __c3_; + double __b1 = .4166667E-1 / __mean_; + double __b2 = .3 * __b1 * __b1; + __c3_ = .1428571 * __b1 * __b2; + __c2_ = __b2 - 15. * __c3_; + __c1_ = __b1 - 6. * __b2 + 45. * __c3_; + __c0_ = 1. - __b1 + 3. * __b2 - 15. * __c3_; __c_ = .1069 / __mean_; } } diff --git a/libcxx/include/__random/shuffle_order_engine.h b/libcxx/include/__random/shuffle_order_engine.h --- a/libcxx/include/__random/shuffle_order_engine.h +++ b/libcxx/include/__random/shuffle_order_engine.h @@ -201,10 +201,10 @@ _LIBCPP_INLINE_VISIBILITY result_type __evalf() { - const double _Fp = __d == 0 ? + const double __fp = __d == 0 ? __n / (2. * 0x8000000000000000ull) : __n / (double)__d; - const size_t __j = static_cast(_Fp * (__y_ - _Min)); + const size_t __j = static_cast(__fp * (__y_ - _Min)); __y_ = __v_[__j]; __v_[__j] = __e_(); return __y_; @@ -262,16 +262,16 @@ typedef basic_istream<_CharT, _Traits> _Istream; __is.flags(_Istream::dec | _Istream::skipws); _Eng __e; - result_type _Vp[_Kp+1]; + result_type __vp[_Kp+1]; __is >> __e; for (size_t __i = 0; __i < _Kp+1; ++__i) - __is >> _Vp[__i]; + __is >> __vp[__i]; if (!__is.fail()) { __x.__e_ = __e; for (size_t __i = 0; __i < _Kp; ++__i) - __x.__v_[__i] = _Vp[__i]; - __x.__y_ = _Vp[_Kp]; + __x.__v_[__i] = __vp[__i]; + __x.__y_ = __vp[_Kp]; } return __is; } diff --git a/libcxx/include/__random/uniform_int_distribution.h b/libcxx/include/__random/uniform_int_distribution.h --- a/libcxx/include/__random/uniform_int_distribution.h +++ b/libcxx/include/__random/uniform_int_distribution.h @@ -120,8 +120,8 @@ _UIntType __independent_bits_engine<_Engine, _UIntType>::__eval(true_type) { - const size_t _WRt = numeric_limits::digits; - result_type _Sp = 0; + const size_t __w_rt = numeric_limits::digits; + result_type __sp = 0; for (size_t __k = 0; __k < __n0_; ++__k) { _Engine_result_type __u; @@ -129,11 +129,11 @@ { __u = __e_() - _Engine::min(); } while (__u >= __y0_); - if (__w0_ < _WRt) - _Sp <<= __w0_; + if (__w0_ < __w_rt) + __sp <<= __w0_; else - _Sp = 0; - _Sp += __u & __mask0_; + __sp = 0; + __sp += __u & __mask0_; } for (size_t __k = __n0_; __k < __n_; ++__k) { @@ -142,13 +142,13 @@ { __u = __e_() - _Engine::min(); } while (__u >= __y1_); - if (__w0_ < _WRt - 1) - _Sp <<= __w0_ + 1; + if (__w0_ < __w_rt - 1) + __sp <<= __w0_ + 1; else - _Sp = 0; - _Sp += __u & __mask1_; + __sp = 0; + __sp += __u & __mask1_; } - return _Sp; + return __sp; } template @@ -234,22 +234,22 @@ static_assert(__libcpp_random_is_valid_urng<_URNG>::value, ""); typedef __conditional_t > _UIntType; - const _UIntType _Rp = _UIntType(__p.b()) - _UIntType(__p.a()) + _UIntType(1); - if (_Rp == 1) + const _UIntType __rp = _UIntType(__p.b()) - _UIntType(__p.a()) + _UIntType(1); + if (__rp == 1) return __p.a(); - const size_t _Dt = numeric_limits<_UIntType>::digits; + const size_t __dt = numeric_limits<_UIntType>::digits; typedef __independent_bits_engine<_URNG, _UIntType> _Eng; - if (_Rp == 0) - return static_cast(_Eng(__g, _Dt)()); - size_t __w = _Dt - std::__countl_zero(_Rp) - 1; - if ((_Rp & (numeric_limits<_UIntType>::max() >> (_Dt - __w))) != 0) + if (__rp == 0) + return static_cast(_Eng(__g, __dt)()); + size_t __w = __dt - std::__countl_zero(__rp) - 1; + if ((__rp & (numeric_limits<_UIntType>::max() >> (__dt - __w))) != 0) ++__w; _Eng __e(__g, __w); _UIntType __u; do { __u = __e(); - } while (__u >= _Rp); + } while (__u >= __rp); return static_cast(__u + __p.a()); } diff --git a/libcxx/include/__ranges/drop_view.h b/libcxx/include/__ranges/drop_view.h --- a/libcxx/include/__ranges/drop_view.h +++ b/libcxx/include/__ranges/drop_view.h @@ -255,12 +255,12 @@ { // Introducing local variables avoids calculating `min` and `distance` twice (at the cost of diverging from the // expression used in the `noexcept` clause and the return statement). - auto dist = ranges::distance(__rng); - auto clamped = std::min<_Dist>(dist, std::forward<_Np>(__n)); + auto __dist = ranges::distance(__rng); + auto __clamped = std::min<_Dist>(__dist, std::forward<_Np>(__n)); return _RawRange( - ranges::begin(__rng) + clamped, + ranges::begin(__rng) + __clamped, ranges::end(__rng), - std::__to_unsigned_like(dist - clamped) + std::__to_unsigned_like(__dist - __clamped) );} // [range.drop.overview]: the "otherwise" case. diff --git a/libcxx/include/__ranges/elements_view.h b/libcxx/include/__ranges/elements_view.h --- a/libcxx/include/__ranges/elements_view.h +++ b/libcxx/include/__ranges/elements_view.h @@ -224,9 +224,9 @@ _LIBCPP_HIDE_FROM_ABI constexpr __iterator operator++(int) requires forward_range<_Base> { - auto temp = *this; + auto __temp = *this; ++__current_; - return temp; + return __temp; } _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator--() @@ -239,9 +239,9 @@ _LIBCPP_HIDE_FROM_ABI constexpr __iterator operator--(int) requires bidirectional_range<_Base> { - auto temp = *this; + auto __temp = *this; --__current_; - return temp; + return __temp; } _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator+=(difference_type __n) diff --git a/libcxx/include/__ranges/filter_view.h b/libcxx/include/__ranges/filter_view.h --- a/libcxx/include/__ranges/filter_view.h +++ b/libcxx/include/__ranges/filter_view.h @@ -180,9 +180,9 @@ } _LIBCPP_HIDE_FROM_ABI constexpr __iterator operator--(int) requires bidirectional_range<_View> { - auto tmp = *this; + auto __tmp = *this; --*this; - return tmp; + return __tmp; } _LIBCPP_HIDE_FROM_ABI diff --git a/libcxx/include/__threading_support b/libcxx/include/__threading_support --- a/libcxx/include/__threading_support +++ b/libcxx/include/__threading_support @@ -259,21 +259,21 @@ int __libcpp_recursive_mutex_init(__libcpp_recursive_mutex_t *__m) { - pthread_mutexattr_t attr; - int __ec = pthread_mutexattr_init(&attr); + pthread_mutexattr_t __attr; + int __ec = pthread_mutexattr_init(&__attr); if (__ec) return __ec; - __ec = pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE); + __ec = pthread_mutexattr_settype(&__attr, PTHREAD_MUTEX_RECURSIVE); if (__ec) { - pthread_mutexattr_destroy(&attr); + pthread_mutexattr_destroy(&__attr); return __ec; } - __ec = pthread_mutex_init(__m, &attr); + __ec = pthread_mutex_init(__m, &__attr); if (__ec) { - pthread_mutexattr_destroy(&attr); + pthread_mutexattr_destroy(&__attr); return __ec; } - __ec = pthread_mutexattr_destroy(&attr); + __ec = pthread_mutexattr_destroy(&__attr); if (__ec) { pthread_mutex_destroy(__m); return __ec; @@ -380,8 +380,8 @@ __libcpp_thread_id __libcpp_thread_get_current_id() { - const __libcpp_thread_t thread = pthread_self(); - return __libcpp_thread_get_id(&thread); + const __libcpp_thread_t __current_thread = pthread_self(); + return __libcpp_thread_get_id(&__current_thread); } __libcpp_thread_id __libcpp_thread_get_id(const __libcpp_thread_t *__t) diff --git a/libcxx/include/bitset b/libcxx/include/bitset --- a/libcxx/include/bitset +++ b/libcxx/include/bitset @@ -795,11 +795,11 @@ if (__str[__i] != __zero && __str[__i] != __one) __throw_invalid_argument("bitset string ctor has invalid argument"); - size_t _Mp = _VSTD::min(__rlen, _Size); + size_t __mp = _VSTD::min(__rlen, _Size); size_t __i = 0; - for (; __i < _Mp; ++__i) + for (; __i < __mp; ++__i) { - _CharT __c = __str[_Mp - 1 - __i]; + _CharT __c = __str[__mp - 1 - __i]; (*this)[__i] = (__c == __one); } _VSTD::fill(base::__make_iter(__i), base::__make_iter(_Size), false); @@ -821,11 +821,11 @@ if (!_Traits::eq(__str[__i], __zero) && !_Traits::eq(__str[__i], __one)) __throw_invalid_argument("bitset string ctor has invalid argument"); - size_t _Mp = _VSTD::min(__rlen, _Size); + size_t __mp = _VSTD::min(__rlen, _Size); size_t __i = 0; - for (; __i < _Mp; ++__i) + for (; __i < __mp; ++__i) { - _CharT __c = __str[__pos + _Mp - 1 - __i]; + _CharT __c = __str[__pos + __mp - 1 - __i]; (*this)[__i] = _Traits::eq(__c, __one); } _VSTD::fill(base::__make_iter(__i), base::__make_iter(_Size), false); @@ -956,8 +956,8 @@ if (__pos >= _Size) __throw_out_of_range("bitset flip argument out of range"); - reference r = base::__make_ref(__pos); - r = ~r; + reference __r = base::__make_ref(__pos); + __r = ~__r; return *this; } diff --git a/libcxx/include/future b/libcxx/include/future --- a/libcxx/include/future +++ b/libcxx/include/future @@ -1120,7 +1120,7 @@ _Rp future<_Rp>::get() { - unique_ptr<__shared_count, __release_shared_count> __(__state_); + unique_ptr<__shared_count, __release_shared_count> __guard(__state_); __assoc_state<_Rp>* __s = __state_; __state_ = nullptr; return __s->move(); @@ -1202,7 +1202,7 @@ _Rp& future<_Rp&>::get() { - unique_ptr<__shared_count, __release_shared_count> __(__state_); + unique_ptr<__shared_count, __release_shared_count> __guard(__state_); __assoc_state<_Rp&>* __s = __state_; __state_ = nullptr; return __s->copy(); diff --git a/libcxx/include/mutex b/libcxx/include/mutex --- a/libcxx/include/mutex +++ b/libcxx/include/mutex @@ -262,9 +262,9 @@ { using namespace chrono; unique_lock __lk(__m_); - bool no_timeout = _Clock::now() < __t; - while (no_timeout && __locked_) - no_timeout = __cv_.wait_until(__lk, __t) == cv_status::no_timeout; + bool __no_timeout = _Clock::now() < __t; + while (__no_timeout && __locked_) + __no_timeout = __cv_.wait_until(__lk, __t) == cv_status::no_timeout; if (!__locked_) { __locked_ = true; @@ -304,7 +304,7 @@ { using namespace chrono; __thread_id __id = this_thread::get_id(); - unique_lock lk(__m_); + unique_lock __lk(__m_); if (__id == __id_) { if (__count_ == numeric_limits::max()) @@ -312,9 +312,9 @@ ++__count_; return true; } - bool no_timeout = _Clock::now() < __t; - while (no_timeout && __count_ != 0) - no_timeout = __cv_.wait_until(lk, __t) == cv_status::no_timeout; + bool __no_timeout = _Clock::now() < __t; + while (__no_timeout && __count_ != 0) + __no_timeout = __cv_.wait_until(__lk, __t) == cv_status::no_timeout; if (__count_ == 0) { __count_ = 1; diff --git a/libcxx/include/regex b/libcxx/include/regex --- a/libcxx/include/regex +++ b/libcxx/include/regex @@ -4131,9 +4131,9 @@ { // Found [= // This means =] must exist - value_type _Equal_close[2] = {'=', ']'}; - _ForwardIterator __temp = _VSTD::search(__first, __last, _Equal_close, - _Equal_close+2); + value_type __equal_close[2] = {'=', ']'}; + _ForwardIterator __temp = _VSTD::search(__first, __last, __equal_close, + __equal_close+2); if (__temp == __last) __throw_regex_error(); // [__first, __temp) contains all text in [= ... =] @@ -4173,9 +4173,9 @@ { // Found [: // This means :] must exist - value_type _Colon_close[2] = {':', ']'}; - _ForwardIterator __temp = _VSTD::search(__first, __last, _Colon_close, - _Colon_close+2); + value_type __colon_close[2] = {':', ']'}; + _ForwardIterator __temp = _VSTD::search(__first, __last, __colon_close, + __colon_close+2); if (__temp == __last) __throw_regex_error(); // [__first, __temp) contains all text in [: ... :] @@ -4198,9 +4198,9 @@ { // Found [. // This means .] must exist - value_type _Dot_close[2] = {'.', ']'}; - _ForwardIterator __temp = _VSTD::search(__first, __last, _Dot_close, - _Dot_close+2); + value_type __dot_close[2] = {'.', ']'}; + _ForwardIterator __temp = _VSTD::search(__first, __last, __dot_close, + __dot_close+2); if (__temp == __last) __throw_regex_error(); // [__first, __temp) contains all text in [. ... .] @@ -5861,7 +5861,7 @@ { deque<__state> __states; ptrdiff_t __highest_j = 0; - ptrdiff_t _Np = _VSTD::distance(__first, __last); + ptrdiff_t __np = _VSTD::distance(__first, __last); __node* __st = __start_.get(); if (__st) { @@ -5904,7 +5904,7 @@ if (!__matched || __highest_j < __s.__current_ - __s.__first_) __highest_j = __s.__current_ - __s.__first_; __matched = true; - if (__highest_j == _Np) + if (__highest_j == __np) __states.clear(); else __states.pop_back(); @@ -5956,7 +5956,7 @@ vector<__state> __states; __state __best_state; ptrdiff_t __highest_j = 0; - ptrdiff_t _Np = _VSTD::distance(__first, __last); + ptrdiff_t __np = _VSTD::distance(__first, __last); __node* __st = __start_.get(); if (__st) { @@ -6008,7 +6008,7 @@ __best_state = __s; } __matched = true; - if (__highest_j == _Np) + if (__highest_j == __np) __states.clear(); else __states.pop_back(); diff --git a/libcxx/include/semaphore b/libcxx/include/semaphore --- a/libcxx/include/semaphore +++ b/libcxx/include/semaphore @@ -172,11 +172,11 @@ _LIBCPP_AVAILABILITY_SYNC _LIBCPP_INLINE_VISIBILITY bool try_acquire_until(chrono::time_point const& __abs_time) { - auto const current = Clock::now(); - if (current >= __abs_time) + auto const __current = Clock::now(); + if (__current >= __abs_time) return try_acquire(); else - return try_acquire_for(__abs_time - current); + return try_acquire_for(__abs_time - __current); } }; diff --git a/libcxx/include/shared_mutex b/libcxx/include/shared_mutex --- a/libcxx/include/shared_mutex +++ b/libcxx/include/shared_mutex @@ -293,11 +293,11 @@ { while (true) { - cv_status status = __base_.__gate1_.wait_until(__lk, __abs_time); + cv_status __status = __base_.__gate1_.wait_until(__lk, __abs_time); if ((__base_.__state_ & __base_.__write_entered_) == 0 && (__base_.__state_ & __base_.__n_readers_) < __base_.__n_readers_) break; - if (status == cv_status::timeout) + if (__status == cv_status::timeout) return false; } } diff --git a/libcxx/include/thread b/libcxx/include/thread --- a/libcxx/include/thread +++ b/libcxx/include/thread @@ -367,10 +367,10 @@ // The standard guarantees a 64bit signed integer resolution for nanoseconds, // so use INT64_MAX / 1e9 as cut-off point. Use a constant to avoid // and issues with long double folding on PowerPC with GCC. - _LIBCPP_CONSTEXPR chrono::duration _Max = + _LIBCPP_CONSTEXPR chrono::duration __max = chrono::duration(9223372036.0L); chrono::nanoseconds __ns; - if (__d < _Max) + if (__d < __max) { __ns = chrono::duration_cast(__d); if (__ns < __d) diff --git a/libcxx/include/variant b/libcxx/include/variant --- a/libcxx/include/variant +++ b/libcxx/include/variant @@ -594,9 +594,9 @@ template _LIBCPP_HIDE_FROM_ABI static constexpr auto __make_fdiagonal() { - constexpr size_t _Np = __remove_cvref_t<_Vp>::__size(); - static_assert(__all<(_Np == __remove_cvref_t<_Vs>::__size())...>::value); - return __make_fdiagonal_impl<_Fp, _Vp, _Vs...>(make_index_sequence<_Np>{}); + constexpr size_t __np = __remove_cvref_t<_Vp>::__size(); + static_assert(__all<(__np == __remove_cvref_t<_Vs>::__size())...>::value); + return __make_fdiagonal_impl<_Fp, _Vp, _Vs...>(make_index_sequence<__np>{}); } template