Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Various cleanups #2595

Merged
merged 25 commits into from
Mar 19, 2022
Merged
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
0209afa
ranges: Use extended friend syntax.
StephanTLavavej Feb 4, 2022
ada6364
Add newlines between non-chained if statements.
StephanTLavavej Feb 4, 2022
8246c6e
Rename to GH_001411_core_headers/test.compile.pass.cpp.
StephanTLavavej Feb 4, 2022
372887d
Fix an unpaired `// clang-format off` after `_Generate_n_fn`.
StephanTLavavej Feb 4, 2022
d2d8e4e
Enable clang-format with zero-to-minor changes.
StephanTLavavej Feb 4, 2022
0c24eaf
yvals_core.h: Cite GH 2207 for `mbrtoc8()` and `c8rtomb()`.
StephanTLavavej Feb 4, 2022
21ecf9c
Unnecessary qualification of std::numeric_limits.
StephanTLavavej Feb 24, 2022
2457dbd
Centralize on using `_STD` instead of `::std::`.
StephanTLavavej Feb 24, 2022
d04f53f
Change `__analysis_assume` to `_Analysis_assume_`.
StephanTLavavej Feb 25, 2022
3ffbb0e
Delete flaky skipped tr1 tests.
StephanTLavavej Feb 26, 2022
055464e
Woof! Epic fail!
StephanTLavavej Feb 26, 2022
916174a
Attach brace.
StephanTLavavej Feb 26, 2022
48266b3
Remove unnecessary defenses for macroized isalnum etc.
StephanTLavavej Feb 26, 2022
bfedea9
Improve formatting of _Refill_lower().
StephanTLavavej Feb 26, 2022
60a6253
Use range-for in <random>.
StephanTLavavej Feb 26, 2022
cef31d0
<random>: Slightly simplify loop in _Small_poisson_distribution::oper…
StephanTLavavej Feb 26, 2022
64406b0
VSO_0102478_moving_allocators/test.cpp: Pass format strings directly …
StephanTLavavej Feb 26, 2022
7cac4de
Unnecessary _STD qualification on _Ugly function.
StephanTLavavej Feb 26, 2022
7b3bda9
Simplify `__cpp_lib_coroutine` test after GH 1451.
StephanTLavavej Feb 26, 2022
f1164fa
Remove dead macro `_STL_WIN32_WINNT_WINXP`.
StephanTLavavej Feb 26, 2022
9d06110
P0083R3_splicing_maps_and_sets/test.cpp: Drop special case for Clang.
StephanTLavavej Mar 1, 2022
da10492
Update comments to "// TRANSITION, Clang 14 coroutine support".
StephanTLavavej Mar 1, 2022
e71cfea
P0912R5_coroutine/env.lst: Add MSVC/EDG C++20 and Clang C++23 coverage.
StephanTLavavej Mar 1, 2022
fbd9d2b
Update comments and test coverage for `/await:strict`.
StephanTLavavej Mar 2, 2022
9dc39cf
VSO_0157762_feature_test_macros/env.lst: Remove unused configurations.
StephanTLavavej Mar 2, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
136 changes: 19 additions & 117 deletions stl/inc/algorithm

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions stl/inc/chrono
Original file line number Diff line number Diff line change
Expand Up @@ -3648,24 +3648,31 @@ namespace chrono {
if (_Second || _Subsecond) {
_Ret |= _F_sec;
}

if (_Minute) {
_Ret |= _F_min;
}

if (_Hour_24) {
_Ret |= _F_hr;
}

if (_Day) {
_Ret |= _F_day;
}

if (_Weekday) {
_Ret |= _F_wkday;
}

if (_Month) {
_Ret |= _F_mon;
}

if (_Day_of_year) {
_Ret |= _F_doy;
}

if (_Two_dig_year && _Century) {
_Ret |= _F_year;
}
Expand Down
4 changes: 2 additions & 2 deletions stl/inc/complex
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ namespace _Float_multi_prec {
#undef _FMP_USING_X86_X64_INTRINSICS
#undef _FMP_USING_ARM64_INTRINSICS

#define _FMP ::std::_Float_multi_prec::
#define _FMP _STD _Float_multi_prec::

// implements numerical algorithms for <complex>
namespace _Math_algorithms {
Expand Down Expand Up @@ -1932,7 +1932,7 @@ _NODISCARD inline float _Log_abs(const complex<float>& _Left) noexcept {

template <class _Ty>
_NODISCARD complex<_Ty> log(const complex<_Ty>& _Left) {
const _Ty _Log_abs_v = _STD _Log_abs(_Left); // get logarithm of magnitude
const _Ty _Log_abs_v = _Log_abs(_Left); // get logarithm of magnitude
const _Ty _Theta = _Ctraits<_Ty>::atan2(_STD imag(_Left), _STD real(_Left)); // get phase
return complex<_Ty>(_Log_abs_v, _Theta);
}
Expand Down
1 change: 1 addition & 0 deletions stl/inc/experimental/filesystem
Original file line number Diff line number Diff line change
Expand Up @@ -1914,6 +1914,7 @@ inline void copy(const path& _Oldpval, const path& _Newpval, copy_options _Opts,
_Oldstat = status(_Oldpval);
_Newstat = status(_Newpval);
}

if (!exists(_Oldstat) || equivalent(_Oldpval, _Newpval, _Code2) || is_other(_Oldstat) || is_other(_Newstat)
|| (is_directory(_Oldstat) && is_regular_file(_Newstat))) {
_Code = make_error_code(errc::operation_not_permitted);
Expand Down
4 changes: 0 additions & 4 deletions stl/inc/format
Original file line number Diff line number Diff line change
Expand Up @@ -1487,11 +1487,9 @@ struct _Format_arg_traits {

static auto _Phony_basic_format_arg_constructor(nullptr_t) -> const void*; // not defined

// clang-format off
template <class _Ty>
requires is_void_v<_Ty>
static auto _Phony_basic_format_arg_constructor(_Ty*) -> const void*; // not defined
// clang-format on

template <class _Ty>
using _Storage_type = decltype(_Phony_basic_format_arg_constructor(_STD declval<_Ty>()));
Expand Down Expand Up @@ -1716,11 +1714,9 @@ public:
}
};

// clang-format off
template <class _Out, class _CharT>
requires output_iterator<_Out, const _CharT&>
class basic_format_context {
// clang-format on
private:
_Out _OutputIt;
basic_format_args<basic_format_context> _Args;
Expand Down
2 changes: 1 addition & 1 deletion stl/inc/istream
Original file line number Diff line number Diff line change
Expand Up @@ -807,7 +807,7 @@ basic_istream<_Elem, _Traits>& _Istream_extract_into_buffer(
}
_CATCH_IO_(ios_base, _Istr)
}
__analysis_assume(static_cast<size_t>(_Current) < _Size); // TRANSITION, VSO-860375
_Analysis_assume_(static_cast<size_t>(_Current) < _Size); // TRANSITION, VSO-860375
_Str[_Current] = _Elem(); // add terminating null character
_Istr.width(0);
if (_Current == 0) {
Expand Down
2 changes: 1 addition & 1 deletion stl/inc/limits
Original file line number Diff line number Diff line change
Expand Up @@ -1023,7 +1023,7 @@ _NODISCARD constexpr int _Countl_zero_fallback(_Ty _Val) noexcept {
// see "Hacker's Delight" section 5-4
template <class _Ty>
_NODISCARD constexpr int _Countr_zero_fallback(const _Ty _Val) noexcept {
constexpr int _Digits = std::numeric_limits<_Ty>::digits;
constexpr int _Digits = numeric_limits<_Ty>::digits;
return _Digits - _Countl_zero_fallback(static_cast<_Ty>(static_cast<_Ty>(~_Val) & static_cast<_Ty>(_Val - 1)));
}

Expand Down
28 changes: 14 additions & 14 deletions stl/inc/locale
Original file line number Diff line number Diff line change
Expand Up @@ -165,72 +165,72 @@ _NODISCARD bool has_facet(const locale& _Loc) noexcept {
}

template <class _Elem>
_NODISCARD bool(isalnum)(_Elem _Ch, const locale& _Loc) {
_NODISCARD bool isalnum(_Elem _Ch, const locale& _Loc) {
return _STD use_facet<ctype<_Elem>>(_Loc).is(ctype_base::alnum, _Ch);
}

template <class _Elem>
_NODISCARD bool(isalpha)(_Elem _Ch, const locale& _Loc) {
_NODISCARD bool isalpha(_Elem _Ch, const locale& _Loc) {
return _STD use_facet<ctype<_Elem>>(_Loc).is(ctype_base::alpha, _Ch);
}

template <class _Elem>
_NODISCARD bool(isblank)(_Elem _Ch, const locale& _Loc) {
_NODISCARD bool isblank(_Elem _Ch, const locale& _Loc) {
return _STD use_facet<ctype<_Elem>>(_Loc).is(ctype_base::blank, _Ch);
}

template <class _Elem>
_NODISCARD bool(iscntrl)(_Elem _Ch, const locale& _Loc) {
_NODISCARD bool iscntrl(_Elem _Ch, const locale& _Loc) {
return _STD use_facet<ctype<_Elem>>(_Loc).is(ctype_base::cntrl, _Ch);
}

template <class _Elem>
_NODISCARD bool(isdigit)(_Elem _Ch, const locale& _Loc) {
_NODISCARD bool isdigit(_Elem _Ch, const locale& _Loc) {
return _STD use_facet<ctype<_Elem>>(_Loc).is(ctype_base::digit, _Ch);
}

template <class _Elem>
_NODISCARD bool(isgraph)(_Elem _Ch, const locale& _Loc) {
_NODISCARD bool isgraph(_Elem _Ch, const locale& _Loc) {
return _STD use_facet<ctype<_Elem>>(_Loc).is(ctype_base::graph, _Ch);
}

template <class _Elem>
_NODISCARD bool(islower)(_Elem _Ch, const locale& _Loc) {
_NODISCARD bool islower(_Elem _Ch, const locale& _Loc) {
return _STD use_facet<ctype<_Elem>>(_Loc).is(ctype_base::lower, _Ch);
}

template <class _Elem>
_NODISCARD bool(isprint)(_Elem _Ch, const locale& _Loc) {
_NODISCARD bool isprint(_Elem _Ch, const locale& _Loc) {
return _STD use_facet<ctype<_Elem>>(_Loc).is(ctype_base::print, _Ch);
}

template <class _Elem>
_NODISCARD bool(ispunct)(_Elem _Ch, const locale& _Loc) {
_NODISCARD bool ispunct(_Elem _Ch, const locale& _Loc) {
return _STD use_facet<ctype<_Elem>>(_Loc).is(ctype_base::punct, _Ch);
}

template <class _Elem>
_NODISCARD bool(isspace)(_Elem _Ch, const locale& _Loc) {
_NODISCARD bool isspace(_Elem _Ch, const locale& _Loc) {
return _STD use_facet<ctype<_Elem>>(_Loc).is(ctype_base::space, _Ch);
}

template <class _Elem>
_NODISCARD bool(isupper)(_Elem _Ch, const locale& _Loc) {
_NODISCARD bool isupper(_Elem _Ch, const locale& _Loc) {
return _STD use_facet<ctype<_Elem>>(_Loc).is(ctype_base::upper, _Ch);
}

template <class _Elem>
_NODISCARD bool(isxdigit)(_Elem _Ch, const locale& _Loc) {
_NODISCARD bool isxdigit(_Elem _Ch, const locale& _Loc) {
return _STD use_facet<ctype<_Elem>>(_Loc).is(ctype_base::xdigit, _Ch);
}

template <class _Elem>
_NODISCARD _Elem(tolower)(_Elem _Ch, const locale& _Loc) {
_NODISCARD _Elem tolower(_Elem _Ch, const locale& _Loc) {
return _STD use_facet<ctype<_Elem>>(_Loc).tolower(_Ch);
}

template <class _Elem>
_NODISCARD _Elem(toupper)(_Elem _Ch, const locale& _Loc) {
_NODISCARD _Elem toupper(_Elem _Ch, const locale& _Loc) {
return _STD use_facet<ctype<_Elem>>(_Loc).toupper(_Ch);
}
_STD_END
Expand Down
46 changes: 22 additions & 24 deletions stl/inc/random
Original file line number Diff line number Diff line change
Expand Up @@ -989,8 +989,8 @@ public:
result_type _Buffer[_Nx];
typename _Mybase::_Traits::_Cy_t _Carry_buf;
const auto _Save_flags = _Istr.flags(ios_base::dec | ios_base::skipws);
for (size_t _Ix = 0; _Ix < _Nx; ++_Ix) {
_Istr >> _Buffer[_Ix];
for (auto& _Val : _Buffer) {
_Istr >> _Val;
}

_Istr >> _Carry_buf;
Expand Down Expand Up @@ -1217,9 +1217,8 @@ public:
}

protected:
_Post_satisfies_(this->_Idx == 0)

void _Refill_lower() { // compute values for the lower half of the history array
_Post_satisfies_(this->_Idx == 0) void _Refill_lower() {
// compute values for the lower half of the history array
constexpr size_t _Wrap_bound_one = _Nx - _One_mod_n;
constexpr size_t _Wrap_bound_m = _Nx - _M_mod_n;

Expand Down Expand Up @@ -1722,8 +1721,9 @@ public:
friend basic_istream<_Elem, _Traits>& operator>>(
basic_istream<_Elem, _Traits>& _Istr, shuffle_order_engine& _Eng) { // read state from _Istr
_Istr >> _Eng._Eng;
for (size_t _Idx = 0; _Idx < shuffle_order_engine::table_size; ++_Idx) {
_Istr >> _Eng._Arr[_Idx];

for (auto& _Val : _Eng._Arr) {
_Istr >> _Val;
StephanTLavavej marked this conversation as resolved.
Show resolved Hide resolved
}

return _Istr >> _Eng._Yx;
Expand All @@ -1733,17 +1733,18 @@ public:
friend basic_ostream<_Elem, _Traits>& operator<<(
basic_ostream<_Elem, _Traits>& _Ostr, const shuffle_order_engine& _Eng) { // write state to _Ostr
_Ostr << _Eng._Eng;
for (size_t _Idx = 0; _Idx < shuffle_order_engine::table_size; ++_Idx) {
_Ostr << ' ' << _Eng._Arr[_Idx];

for (const auto& _Val : _Eng._Arr) {
_Ostr << ' ' << _Val;
}

return _Ostr << ' ' << _Eng._Yx;
}

private:
void _Init() { // compute values for operator()
for (size_t _Idx = 0; _Idx < _Kx; ++_Idx) {
_Arr[_Idx] = _Eng();
for (auto& _Val : _Arr) {
_Val = _Eng();
}

_Yx = _Eng();
Expand Down Expand Up @@ -2220,15 +2221,13 @@ public:

template <class _Engine>
_NODISCARD _Ty operator()(_Engine& _Eng) const {
_Ty _Res;
_Ty1 _Val;
for (_Res = 0, _Val = 1.0;; ++_Res) { // count repetitions
_Ty1 _Val = 1.0;
for (_Ty _Res = 0;; ++_Res) { // count repetitions
_Val *= _NRAND(_Eng, _Ty1);
if (_Val <= _Gx0) {
break;
return _Res;
}
}
return _Res;
}

void _Init(const _Ty1& _Mean0) { // set internal state
Expand Down Expand Up @@ -4424,11 +4423,10 @@ public:

template <class _Elem, class _Traits>
basic_ostream<_Elem, _Traits>& _Write(basic_ostream<_Elem, _Traits>& _Ostr) const { // write state to _Ostr
const size_t _Nvals = _Pvec.size();
_Ostr << ' ' << _Nvals;
_Ostr << ' ' << _Pvec.size();

for (size_t _Idx = 0; _Idx < _Nvals; ++_Idx) {
_Out(_Ostr, _Pvec[_Idx]);
for (const auto& _Val : _Pvec) {
_Out(_Ostr, _Val);
}

return _Ostr;
Expand Down Expand Up @@ -4686,8 +4684,8 @@ public:
const piecewise_constant_distribution& _Dist) { // write state to _Ostr
static_cast<const piecewise_constant_distribution::_Mypbase&>(_Dist._Par)._Write(_Ostr);

for (size_t _Idx = 0; _Idx < _Dist._Par._Bvec.size(); ++_Idx) {
_Out(_Ostr, _Dist._Par._Bvec[_Idx]);
for (const auto& _Val : _Dist._Par._Bvec) {
_Out(_Ostr, _Val);
}

return _Ostr;
Expand Down Expand Up @@ -4912,8 +4910,8 @@ public:
const piecewise_linear_distribution& _Dist) { // write state to _Ostr
static_cast<const piecewise_linear_distribution::_Mypbase&>(_Dist._Par)._Write(_Ostr);

for (size_t _Idx = 0; _Idx < _Dist._Par._Bvec.size(); ++_Idx) {
_Out(_Ostr, _Dist._Par._Bvec[_Idx]);
for (const auto& _Val : _Dist._Par._Bvec) {
_Out(_Ostr, _Val);
}

return _Ostr;
Expand Down
Loading