Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
b84bf09
Fix an issue in the special snowflake windows version of the STL (#4294)
Jan 5, 2024
927eb5c
Drop `#pragma detect_mismatch` for `mutex` size (#4301)
StephanTLavavej Jan 9, 2024
90691c1
Implement P2905R2 Runtime Format Strings (#4196)
frederick-vs-ja Jan 9, 2024
c21ba55
Make join_view and join_with_view iterators default-constructible (th…
cpplearner Jan 9, 2024
532672c
Partially analyze some `SKIPPED` libcxx tests (#4270)
cpplearner Jan 9, 2024
10445f6
Mark ASAN failures in libcxx (#4272)
StephanTLavavej Jan 9, 2024
36fd7e6
Add `atomic& operator=(const atomic&) volatile = delete;` (#4287)
frederick-vs-ja Jan 9, 2024
d9fb554
Update yvals_core.h `_MSVC_STL_UPDATE` (#4293)
Itsbabin Jan 9, 2024
5fd9165
Enable STL-ASAN-CI on PRs (#4295)
CaseyCarter Jan 9, 2024
a3e288b
Updated working draft revision to N4971 (#4299)
Tu-Code Jan 9, 2024
87580ca
Update boost-math to 1.84 (#4280)
fsb4000 Jan 9, 2024
f30d1d8
Toolset update: Jan 2024 Patch Tuesday (#4303)
StephanTLavavej Jan 11, 2024
c5afe05
Implement P2510R3: Formatting Pointers (#4198)
JMazurkiewicz Jan 11, 2024
9ce3d4b
`<numeric>`: switch `transform_reduce` from direct list initializatio…
yqZhang4480 Jan 11, 2024
9ab77b9
`<vector>`, `<string>`: Avoid dereferencing null (fancy) pointers... …
frederick-vs-ja Jan 11, 2024
1444b44
`<vector>`: Cast to the correct base type in `vector<bool, Alloc>::_O…
frederick-vs-ja Jan 11, 2024
7a3a4a5
`<type_traits>`: Workaround for DevCom-10543093 (ICE with some uses o…
frederick-vs-ja Jan 11, 2024
629216a
`<chrono>`: Fix `formatter` ignoring dynamically provided width (#4283)
mt3d Jan 11, 2024
a17bdaa
Mitigate non-conformance of extensions of non-reserved names by the `…
frederick-vs-ja Jan 11, 2024
1fbc77c
All atomic exchanges with _Api_level should be acq_rel (#4288)
AZero13 Jan 11, 2024
77036d6
`<memory>`: Fix constraints of `shared_ptr`'s constructors when the i…
frederick-vs-ja Jan 11, 2024
3eac329
`<xcharconv_ryu.h>`: Fix `__ryu_shiftright128` for ARM64 (#4304)
StephanTLavavej Jan 11, 2024
5734bd0
Merge branch 'main' into merge-flat_set
StephanTLavavej Jan 11, 2024
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
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ issue. The [bug tag][] and [enhancement tag][] are being populated.

# Goals

We're implementing the latest C++ Working Draft, currently [N4964][], which will eventually become the next C++
We're implementing the latest C++ Working Draft, currently [N4971][], which will eventually become the next C++
International Standard. The terms Working Draft (WD) and Working Paper (WP) are interchangeable; we often
informally refer to these drafts as "the Standard" while being aware of the difference. (There are other relevant
Standards; for example, supporting `/std:c++14` and `/std:c++17` involves understanding how the C++14 and C++17
Expand Down Expand Up @@ -530,7 +530,7 @@ SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
[LWG issues]: https://cplusplus.github.io/LWG/lwg-toc.html
[LWG tag]: https://github.com/microsoft/STL/issues?q=is%3Aopen+is%3Aissue+label%3ALWG
[Microsoft Open Source Code of Conduct]: https://opensource.microsoft.com/codeofconduct/
[N4964]: https://wg21.link/n4964
[N4971]: https://wg21.link/n4971
[NOTICE.txt]: NOTICE.txt
[Ninja]: https://ninja-build.org
[STL-CI-badge]: https://dev.azure.com/vclibs/STL/_apis/build/status%2FSTL-CI?branchName=main "STL-CI"
Expand Down
1 change: 0 additions & 1 deletion azure-devops/asan-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ variables:
- name: testSelection
value: '-R stlasan' # Restrict to "stlasan" test

pr: none
trigger: none

schedules:
Expand Down
2 changes: 1 addition & 1 deletion azure-devops/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

variables:
- name: poolName
value: 'StlBuild-2023-12-12T1453-Pool'
value: 'StlBuild-2024-01-09T1215-Pool'
readonly: true
- name: poolDemands
value: 'EnableSpotVM -equals true'
Expand Down
2 changes: 1 addition & 1 deletion boost-math
Submodule boost-math updated 572 files
2 changes: 1 addition & 1 deletion docs/cgmanifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"type": "git",
"git": {
"repositoryUrl": "https://github.com/boostorg/math",
"commitHash": "1a7be5d895d266a870af7a6ed258e5bcf9838277"
"commitHash": "44af29a78c85ee89ce37f7f43d532afd05c3d981"
}
}
},
Expand Down
5 changes: 3 additions & 2 deletions stl/inc/atomic
Original file line number Diff line number Diff line change
Expand Up @@ -2155,8 +2155,9 @@ public:

constexpr atomic() noexcept(is_nothrow_default_constructible_v<_Ty>) : _Base() {}

atomic(const atomic&) = delete;
atomic& operator=(const atomic&) = delete;
atomic(const atomic&) = delete;
atomic& operator=(const atomic&) = delete;
atomic& operator=(const atomic&) volatile = delete;

#if _HAS_CXX17
static constexpr bool is_always_lock_free = _Is_always_lock_free<sizeof(_Ty)>;
Expand Down
9 changes: 8 additions & 1 deletion stl/inc/chrono
Original file line number Diff line number Diff line change
Expand Up @@ -5477,7 +5477,14 @@ namespace chrono {

int _Estimated_width = -1;
(void) _Measure_string_prefix(_Stream.view(), _Estimated_width);
return _Write_aligned(_STD move(_FormatCtx.out()), _Estimated_width, _Specs, _Fmt_align::_Left,

auto _Format_specs = _Specs;
if (_Specs._Dynamic_width_index >= 0) {
_Format_specs._Width = _Get_dynamic_specs<_Width_checker>(
_FormatCtx.arg(static_cast<size_t>(_Specs._Dynamic_width_index)));
}

return _Write_aligned(_STD move(_FormatCtx.out()), _Estimated_width, _Format_specs, _Fmt_align::_Left,
[&](auto _Out) { return _Fmt_write(_STD move(_Out), _Stream.view()); });
}

Expand Down
5 changes: 5 additions & 0 deletions stl/inc/exception
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ _STD_END

#else // ^^^ _HAS_EXCEPTIONS / !_HAS_EXCEPTIONS vvv

#pragma push_macro("stdext")
#undef stdext

_STDEXT_BEGIN
class exception;
_STDEXT_END
Expand Down Expand Up @@ -203,6 +206,8 @@ _EXPORT_STD using _STDEXT bad_exception;

_STD_END

#pragma pop_macro("stdext")

#endif // ^^^ !_HAS_EXCEPTIONS ^^^

extern "C++" _CRTIMP2_PURE void __CLRCALL_PURE_OR_CDECL __ExceptionPtrCreate(_Out_ void*) noexcept;
Expand Down
3 changes: 2 additions & 1 deletion stl/inc/execution
Original file line number Diff line number Diff line change
Expand Up @@ -4235,7 +4235,8 @@ struct _Static_partitioned_transform_reduce2 { // transformed reduction task sch
auto& _Transform_op = _This->_Transform_op;
auto _Chunk = _This->_Basis._Get_chunk(_Key);
auto _Next = _Chunk._First;
_Ty _Val{_Reduce_op(_Transform_op(*_Chunk._First), _Transform_op(*++_Next))};

_Ty _Val = _Reduce_op(_Transform_op(*_Chunk._First), _Transform_op(*++_Next));
while (++_Next != _Chunk._Last) {
_Val = _Reduce_op(_STD move(_Val), _Transform_op(*_Next));
}
Expand Down
81 changes: 58 additions & 23 deletions stl/inc/format
Original file line number Diff line number Diff line change
Expand Up @@ -1762,10 +1762,13 @@ template <class _Handler>
class _Specs_checker : public _Handler {
private:
_Basic_format_arg_type _Arg_type;
// we'll see this if we get a modifier that requires an integer presentation type
// for types that can have either integer or non-integer presentation types (charT or bool)

// Set for the hash and sign modifiers.
bool _Need_arithmetic_presentation_type = false;

// Set for the zero modifier.
bool _Need_arithmetic_or_pointer_presentation_type = false;

public:
constexpr explicit _Specs_checker(const _Handler& _Handler_inst, const _Basic_format_arg_type _Arg_type_)
: _Handler(_Handler_inst), _Arg_type(_Arg_type_) {}
Expand All @@ -1776,6 +1779,12 @@ public:
}
}

constexpr void _Require_numeric_or_pointer_argument() const {
if (!_Is_arithmetic_fmt_type(_Arg_type) && _Arg_type != _Basic_format_arg_type::_Pointer_type) {
_Throw_format_error("Format specifier requires numeric or pointer argument.");
}
}

constexpr void _Check_precision() const {
if (_Is_integral_fmt_type(_Arg_type) || _Arg_type == _Basic_format_arg_type::_Pointer_type) {
_Throw_format_error("Precision not allowed for this argument type.");
Expand All @@ -1802,8 +1811,8 @@ public:
}

constexpr void _On_zero() {
_Need_arithmetic_presentation_type = true;
_Require_numeric_argument();
_Need_arithmetic_or_pointer_presentation_type = true;
_Require_numeric_or_pointer_argument();
_Handler::_On_zero();
}

Expand Down Expand Up @@ -1869,6 +1878,7 @@ public:
_Cat = _Presentation_type_category::_Floating;
break;
case 'p':
case 'P':
_Cat = _Presentation_type_category::_Pointer;
break;
default:
Expand Down Expand Up @@ -1960,7 +1970,18 @@ public:

if (_Need_arithmetic_presentation_type && _Cat != _Presentation_type_category::_Integer
&& _Cat != _Presentation_type_category::_Floating) {
_Throw_format_error("Modifier requires an integer presentation type for bool");
// N4971 [format.string.std]/5: "The sign option is only valid for arithmetic types
// other than charT and bool or when an integer presentation type is specified."
// N4971 [format.string.std]/7: "The # option [...] is valid for arithmetic types
// other than charT and bool or when an integer presentation type is specified, and not otherwise."
_Throw_format_error("Hash/sign modifier requires an arithmetic presentation type");
}

if (_Need_arithmetic_or_pointer_presentation_type && _Cat != _Presentation_type_category::_Integer
&& _Cat != _Presentation_type_category::_Floating && _Cat != _Presentation_type_category::_Pointer) {
// N4971 [format.string.std]/8: "The 0 option is valid for arithmetic types
// other than charT and bool, pointer types, or when an integer presentation type is specified."
_Throw_format_error("Zero modifier requires an arithmetic or pointer presentation type");
}
_Handler::_On_type(_Type);
}
Expand Down Expand Up @@ -3168,25 +3189,37 @@ _NODISCARD _OutputIt _Fmt_write(
template <class _CharT, class _OutputIt>
_NODISCARD _OutputIt _Fmt_write(
_OutputIt _Out, const void* const _Value, const _Basic_format_specs<_CharT>& _Specs, _Lazy_locale) {
_STL_INTERNAL_CHECK(_Specs._Type == '\0' || _Specs._Type == 'p');
_STL_INTERNAL_CHECK(_Specs._Type == '\0' || _Specs._Type == 'p' || _Specs._Type == 'P');
_STL_INTERNAL_CHECK(_Specs._Sgn == _Fmt_sign::_None);
_STL_INTERNAL_CHECK(!_Specs._Alt);
_STL_INTERNAL_CHECK(_Specs._Precision == -1);
_STL_INTERNAL_CHECK(!_Specs._Leading_zero);
_STL_INTERNAL_CHECK(!_Specs._Localized);

// Since the bit width of 0 is 0x0, special-case it instead of complicating the math even more.
int _Width = 3;
if (_Value != nullptr) {
// Compute the bit width of the pointer (i.e. how many bits it takes to be represented).
// Add 3 to the bit width so we always round up on the division.
// Divide that by the amount of bits a hexit represents (log2(16) = log2(2^4) = 4).
// Add 2 for the 0x prefix.
_Width = 2 + (_STD bit_width(reinterpret_cast<uintptr_t>(_Value)) + 3) / 4;
char _Buffer[2 * sizeof(void*)]; // 2 hexits per byte: 8 hexits for 32-bit, 16 hexits for 64-bit
const auto [_End, _Ec] = _STD to_chars(_Buffer, _STD end(_Buffer), reinterpret_cast<uintptr_t>(_Value), 16);
_STL_INTERNAL_CHECK(_Ec == errc{});
const int _Width = 2 + static_cast<int>(_End - _Buffer);

_CharT _Prefix[2] = {_CharT{'0'}, _CharT{'x'}};
if (_Specs._Type == 'P') {
_Prefix[1] = _CharT{'X'};
_Buffer_to_uppercase(_Buffer, _End);
}

const bool _Write_leading_zeroes = _Specs._Leading_zero && _Specs._Alignment == _Fmt_align::_None;
auto _Writer = [&](_OutputIt _Out) {
_Out = _RANGES copy(_Prefix, _Prefix + 2, _STD move(_Out)).out;
if (_Write_leading_zeroes && _Width < _Specs._Width) {
_Out = _RANGES fill_n(_STD move(_Out), _Specs._Width - _Width, _CharT{'0'});
}
return _STD _Widen_and_copy<_CharT>(_Buffer, _End, _STD move(_Out));
};

if (_Write_leading_zeroes) {
return _Writer(_STD move(_Out));
}

return _Write_aligned(_STD move(_Out), _Width, _Specs, _Fmt_align::_Right,
[=](_OutputIt _Out) { return _Fmt_write<_CharT>(_STD move(_Out), _Value); });
return _STD _Write_aligned(_STD move(_Out), _Width, _Specs, _Fmt_align::_Right, _Writer);
}

template <class _CharT, class _OutputIt>
Expand Down Expand Up @@ -3688,18 +3721,20 @@ _EXPORT_STD using format_args = basic_format_args<format_context>;
_EXPORT_STD using wformat_args = basic_format_args<wformat_context>;

_EXPORT_STD template <class _Context = format_context, class... _Args>
_NODISCARD auto make_format_args(_Args&&... _Vals) {
static_assert((_Formattable_with<remove_cvref_t<_Args>, _Context> && ...),
_NODISCARD auto make_format_args(_Args&... _Vals) {
// TRANSITION, should cite the new working draft
static_assert((_Formattable_with<remove_const_t<_Args>, _Context> && ...),
"Cannot format an argument. To make type T formattable, provide a formatter<T> specialization. "
"See N4950 [format.arg.store]/2 and [formatter.requirements].");
"See N4964 [format.arg.store]/2 (along with modification in P2905R2) and [formatter.requirements].");
return _Format_arg_store<_Context, _Args...>{_Vals...};
}

_EXPORT_STD template <class... _Args>
_NODISCARD auto make_wformat_args(_Args&&... _Vals) {
static_assert((_Formattable_with<remove_cvref_t<_Args>, wformat_context> && ...),
_NODISCARD auto make_wformat_args(_Args&... _Vals) {
// TRANSITION, should cite the new working draft
static_assert((_Formattable_with<remove_const_t<_Args>, wformat_context> && ...),
"Cannot format an argument. To make type T formattable, provide a formatter<T> specialization. "
"See N4950 [format.arg.store]/2 and [formatter.requirements].");
"See N4964 [format.arg.store]/2 (along with modification in P2905R2) and [formatter.requirements].");
return _Format_arg_store<wformat_context, _Args...>{_Vals...};
}

Expand Down
6 changes: 6 additions & 0 deletions stl/inc/istream
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,10 @@ public:
return this->good();
}

#pragma push_macro("ipfx")
#pragma push_macro("isfx")
#undef ipfx
#undef isfx
// TRANSITION, ABI: non-Standard ipfx() is preserved for binary compatibility
_DEPRECATE_IO_PFX_SFX bool __CLR_OR_THIS_CALL ipfx(bool _Noskip = false) {
// test stream state and skip whitespace as needed
Expand All @@ -153,6 +157,8 @@ public:

// TRANSITION, ABI: non-Standard isfx() is preserved for binary compatibility
_DEPRECATE_IO_PFX_SFX void __CLR_OR_THIS_CALL isfx() {} // perform any wrapup
#pragma pop_macro("isfx")
#pragma pop_macro("ipfx")

#ifdef _M_CEE_PURE
basic_istream& __CLR_OR_THIS_CALL operator>>(basic_istream&(__clrcall* _Pfn)(basic_istream&) ) {
Expand Down
17 changes: 17 additions & 0 deletions stl/inc/iterator
Original file line number Diff line number Diff line change
Expand Up @@ -1467,6 +1467,17 @@ struct iterator_traits<counted_iterator<_Iter>> : iterator_traits<_Iter> {

_STD_END

#pragma push_macro("stdext")
#pragma push_macro("checked_array_iterator")
#pragma push_macro("make_checked_array_iterator")
#pragma push_macro("make_unchecked_array_iterator")
#pragma push_macro("unchecked_array_iterator")
#undef stdext
#undef checked_array_iterator
#undef make_checked_array_iterator
#undef make_unchecked_array_iterator
#undef unchecked_array_iterator

_STDEXT_BEGIN
template <class _Ptr>
class _DEPRECATE_STDEXT_ARR_ITERS checked_array_iterator { // wrap a pointer with checking
Expand Down Expand Up @@ -1857,6 +1868,12 @@ _STL_RESTORE_DEPRECATED_WARNING
_STD_END
#endif // _HAS_CXX20

#pragma pop_macro("unchecked_array_iterator")
#pragma pop_macro("make_unchecked_array_iterator")
#pragma pop_macro("make_checked_array_iterator")
#pragma pop_macro("checked_array_iterator")
#pragma pop_macro("stdext")

#pragma pop_macro("new")
_STL_RESTORE_CLANG_WARNINGS
#pragma warning(pop)
Expand Down
25 changes: 22 additions & 3 deletions stl/inc/memory
Original file line number Diff line number Diff line change
Expand Up @@ -1464,12 +1464,31 @@ struct _Can_call_function_object : false_type {};
template <class _Fx, class _Arg>
struct _Can_call_function_object<_Fx, _Arg, void_t<decltype(_STD declval<_Fx>()(_STD declval<_Arg>()))>> : true_type {};

template <class _Yty, class _Ty>
template <class _Yty, class _Ty, class = void>
struct _SP_convertible : is_convertible<_Yty*, _Ty*>::type {};

template <class _Yty, class _Uty, class _Void>
struct _SP_convertible<_Yty, _Uty[], _Void> : false_type {};
#if defined(__clang__) || defined(__EDG__) // TRANSITION, DevCom-10548086
template <class _Yty, class _Uty>
struct _SP_convertible<_Yty, _Uty[], void_t<_Yty (*)[]>> : is_convertible<_Yty (*)[], _Uty (*)[]>::type {};
#else // ^^^ no workaround / workaround vvv
template <class _Yty, class _Uty>
struct _SP_convertible<_Yty, _Uty[]> : is_convertible<_Yty (*)[], _Uty (*)[]>::type {};
struct _SP_convertible<_Yty, _Uty[], void_t<decltype(static_cast<_Yty (*)[]>(nullptr))>>
: is_convertible<_Yty (*)[], _Uty (*)[]>::type {};
#endif // ^^^ workaround ^^^

template <class _Yty, class _Uty, size_t _Ext, class _Void>
struct _SP_convertible<_Yty, _Uty[_Ext], _Void> : false_type {};
#if defined(__clang__) || defined(__EDG__) // TRANSITION, DevCom-10548086
template <class _Yty, class _Uty, size_t _Ext>
struct _SP_convertible<_Yty, _Uty[_Ext], void_t<_Yty (*)[_Ext]>>
: is_convertible<_Yty (*)[_Ext], _Uty (*)[_Ext]>::type {};
#else // ^^^ no workaround / workaround vvv
template <class _Yty, class _Uty, size_t _Ext>
struct _SP_convertible<_Yty, _Uty[_Ext]> : is_convertible<_Yty (*)[_Ext], _Uty (*)[_Ext]>::type {};
struct _SP_convertible<_Yty, _Uty[_Ext], void_t<decltype(static_cast<_Yty (*)[_Ext]>(nullptr))>>
: is_convertible<_Yty (*)[_Ext], _Uty (*)[_Ext]>::type {};
#endif // ^^^ workaround ^^^

template <class _Yty, class _Ty>
struct _SP_pointer_compatible : is_convertible<_Yty*, _Ty*>::type {
Expand Down
12 changes: 8 additions & 4 deletions stl/inc/ostream
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,10 @@ public:
bool _Ok; // true if stream state okay at construction
};

#pragma push_macro("opfx")
#pragma push_macro("osfx")
#undef opfx
#undef osfx
// TRANSITION, ABI: non-Standard opfx() is preserved for binary compatibility
_DEPRECATE_IO_PFX_SFX bool __CLR_OR_THIS_CALL opfx() { // test stream state and flush tie stream as needed
if (!this->good()) {
Expand All @@ -155,6 +159,8 @@ public:
_DEPRECATE_IO_PFX_SFX void __CLR_OR_THIS_CALL osfx() noexcept { // perform any wrapup
_Osfx();
}
#pragma pop_macro("osfx")
#pragma pop_macro("opfx")

void __CLR_OR_THIS_CALL _Osfx() noexcept { // perform any wrapup
_TRY_BEGIN
Expand Down Expand Up @@ -1244,11 +1250,9 @@ void _Print_impl(const _Add_newline _Add_nl, ostream& _Ostr, const format_string

if constexpr (_Has_format_args) {
if constexpr (_STD _Is_ordinary_literal_encoding_utf8()) {
_STD _Vprint_unicode_impl(
_Add_nl, _Ostr, _Fmt.get(), _STD make_format_args(_STD forward<_Types>(_Args)...));
_STD _Vprint_unicode_impl(_Add_nl, _Ostr, _Fmt.get(), _STD make_format_args(_Args...));
} else {
_STD _Vprint_nonunicode_impl(
_Add_nl, _Ostr, _Fmt.get(), _STD make_format_args(_STD forward<_Types>(_Args)...));
_STD _Vprint_nonunicode_impl(_Add_nl, _Ostr, _Fmt.get(), _STD make_format_args(_Args...));
}
} else {
const string _Unescaped_str{_Unescape_braces(_Add_nl, _Fmt.get())};
Expand Down
6 changes: 2 additions & 4 deletions stl/inc/print
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,9 @@ void _Print_impl(

if constexpr (_Has_format_args) {
if constexpr (_STD _Is_ordinary_literal_encoding_utf8()) {
_STD _Vprint_unicode_impl(
_Add_nl, _Stream, _Fmt.get(), _STD make_format_args(_STD forward<_Types>(_Args)...));
_STD _Vprint_unicode_impl(_Add_nl, _Stream, _Fmt.get(), _STD make_format_args(_Args...));
} else {
_STD _Vprint_nonunicode_impl(
_Add_nl, _Stream, _Fmt.get(), _STD make_format_args(_STD forward<_Types>(_Args)...));
_STD _Vprint_nonunicode_impl(_Add_nl, _Stream, _Fmt.get(), _STD make_format_args(_Args...));
}
} else {
const string _Unescaped_str{_Unescape_braces(_Add_nl, _Fmt.get())};
Expand Down
Loading