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
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ Just try to follow these rules, so we can spend more time fixing bugs and implem

# How To Build With The Visual Studio IDE

1. Install Visual Studio 2022 17.13 Preview 3 or later.
1. Install Visual Studio 2022 17.13 Preview 4 or later.
* Select "Windows 11 SDK (10.0.22621.0)" in the VS Installer.
* Select "MSVC v143 - VS 2022 C++ ARM64/ARM64EC build tools (Latest)" in the VS Installer
if you would like to build the ARM64/ARM64EC target.
Expand All @@ -160,7 +160,7 @@ Just try to follow these rules, so we can spend more time fixing bugs and implem

# How To Build With A Native Tools Command Prompt

1. Install Visual Studio 2022 17.13 Preview 3 or later.
1. Install Visual Studio 2022 17.13 Preview 4 or later.
* Select "Windows 11 SDK (10.0.22621.0)" in the VS Installer.
* Select "MSVC v143 - VS 2022 C++ ARM64/ARM64EC build tools (Latest)" in the VS Installer
if you would like to build the ARM64/ARM64EC target.
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-2025-01-22T1525-Pool'
value: 'StlBuild-2025-01-28T1106-Pool'
readonly: true
- name: poolDemands
value: 'EnableSpotVM -equals false'
Expand Down
2 changes: 1 addition & 1 deletion azure-devops/provision-image.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ foreach ($workload in $VisualStudioWorkloads) {
}

# https://github.com/PowerShell/PowerShell/releases/latest
$PowerShellUrl = 'https://github.com/PowerShell/PowerShell/releases/download/v7.4.6/PowerShell-7.4.6-win-x64.msi'
$PowerShellUrl = 'https://github.com/PowerShell/PowerShell/releases/download/v7.5.0/PowerShell-7.5.0-win-x64.msi'
$PowerShellArgs = @('/quiet', '/norestart')

$PythonUrl = 'https://www.python.org/ftp/python/3.13.1/python-3.13.1-amd64.exe'
Expand Down
18 changes: 2 additions & 16 deletions stl/inc/__msvc_chrono.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -653,16 +653,6 @@ namespace chrono {
using time_point = _CHRONO time_point<steady_clock>;
static constexpr bool is_steady = true;

#if defined(_M_ARM) || defined(_M_ARM64) // vvv ARM or ARM64 arch vvv
#define _LIKELY_ARM_ARM64 _LIKELY
#define _LIKELY_X86_X64
#elif defined(_M_IX86) || defined(_M_X64) // ^^^ ARM or ARM64 arch / x86 or x64 arch vvv
#define _LIKELY_ARM_ARM64
#define _LIKELY_X86_X64 _LIKELY
#else // ^^^ x86 or x64 arch / other arch vvv
#define _LIKELY_ARM_ARM64
#define _LIKELY_X86_X64
#endif // ^^^ other arch ^^^
_NODISCARD static time_point now() noexcept { // get current time
const long long _Freq = _Query_perf_frequency(); // doesn't change after system boot
const long long _Ctr = _Query_perf_counter();
Expand All @@ -671,15 +661,14 @@ namespace chrono {
// multiplies instead of divides to calculate the nanosecond value.
constexpr long long _TenMHz = 10'000'000;
constexpr long long _TwentyFourMHz = 24'000'000;
// clang-format off
if (_Freq == _TenMHz) _LIKELY_X86_X64 {
if (_Freq == _TenMHz) {
// 10 MHz is a very common QPC frequency on modern x86/x64 PCs. Optimizing for
// this specific frequency can double the performance of this function by
// avoiding the expensive frequency conversion path.
static_assert(period::den % _TenMHz == 0, "It should never fail.");
constexpr long long _Multiplier = period::den / _TenMHz;
return time_point(duration(_Ctr * _Multiplier));
} else if (_Freq == _TwentyFourMHz) _LIKELY_ARM_ARM64 {
} else if (_Freq == _TwentyFourMHz) {
// 24 MHz is a common frequency on ARM/ARM64, including cases where it emulates x86/x64.
const long long _Whole = (_Ctr / _TwentyFourMHz) * period::den;
const long long _Part = (_Ctr % _TwentyFourMHz) * period::den / _TwentyFourMHz;
Expand All @@ -694,10 +683,7 @@ namespace chrono {
const long long _Part = (_Ctr % _Freq) * period::den / _Freq;
return time_point(duration(_Whole + _Part));
}
// clang-format on
}
#undef _LIKELY_ARM_ARM64
#undef _LIKELY_X86_X64
};
} // namespace chrono
_STD_END
Expand Down
2 changes: 1 addition & 1 deletion stl/inc/__msvc_ranges_tuple_formatter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1081,7 +1081,7 @@ struct _Range_default_formatter<_Kind, _Rng, _CharT> {
if constexpr (_RANGES contiguous_range<_Range_type>) {
const auto _Size = _STD _To_unsigned_like(_RANGES distance(_Rx));

if (!_STD in_range<size_t>(_Size)) [[unlikely]] {
if (!_STD in_range<size_t>(_Size)) {
_Throw_format_error("Formatted range is too long.");
}

Expand Down
28 changes: 14 additions & 14 deletions stl/inc/ostream
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ ios_base::iostate _Print_noformat_nonunicode(ostream& _Ostr, const string_view _
_TRY_IO_BEGIN
const auto _Characters_written = _Ostr.rdbuf()->sputn(_Str.data(), static_cast<streamsize>(_Str.size()));
const bool _Was_insertion_successful = static_cast<size_t>(_Characters_written) == _Str.size();
if (!_Was_insertion_successful) [[unlikely]] {
if (!_Was_insertion_successful) {
_State |= ios_base::badbit;
}
_CATCH_IO_(ios_base, _Ostr)
Expand All @@ -105,7 +105,7 @@ ios_base::iostate _Print_newline_only_nonunicode(ostream& _Ostr) {

_TRY_IO_BEGIN
const bool _Was_insertion_successful = _Ostr.rdbuf()->sputc('\n') == '\n';
if (!_Was_insertion_successful) [[unlikely]] {
if (!_Was_insertion_successful) {
_State |= ios_base::badbit;
}
_CATCH_IO_(ios_base, _Ostr)
Expand All @@ -119,9 +119,9 @@ void _Vprint_nonunicode_impl(
const ostream::sentry _Ok(_Ostr);
ios_base::iostate _State = ios_base::goodbit;

if (!_Ok) [[unlikely]] {
if (!_Ok) {
_State |= ios_base::badbit;
} else [[likely]] {
} else {
// This is intentionally kept outside of the try/catch block in _Print_noformat_nonunicode()
// (see N4950 [ostream.formatted.print]/3.2).
string _Output_str = _STD vformat(_Ostr.getloc(), _Fmt_str, _Fmt_args);
Expand Down Expand Up @@ -178,24 +178,24 @@ ios_base::iostate _Do_on_maybe_unicode_console(
break;

case __std_win_error::_Not_supported:
[[unlikely]] return _State;
return _State;

default:
[[unlikely]] return ios_base::failbit;
return ios_base::failbit;
}
#pragma warning(pop)

if (_Is_unicode_console) {
_TRY_IO_BEGIN
const bool _Was_flush_successful = _Ostr.rdbuf()->pubsync() != -1;
if (!_Was_flush_successful) [[unlikely]] {
if (!_Was_flush_successful) {
_State |= ios_base::badbit;
return _State;
}

const __std_win_error _Unicode_console_print_result =
_Unicode_console_func(_Unicode_console_retrieval_result._Console_handle);
if (_Unicode_console_print_result != __std_win_error::_Success) [[unlikely]] {
if (_Unicode_console_print_result != __std_win_error::_Success) {
_State |= ios_base::badbit;
}
_CATCH_IO_(ios_base, _Ostr)
Expand Down Expand Up @@ -234,9 +234,9 @@ void _Vprint_unicode_impl(
const ostream::sentry _Ok(_Ostr);
ios_base::iostate _State = ios_base::goodbit;

if (!_Ok) [[unlikely]] {
if (!_Ok) {
_State |= ios_base::badbit;
} else [[likely]] {
} else {
// This is intentionally kept outside of the try/catch block in _Print_noformat_unicode()
// (see N4950 [ostream.formatted.print]/3.2).
string _Output_str = _STD vformat(_Ostr.getloc(), _Fmt_str, _Fmt_args);
Expand All @@ -255,9 +255,9 @@ void _Print_noformat(ostream& _Ostr, const string_view _Str) {
const ostream::sentry _Ok(_Ostr);
ios_base::iostate _State = ios_base::goodbit;

if (!_Ok) [[unlikely]] {
if (!_Ok) {
_State |= ios_base::badbit;
} else [[likely]] {
} else {
if constexpr (_STD _Is_ordinary_literal_encoding_utf8()) {
_State |= _STD _Print_noformat_unicode(_Ostr, _Str);
} else {
Expand Down Expand Up @@ -302,9 +302,9 @@ void println(ostream& _Ostr) {
const ostream::sentry _Ok(_Ostr);
ios_base::iostate _State = ios_base::goodbit;

if (!_Ok) [[unlikely]] {
if (!_Ok) {
_State |= ios_base::badbit;
} else [[likely]] {
} else {
if constexpr (_STD _Is_ordinary_literal_encoding_utf8()) {
_State |= _STD _Print_newline_only_unicode(_Ostr);
} else {
Expand Down
18 changes: 9 additions & 9 deletions stl/inc/print
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ private:
inline void _Print_noformat_nonunicode_nonlocking(FILE* const _Stream, const string_view _Str) {
const bool _Was_write_successful = _CSTD _fwrite_nolock(_Str.data(), 1, _Str.size(), _Stream) == _Str.size();

if (!_Was_write_successful) [[unlikely]] {
if (!_Was_write_successful) {
_Throw_system_error(static_cast<errc>(errno));
}
}
Expand Down Expand Up @@ -99,7 +99,7 @@ inline void _Print_noformat_unicode_to_console_nonlocking(
const __std_unicode_console_handle _Console_handle, const string_view _Str) {
const __std_win_error _Console_print_result =
__std_print_to_unicode_console(_Console_handle, _Str.data(), _Str.size());
if (_Console_print_result != __std_win_error::_Success) [[unlikely]] {
if (_Console_print_result != __std_win_error::_Success) {
_STD _Throw_system_error_from_std_win_error(_Console_print_result);
}
}
Expand Down Expand Up @@ -160,10 +160,10 @@ void _Do_on_maybe_unicode_console(
break;

case __std_win_error::_Not_supported:
[[unlikely]] return;
return;

default:
[[unlikely]] _STD _Throw_system_error_from_std_win_error(_Unicode_console_retrieval_result._Error);
_STD _Throw_system_error_from_std_win_error(_Unicode_console_retrieval_result._Error);
}
#pragma warning(pop)

Expand All @@ -180,7 +180,7 @@ inline void _Vprint_unicode_noformat_impl(FILE* const _Stream, const string_view
const _Stream_lock_guard _Guard{_Stream};

const bool _Was_flush_successful = _CSTD _fflush_nolock(_Stream) == 0;
if (!_Was_flush_successful) [[unlikely]] {
if (!_Was_flush_successful) {
_Throw_system_error(static_cast<errc>(errno));
}

Expand All @@ -195,20 +195,20 @@ inline void _Vprint_unicode_noformat_impl(FILE* const _Stream, const string_view
inline void _Fputc_newline(FILE* const _Stream) {
const bool _Was_write_successful = _CSTD fputc('\n', _Stream) == '\n';

if (!_Was_write_successful) [[unlikely]] {
if (!_Was_write_successful) {
_Throw_system_error(static_cast<errc>(errno));
}
}

inline void _Print_newline_only_unicode(FILE* const _Stream) {
const auto _Unicode_console = [&](const __std_unicode_console_handle _Console_handle) {
const bool _Was_flush_successful = _CSTD fflush(_Stream) == 0;
if (!_Was_flush_successful) [[unlikely]] {
if (!_Was_flush_successful) {
_Throw_system_error(static_cast<errc>(errno));
}

const __std_win_error _Console_print_result = __std_print_newline_only_to_unicode_console(_Console_handle);
if (_Console_print_result != __std_win_error::_Success) [[unlikely]] {
if (_Console_print_result != __std_win_error::_Success) {
_STD _Throw_system_error_from_std_win_error(_Console_print_result);
}
};
Expand All @@ -234,7 +234,7 @@ inline void _Vprint_unicode_impl(
const _Stream_lock_guard _Guard{_Stream};

const bool _Was_flush_successful = _CSTD _fflush_nolock(_Stream) == 0;
if (!_Was_flush_successful) [[unlikely]] {
if (!_Was_flush_successful) {
_Throw_system_error(static_cast<errc>(errno));
}

Expand Down
34 changes: 1 addition & 33 deletions stl/inc/type_traits
Original file line number Diff line number Diff line change
Expand Up @@ -327,32 +327,6 @@ struct is_convertible : bool_constant<__is_convertible_to(_From, _To)> {
_EXPORT_STD template <class _From, class _To>
constexpr bool is_convertible_v = __is_convertible_to(_From, _To);

#if !defined(__clang__) && !defined(__EDG__) // TRANSITION, DevCom-1627396
template <class _Ty>
struct is_convertible<_Ty&, volatile _Ty&> : true_type {};

template <class _Ty>
struct is_convertible<volatile _Ty&, volatile _Ty&> : true_type {};

template <class _Ty>
struct is_convertible<_Ty&, const volatile _Ty&> : true_type {};

template <class _Ty>
struct is_convertible<volatile _Ty&, const volatile _Ty&> : true_type {};

template <class _Ty>
constexpr bool is_convertible_v<_Ty&, volatile _Ty&> = true;

template <class _Ty>
constexpr bool is_convertible_v<volatile _Ty&, volatile _Ty&> = true;

template <class _Ty>
constexpr bool is_convertible_v<_Ty&, const volatile _Ty&> = true;

template <class _Ty>
constexpr bool is_convertible_v<volatile _Ty&, const volatile _Ty&> = true;
#endif // ^^^ workaround ^^^

_EXPORT_STD template <class _Ty>
struct is_enum : bool_constant<__is_enum(_Ty)> {}; // determine whether _Ty is an enumerated type

Expand Down Expand Up @@ -2205,13 +2179,7 @@ struct _Is_trivially_swappable : bool_constant<_Is_trivially_swappable_v<_Ty>> {

#if _HAS_CXX20
_EXPORT_STD template <class _From, class _To>
concept convertible_to =
#if !defined(__clang__) && !defined(__EDG__) // TRANSITION, DevCom-1627396
is_convertible_v<_From, _To>
#else // ^^^ workaround / no workaround vvv
__is_convertible_to(_From, _To)
#endif // ^^^ no workaround ^^^
&& requires { static_cast<_To>(_STD declval<_From>()); };
concept convertible_to = __is_convertible_to(_From, _To) && requires { static_cast<_To>(_STD declval<_From>()); };

template <class _RefWrap, class _Ty, class _RefWrapQ, class _TyQ>
concept _Ref_wrap_common_reference_exists_with = _Is_specialization_v<_RefWrap, reference_wrapper> && requires {
Expand Down
8 changes: 8 additions & 0 deletions stl/inc/xstring
Original file line number Diff line number Diff line change
Expand Up @@ -2418,6 +2418,10 @@ public:
[](_Elem* const _New_ptr, const _Elem* const _Old_ptr, const size_type _Old_size)
_STATIC_CALL_OPERATOR { _Traits::copy(_New_ptr, _Old_ptr, _Old_size + 1); });

// `_Reallocate_grow_by` calls `_ASAN_STRING_CREATE` assuming that the string
// has size (initialized memory) equal to its new capacity (allocated memory).
// This is not true for the `reserve` method, so we modify the ASan annotation.
_ASAN_STRING_MODIFY(*this, _Mypair._Myval2._Mysize, _Old_size);
_Mypair._Myval2._Mysize = _Old_size;
}

Expand All @@ -2442,6 +2446,10 @@ public:
[](_Elem* const _New_ptr, const _Elem* const _Old_ptr, const size_type _Old_size)
_STATIC_CALL_OPERATOR { _Traits::copy(_New_ptr, _Old_ptr, _Old_size + 1); });

// `_Reallocate_grow_by` calls `_ASAN_STRING_CREATE` assuming that the string
// has size (initialized memory) equal to its new capacity (allocated memory).
// This is not true for the `reserve` method, so we modify the ASan annotation.
_ASAN_STRING_MODIFY(*this, _Mypair._Myval2._Mysize, _Old_size);
_Mypair._Myval2._Mysize = _Old_size;
return;
}
Expand Down
14 changes: 0 additions & 14 deletions stl/inc/yvals_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -566,20 +566,6 @@
#define _FALLTHROUGH
#endif

#ifndef __has_cpp_attribute // vvv no attributes vvv
#define _LIKELY
#define _UNLIKELY
#elif __has_cpp_attribute(likely) >= 201803L && __has_cpp_attribute(unlikely) >= 201803L // ^^^ no attr / C++20 attr vvv
#define _LIKELY [[likely]]
#define _UNLIKELY [[unlikely]]
#elif defined(__clang__) // ^^^ C++20 attributes / clang attributes and C++17 or C++14 vvv
#define _LIKELY [[__likely__]]
#define _UNLIKELY [[__unlikely__]]
#else // ^^^ clang attributes and C++17 or C++14 / C1XX attributes and C++17 or C++14 vvv
#define _LIKELY
#define _UNLIKELY
#endif // ^^^ C1XX attributes and C++17 or C++14 ^^^

// _HAS_NODISCARD (in vcruntime.h) controls:
// [[nodiscard]] attributes on STL functions

Expand Down
Loading