Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion stl/inc/algorithm
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ _STD_BEGIN
_INLINE_VAR constexpr int _ISORT_MAX = 32; // maximum size for insertion sort

template <class _It>
_INLINE_VAR constexpr auto _Isort_max = _Iter_diff_t<_It>{_ISORT_MAX};
_INLINE_VAR constexpr _Iter_diff_t<_It> _Isort_max{_ISORT_MAX};

template <class _Diff>
constexpr ptrdiff_t _Temporary_buffer_size(const _Diff _Value) noexcept {
Expand Down
2 changes: 1 addition & 1 deletion stl/inc/cvt/wbuffer
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ namespace stdext {
if (_Mystrbuf && _Status != _Wrote) {
// got buffer, haven't written, try to compose an element
if (_Status != _Eof) {
if (_Str.size() == 0) {
if (_Str.empty()) {
_Status = _Need;
} else {
_Status = _Got;
Expand Down
14 changes: 8 additions & 6 deletions stl/inc/exception
Original file line number Diff line number Diff line change
Expand Up @@ -264,25 +264,27 @@ public:
return __ExceptionPtrCompare(&_Lhs, &_Rhs);
}

_NODISCARD friend bool operator==(nullptr_t, const exception_ptr& _Rhs) noexcept {
return !_Rhs;
}

_NODISCARD friend bool operator==(const exception_ptr& _Lhs, nullptr_t) noexcept {
return !_Lhs;
}

#if !_HAS_CXX20
_NODISCARD friend bool operator==(nullptr_t, const exception_ptr& _Rhs) noexcept {
return !_Rhs;
}

_NODISCARD friend bool operator!=(const exception_ptr& _Lhs, const exception_ptr& _Rhs) noexcept {
return !(_Lhs == _Rhs);
}

_NODISCARD friend bool operator!=(nullptr_t _Lhs, const exception_ptr& _Rhs) noexcept {
_NODISCARD friend bool operator!=(const exception_ptr& _Lhs, nullptr_t _Rhs) noexcept {
return !(_Lhs == _Rhs);
}

_NODISCARD friend bool operator!=(const exception_ptr& _Lhs, nullptr_t _Rhs) noexcept {
_NODISCARD friend bool operator!=(nullptr_t _Lhs, const exception_ptr& _Rhs) noexcept {
return !(_Lhs == _Rhs);
}
#endif // !_HAS_CXX20

private:
#ifdef __clang__
Expand Down
10 changes: 6 additions & 4 deletions stl/inc/experimental/coroutine
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,9 @@ namespace experimental {
return _Ptr;
}

__declspec(
deprecated("is deprecated. Use coroutine_handle::address() instead")) void* to_address() const noexcept {
[[deprecated("coroutine_handle::to_address() is deprecated. "
"Use coroutine_handle::address() instead.")]] void*
to_address() const noexcept {
return _Ptr;
}

Expand Down Expand Up @@ -131,8 +132,9 @@ namespace experimental {
struct coroutine_handle : coroutine_handle<> { // general form
using coroutine_handle<>::coroutine_handle;

__declspec(deprecated("with pointer parameter is deprecated. Use coroutine_handle::from_promise(T&) "
"instead")) static coroutine_handle from_promise(_PromiseT* _Prom) noexcept {
[[deprecated("coroutine_handle::from_promise(T*) with pointer parameter is deprecated. "
"Use coroutine_handle::from_promise(T&) instead.")]] static coroutine_handle
from_promise(_PromiseT* _Prom) noexcept {
return from_promise(*_Prom);
}

Expand Down
10 changes: 5 additions & 5 deletions stl/inc/future
Original file line number Diff line number Diff line change
Expand Up @@ -1157,7 +1157,7 @@ public:
}

_NODISCARD future<_Ty> get_future() {
return future<_Ty>(_MyPromise._Get_state_for_future(), _Nil());
return future<_Ty>(_MyPromise._Get_state_for_future(), _Nil{});
}

void set_value(const _Ty& _Val) {
Expand Down Expand Up @@ -1219,7 +1219,7 @@ public:
}

_NODISCARD future<_Ty&> get_future() {
return future<_Ty&>(_MyPromise._Get_state_for_future(), _Nil());
return future<_Ty&>(_MyPromise._Get_state_for_future(), _Nil{});
}

void set_value(_Ty& _Val) {
Expand Down Expand Up @@ -1273,7 +1273,7 @@ public:
}

_NODISCARD future<void> get_future() {
return future<void>(_MyPromise._Get_state_for_future(), _Nil());
return future<void>(_MyPromise._Get_state_for_future(), _Nil{});
}

void set_value() {
Expand Down Expand Up @@ -1365,7 +1365,7 @@ public:
}

_NODISCARD future<_Ret> get_future() {
return future<_Ret>(_MyPromise._Get_state_for_future(), _Nil());
return future<_Ret>(_MyPromise._Get_state_for_future(), _Nil{});
}

void operator()(_ArgTypes... _Args) {
Expand Down Expand Up @@ -1494,7 +1494,7 @@ _NODISCARD future<_Invoke_result_t<decay_t<_Fty>, decay_t<_ArgTypes>...>> async(
_Get_associated_state<_Ret>(_Policy, _Fake_no_copy_callable_adapter<_Fty, _ArgTypes...>(
_STD forward<_Fty>(_Fnarg), _STD forward<_ArgTypes>(_Args)...)));

return future<_Ret>(_Pr._Get_state_for_future(), _Nil());
return future<_Ret>(_Pr._Get_state_for_future(), _Nil{});
}

template <class _Fty, class... _ArgTypes>
Expand Down
2 changes: 1 addition & 1 deletion stl/inc/random
Original file line number Diff line number Diff line change
Expand Up @@ -3011,7 +3011,7 @@ private:
_LogSx = _STD log(_Sx) + static_cast<_Ty>(_ExpMax) * (_Ln2 * 2);
}

const auto _Fx = _Ty{_STD sqrt(_Ty{-2} * _LogSx / _Sx)};
const _Ty _Fx{_STD sqrt(_Ty{-2} * _LogSx / _Sx)};
if (_Keep) { // save second value for next call
_Xx2 = _Fx * _Vx2;
_Valid = true;
Expand Down
4 changes: 4 additions & 0 deletions stl/inc/stdatomic.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
#include <yvals.h>
#if _STL_COMPILER_PREPROCESSOR

#ifndef __cplusplus
#error <stdatomic.h> is not yet supported when compiling as C, but this is planned for a future release.
#endif // __cplusplus

#ifdef _M_CEE_PURE
#error <stdatomic.h> is not supported when compiling with /clr:pure.
#endif // _M_CEE_PURE
Expand Down
4 changes: 2 additions & 2 deletions stl/inc/string
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ _NODISCARD inline int stoi(const string& _Str, size_t* _Idx = nullptr, int _Base
_Xinvalid_argument("invalid stoi argument");
}

if (_Errno_ref == ERANGE || _Ans < INT_MIN || INT_MAX < _Ans) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will this break icc? I mean I don't care, but that may be why we checked this in the first place

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good question (as we try to avoid gratuitous breaks). It shouldn't - the Intel C++ Compiler issues we've encountered have involved 80-bit long double (and occasionally new compiler intrinsics). AFAIK, there are no issues with our LLP64 assumption that sizeof(int) equals sizeof(long) equals 4 (that assumption is widespread throughout our codebase).

This was originally being checked because MSVC's STL was licensed from Dinkumware, where the upstream source code was portable to many platforms.

if (_Errno_ref == ERANGE) {
_Xout_of_range("stoi argument out of range");
}

Expand Down Expand Up @@ -276,7 +276,7 @@ _NODISCARD inline int stoi(const wstring& _Str, size_t* _Idx = nullptr, int _Bas
_Xinvalid_argument("invalid stoi argument");
}

if (_Errno_ref == ERANGE || _Ans < INT_MIN || INT_MAX < _Ans) {
if (_Errno_ref == ERANGE) {
_Xout_of_range("stoi argument out of range");
}

Expand Down
2 changes: 1 addition & 1 deletion stl/inc/tuple
Original file line number Diff line number Diff line change
Expand Up @@ -963,7 +963,7 @@ constexpr _Ret _Tuple_cat(index_sequence<_Kx...>, index_sequence<_Ix...>, _Ty&&
template <class... _Tuples>
_NODISCARD constexpr typename _Tuple_cat1<_Tuples...>::type tuple_cat(_Tuples&&... _Tpls) { // concatenate tuples
using _Cat1 = _Tuple_cat1<_Tuples...>;
return _Tuple_cat<typename _Cat1::type>(typename _Cat1::_Kx_arg_seq(), typename _Cat1::_Ix_arg_seq(),
return _Tuple_cat<typename _Cat1::type>(typename _Cat1::_Kx_arg_seq{}, typename _Cat1::_Ix_arg_seq{},
_STD forward_as_tuple(_STD forward<_Tuples>(_Tpls)...));
}

Expand Down
2 changes: 0 additions & 2 deletions stl/inc/xcharconv_ryu.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@ _NODISCARD inline uint64_t __double_to_bits(const double __d) {
// vvvvvvvvvv DERIVED FROM d2s.h vvvvvvvvvv

inline constexpr int __DOUBLE_MANTISSA_BITS = 52;
inline constexpr int __DOUBLE_EXPONENT_BITS = 11;
inline constexpr int __DOUBLE_BIAS = 1023;

inline constexpr int __DOUBLE_POW5_INV_BITCOUNT = 122;
Expand Down Expand Up @@ -950,7 +949,6 @@ _NODISCARD inline to_chars_result __d2exp_buffered_n(char* _First, char* const _
// vvvvvvvvvv DERIVED FROM f2s.c vvvvvvvvvv

inline constexpr int __FLOAT_MANTISSA_BITS = 23;
inline constexpr int __FLOAT_EXPONENT_BITS = 8;
inline constexpr int __FLOAT_BIAS = 127;

// This table is generated by PrintFloatLookupTable.
Expand Down
6 changes: 3 additions & 3 deletions stl/inc/xlocmon
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ protected:
_State |= ios_base::eofbit;
}

if (_Str.size() == 0) {
if (_Str.empty()) {
_State |= ios_base::failbit; // _Getmfld failed
} else { // convert to long double
const char* _Eb = _Str.c_str();
Expand Down Expand Up @@ -476,7 +476,7 @@ private:
int _Fracdigseen = 0;
int _Fracdigits = _Ppunct_fac->frac_digits();
const string _Grouping = _Ppunct_fac->grouping();
const _Elem _Kseparator = _Grouping.size() == 0 ? _Elem{} : _Ppunct_fac->thousands_sep();
const _Elem _Kseparator = _Grouping.empty() ? _Elem{} : _Ppunct_fac->thousands_sep();

if (_Kseparator == _Elem{} || CHAR_MAX <= static_cast<unsigned char>(*_Grouping.c_str())) {
for (; _First != _Last && (_Idx = _Find_elem(_Atoms, *_First)) < 10; ++_First) {
Expand Down Expand Up @@ -540,7 +540,7 @@ private:
}
}

if (_Val.size() == 0) {
if (_Val.empty()) {
_Bad = true; // fail if no elements parsed
} else {
for (; _Fracdigseen < _Fracdigits; ++_Fracdigseen) {
Expand Down
6 changes: 3 additions & 3 deletions stl/inc/xlocnum
Original file line number Diff line number Diff line change
Expand Up @@ -656,7 +656,7 @@ private:
const locale& _Loc) const { // get integer field from [_First, _Last) into _Ac
const auto& _Punct_fac = _STD use_facet<numpunct<_Elem>>(_Loc);
const string _Grouping = _Punct_fac.grouping();
const _Elem _Kseparator = _Grouping.size() == 0 ? _Elem{} : _Punct_fac.thousands_sep();
const _Elem _Kseparator = _Grouping.empty() ? _Elem{} : _Punct_fac.thousands_sep();

constexpr int _Numget_signoff = 22;
constexpr int _Numget_xoff = 24;
Expand Down Expand Up @@ -812,7 +812,7 @@ private:
}
}
} else { // grouping specified, gather digits and group sizes
const _Elem _Kseparator = _Grouping.size() == 0 ? _Elem{} : _Punct_fac.thousands_sep();
const _Elem _Kseparator = _Grouping.empty() ? _Elem{} : _Punct_fac.thousands_sep();
string _Groups(1, '\0');
size_t _Group = 0;

Expand Down Expand Up @@ -1003,7 +1003,7 @@ private:
}
}
} else { // grouping specified, gather digits and group sizes
const _Elem _Kseparator = _Grouping.size() == 0 ? _Elem{} : _Punct_fac.thousands_sep();
const _Elem _Kseparator = _Grouping.empty() ? _Elem{} : _Punct_fac.thousands_sep();
string _Groups(1, '\0');
size_t _Group = 0;

Expand Down
32 changes: 16 additions & 16 deletions stl/inc/xthreads.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,27 +28,27 @@ struct _Thrd_t { // thread identifier for Win32
// Size and alignment for _Mtx_internal_imp_t and _Cnd_internal_imp_t
#ifdef _CRT_WINDOWS
#ifdef _WIN64
#define _Mtx_internal_imp_size 32
#define _Mtx_internal_imp_alignment 8
#define _Cnd_internal_imp_size 16
#define _Cnd_internal_imp_alignment 8
_INLINE_VAR constexpr size_t _Mtx_internal_imp_size = 32;
_INLINE_VAR constexpr size_t _Mtx_internal_imp_alignment = 8;
_INLINE_VAR constexpr size_t _Cnd_internal_imp_size = 16;
_INLINE_VAR constexpr size_t _Cnd_internal_imp_alignment = 8;
#else // _WIN64
#define _Mtx_internal_imp_size 20
#define _Mtx_internal_imp_alignment 4
#define _Cnd_internal_imp_size 8
#define _Cnd_internal_imp_alignment 4
_INLINE_VAR constexpr size_t _Mtx_internal_imp_size = 20;
_INLINE_VAR constexpr size_t _Mtx_internal_imp_alignment = 4;
_INLINE_VAR constexpr size_t _Cnd_internal_imp_size = 8;
_INLINE_VAR constexpr size_t _Cnd_internal_imp_alignment = 4;
#endif // _WIN64
#else // _CRT_WINDOWS
#ifdef _WIN64
#define _Mtx_internal_imp_size 80
#define _Mtx_internal_imp_alignment 8
#define _Cnd_internal_imp_size 72
#define _Cnd_internal_imp_alignment 8
_INLINE_VAR constexpr size_t _Mtx_internal_imp_size = 80;
_INLINE_VAR constexpr size_t _Mtx_internal_imp_alignment = 8;
_INLINE_VAR constexpr size_t _Cnd_internal_imp_size = 72;
_INLINE_VAR constexpr size_t _Cnd_internal_imp_alignment = 8;
#else // _WIN64
#define _Mtx_internal_imp_size 48
#define _Mtx_internal_imp_alignment 4
#define _Cnd_internal_imp_size 40
#define _Cnd_internal_imp_alignment 4
_INLINE_VAR constexpr size_t _Mtx_internal_imp_size = 48;
_INLINE_VAR constexpr size_t _Mtx_internal_imp_alignment = 4;
_INLINE_VAR constexpr size_t _Cnd_internal_imp_size = 40;
_INLINE_VAR constexpr size_t _Cnd_internal_imp_alignment = 4;
#endif // _WIN64
#endif // _CRT_WINDOWS

Expand Down
4 changes: 2 additions & 2 deletions stl/inc/xutility
Original file line number Diff line number Diff line change
Expand Up @@ -1280,10 +1280,10 @@ struct _Distance_unknown {
};

template <class _Diff>
_INLINE_VAR constexpr auto _Max_possible_v = _Diff{static_cast<make_unsigned_t<_Diff>>(-1) >> 1};
_INLINE_VAR constexpr _Diff _Max_possible_v{static_cast<make_unsigned_t<_Diff>>(-1) >> 1};

template <class _Diff>
_INLINE_VAR constexpr auto _Min_possible_v = _Diff{-_Max_possible_v<_Diff> - 1};
_INLINE_VAR constexpr _Diff _Min_possible_v{-_Max_possible_v<_Diff> - 1};

template <class _Iter, class = void>
_INLINE_VAR constexpr bool _Offset_verifiable_v = false;
Expand Down
2 changes: 1 addition & 1 deletion stl/src/cthread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ namespace {
*b.started = 1;
_Cnd_signal(*b.cond);
_Mtx_unlock(*b.mtx);
const unsigned int res = (b.func) (b.data);
const unsigned int res = b.func(b.data);
_Cnd_do_broadcast_at_thread_exit();
return res;
}
Expand Down
2 changes: 1 addition & 1 deletion stl/src/fiopen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ FILE* _Xfsopen(_In_z_ const wchar_t* filename, _In_ int mode, _In_ int prot) {
return _wfsopen(filename, mods[mode], prot);
}

template <typename CharT>
template <class CharT>
FILE* _Xfiopen(const CharT* filename, ios_base::openmode mode, int prot) {
static const int valid[] = {
// valid combinations of open flags
Expand Down
11 changes: 1 addition & 10 deletions tests/libcxx/expected_results.txt
Original file line number Diff line number Diff line change
Expand Up @@ -275,16 +275,7 @@ std/utilities/memory/default.allocator/allocator.members/allocate.verify.cpp SKI


# *** MISSING STL FEATURES ***
# C++23 P1048R1 "is_scoped_enum"
std/utilities/meta/meta.unary/meta.unary.prop/is_scoped_enum.pass.cpp FAIL

# C++23 P1679R3 "contains() For basic_string/basic_string_view"
std/strings/basic.string/string.contains/contains.char.pass.cpp FAIL
std/strings/basic.string/string.contains/contains.ptr.pass.cpp FAIL
std/strings/basic.string/string.contains/contains.string_view.pass.cpp FAIL
std/strings/string.view/string.view.template/contains.char.pass.cpp FAIL
std/strings/string.view/string.view.template/contains.ptr.pass.cpp FAIL
std/strings/string.view/string.view.template/contains.string_view.pass.cpp FAIL
# Nothing here! :-)


# *** MISSING COMPILER FEATURES ***
Expand Down
11 changes: 1 addition & 10 deletions tests/libcxx/skipped_tests.txt
Original file line number Diff line number Diff line change
Expand Up @@ -275,16 +275,7 @@ utilities\memory\default.allocator\allocator.members\allocate.verify.cpp


# *** MISSING STL FEATURES ***
# C++23 P1048R1 "is_scoped_enum"
utilities\meta\meta.unary\meta.unary.prop\is_scoped_enum.pass.cpp

# C++23 P1679R3 "contains() For basic_string/basic_string_view"
strings\basic.string\string.contains\contains.char.pass.cpp
strings\basic.string\string.contains\contains.ptr.pass.cpp
strings\basic.string\string.contains\contains.string_view.pass.cpp
strings\string.view\string.view.template\contains.char.pass.cpp
strings\string.view\string.view.template\contains.ptr.pass.cpp
strings\string.view\string.view.template\contains.string_view.pass.cpp
# Nothing here! :-)


# *** MISSING COMPILER FEATURES ***
Expand Down
2 changes: 1 addition & 1 deletion tests/std/include/test_death.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include <string>
#include <vector>

#include <test_windows.hpp>
#include <Windows.h>

namespace std_testing {
constexpr int internal_failure = 103;
Expand Down
2 changes: 1 addition & 1 deletion tests/std/include/test_thread_support.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include <stdlib.h>
#include <thread>
#ifdef _MSC_EXTENSIONS
#include <test_windows.hpp>
#include <Windows.h>
#endif // _MSC_EXTENSIONS

class one_shot {
Expand Down
6 changes: 0 additions & 6 deletions tests/std/include/test_windows.hpp

This file was deleted.

2 changes: 1 addition & 1 deletion tests/std/tests/Dev08_563686_ostream/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#include <sstream>
#include <stdlib.h>

#include <test_windows.hpp>
#include <Windows.h>

int main() {
// Track CRT blocks
Expand Down
2 changes: 1 addition & 1 deletion tests/std/tests/Dev09_056375_locale_cleanup/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <locale>
#include <stdio.h>

#include <test_windows.hpp>
#include <Windows.h>

using namespace std;

Expand Down
Loading