Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
5ae5775
xtime.cpp doesn't need awint.hpp, just Windows.h.
StephanTLavavej Nov 23, 2025
e9f73cb
validate.cpp doesn't use assert() anymore.
StephanTLavavej Nov 23, 2025
cb6d96f
`// namespace$` => `// unnamed namespace`
StephanTLavavej Nov 23, 2025
f13a24f
Fuse `_HAS_CXX20` regions.
StephanTLavavej Nov 23, 2025
44fdbdb
Guard `_Supports_transparency` for `_HAS_CXX23`.
StephanTLavavej Nov 23, 2025
8b49cf9
Exclude charconv tables and test cases from VSCode search.
StephanTLavavej Nov 24, 2025
61703c6
Drop unnecessary `inline` for function templates.
StephanTLavavej Nov 24, 2025
aa22730
`_STATIC_LAMBDA` => `_STATIC_CALL_OPERATOR`
StephanTLavavej Nov 24, 2025
09e7850
Add `_STATIC_CALL_OPERATOR` to more stateless lambdas.
StephanTLavavej Nov 24, 2025
e2832d0
`decltype(tzdb::leap_seconds)` => `vector<leap_second>`
StephanTLavavej Nov 24, 2025
6b15516
Drop unnecessary newlines in do-while loops.
StephanTLavavej Nov 24, 2025
6dcfd05
`_CMPXCHG_MASK_OUT_PADDING_BITS` implies `_HAS_CXX20`, so `_INLINE_VA…
StephanTLavavej Nov 24, 2025
74555fd
tests/utils/stl/util.py: Remove dead code, part 1.
StephanTLavavej Nov 24, 2025
5b1dccb
tests/utils/stl/util.py: Remove dead code, part 2.
StephanTLavavej Nov 24, 2025
d7eb5b3
Unwrap "strengthened" comments.
StephanTLavavej Nov 24, 2025
eb35676
`_Vb_val::_Getal()` is a direct member function; all other calls omit…
StephanTLavavej Nov 24, 2025
12f65d1
Use is_null_pointer.
StephanTLavavej Nov 28, 2025
3a4f7e7
Add newlines to indicate that we don't like to interleave includes an…
StephanTLavavej Nov 28, 2025
f40b3c2
Avoid interleaving includes and conditionals.
StephanTLavavej Nov 28, 2025
252b0c3
Include test support headers with angle brackets.
StephanTLavavej Nov 28, 2025
7e2e374
`int main()` => `void test()` in test.compile.pass.cpp.
StephanTLavavej Nov 28, 2025
e2a2846
Drop `// COMPILE-ONLY` in test.compile.pass.cpp.
StephanTLavavej Nov 28, 2025
9ec642a
Make VSO_0000000_type_traits compile-only.
StephanTLavavej Nov 28, 2025
ae9b4a6
Delete tests/tr1/env_single.lst.
StephanTLavavej Nov 28, 2025
7cb05af
`_USE_NAMED_IDL_NAMESPACE` is unused.
StephanTLavavej Nov 28, 2025
124c2c8
Consistently say "Unknown architecture".
StephanTLavavej Nov 28, 2025
2abe358
vector_algorithms.cpp: Use `#ifdef _WIN64` when deciding between x64 …
StephanTLavavej Nov 28, 2025
608c72a
Qualify a `_STD _In_range` call.
StephanTLavavej Nov 28, 2025
ce684c2
`<execution>`: `_In_range` => `_In_rng` to avoid shadowing.
StephanTLavavej Nov 28, 2025
f1c6fc5
Consistently reduce code duplication when checking intrinsic availabi…
StephanTLavavej Nov 28, 2025
9ba3da6
stride_view ctor: Mark `range_difference_t<_Vw> _Stride_` as const, t…
StephanTLavavej Nov 29, 2025
65aadfe
`<random>`: Add parens when mixing left shifts with bitwise OR.
StephanTLavavej Nov 29, 2025
1c3f0fc
`_Zip_fn` and `_Zip_transform_fn` should be `class`, not `struct`.
StephanTLavavej Nov 29, 2025
3fcbd99
Make ranges function objects `struct`s when possible.
StephanTLavavej Nov 29, 2025
901aaca
`steady_clock::now()` should use `_STL_INTERNAL_STATIC_ASSERT`.
StephanTLavavej Nov 29, 2025
4bda581
`_STL_INTERNAL_STATIC_ASSERT(false)` => `static_assert(false)` for C+…
StephanTLavavej Nov 29, 2025
d48b3e5
`_STL_INTERNAL_STATIC_ASSERT(false)` => `static_assert(false, "reason…
StephanTLavavej Nov 29, 2025
bd8eff7
CMakeLists.txt: Avoid inconsistently quote-expanding `VCLIBS_TARGET_A…
StephanTLavavej Nov 30, 2025
80e3eed
iosptrs.cpp: Test `_M_CEE_PURE` instead of `_M_CEE_MIXED`.
StephanTLavavej Nov 30, 2025
0f25689
Move stdext macros to `<exception>` and limit their scope.
StephanTLavavej Nov 30, 2025
cc92234
xalloc.cpp: Include just `<yvals.h>`, we don't need `<stdexcept>`.
StephanTLavavej Nov 30, 2025
2b7ef8a
yvals_core.h: Remove distinction between "directly controls" and "ind…
StephanTLavavej Nov 30, 2025
c82cf27
yvals_core.h: Omit "Other deprecation warnings".
StephanTLavavej Nov 30, 2025
654b931
Avoid using is_constant_evaluated() to initialize const variables.
StephanTLavavej Nov 30, 2025
d41ce41
Oops: xkeycheck.h doesn't have an "unnamed namespace".
StephanTLavavej Dec 1, 2025
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
6 changes: 5 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,9 @@
"./llvm-project/libcxx/utils",
"./llvm-project/llvm/utils/lit",
"./tests/utils"
]
],
"search.exclude": {
"stl/src/xcharconv_ryu_tables.cpp": true,
"tests/std/tests/P0067R5_charconv/*test_cases*.hpp": true
}
}
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ option(STL_ASAN_BUILD "Build the STL with ASan enabled" OFF)

set(VCLIBS_EXPLICIT_MACHINE "")

if("${VCLIBS_TARGET_ARCHITECTURE}" STREQUAL "x86")
if(VCLIBS_TARGET_ARCHITECTURE STREQUAL "x86")
set(VCLIBS_TARGET_ARCHITECTURE "x86")
set(VCLIBS_I386_OR_AMD64 "i386")
set(VCLIBS_X86_OR_X64 "x86")
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ if(DEFINED STL_BINARY_DIR)

string(TOLOWER "${VCLIBS_TARGET_ARCHITECTURE}" VCLIBS_TARGET_ARCHITECTURE)

if("${VCLIBS_TARGET_ARCHITECTURE}" STREQUAL "x86")
if(VCLIBS_TARGET_ARCHITECTURE STREQUAL "x86")
set(VCLIBS_I386_OR_AMD64 "i386")
elseif(VCLIBS_TARGET_ARCHITECTURE STREQUAL "x64")
set(VCLIBS_I386_OR_AMD64 "amd64")
Expand Down
39 changes: 15 additions & 24 deletions stl/inc/__msvc_bit_utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,16 +113,13 @@ _NODISCARD int _Countl_zero_bsr(const _Ty _Val) noexcept {

template <class _Ty>
_NODISCARD int _Checked_x86_x64_countl_zero(const _Ty _Val) noexcept {
#ifdef __AVX2__
return _Countl_zero_lzcnt(_Val);
#else // ^^^ defined(__AVX2__) / !defined(__AVX2__) vvv
#ifndef __AVX2__
const bool _Definitely_have_lzcnt = __isa_available >= _Stl_isa_available_avx2;
if (_Definitely_have_lzcnt) {
return _Countl_zero_lzcnt(_Val);
} else {
if (!_Definitely_have_lzcnt) {
return _Countl_zero_bsr(_Val);
}
#endif // ^^^ !defined(__AVX2__) ^^^
return _Countl_zero_lzcnt(_Val);
}
#endif // (defined(_M_IX86) && !defined(_M_HYBRID_X86_ARM64)) || (defined(_M_X64) && !defined(_M_ARM64EC))

Expand Down Expand Up @@ -259,16 +256,13 @@ _NODISCARD int _Countr_zero_bsf(const _Ty _Val) noexcept {

template <class _Ty>
_NODISCARD int _Checked_x86_x64_countr_zero(const _Ty _Val) noexcept {
#ifdef __AVX2__
return _Countr_zero_tzcnt(_Val);
#else // ^^^ defined(__AVX2__) / !defined(__AVX2__) vvv
#ifndef __AVX2__
const bool _Definitely_have_tzcnt = __isa_available >= _Stl_isa_available_avx2;
if (_Definitely_have_tzcnt) {
return _Countr_zero_tzcnt(_Val);
} else {
if (!_Definitely_have_tzcnt) {
return _Countr_zero_bsf(_Val);
}
#endif // ^^^ !defined(__AVX2__) ^^^
return _Countr_zero_tzcnt(_Val);
}

#endif // _HAS_TZCNT_BSF_INTRINSICS
Expand Down Expand Up @@ -336,20 +330,17 @@ constexpr decltype(auto) _Select_countr_zero_impl(_Fn _Callback) {
// TRANSITION, DevCom-1527995: Lambdas in this function ensure inlining
#if _HAS_TZCNT_BSF_INTRINSICS && _HAS_CXX20
if (!_STD is_constant_evaluated()) {
#ifdef __AVX2__
return _Callback([](_Ty _Val) _STATIC_LAMBDA { return _Countr_zero_tzcnt(_Val); });
#else // ^^^ AVX2 / not AVX2 vvv
#ifndef __AVX2__
const bool _Definitely_have_tzcnt = __isa_available >= _Stl_isa_available_avx2;
if (_Definitely_have_tzcnt) {
return _Callback([](_Ty _Val) _STATIC_LAMBDA { return _Countr_zero_tzcnt(_Val); });
} else {
return _Callback([](_Ty _Val) _STATIC_LAMBDA { return _Countr_zero_bsf(_Val); });
if (!_Definitely_have_tzcnt) {
return _Callback([](_Ty _Val) _STATIC_CALL_OPERATOR { return _Countr_zero_bsf(_Val); });
}
#endif // ^^^ not AVX2 ^^^
#endif // ^^^ !defined(__AVX2__) ^^^
return _Callback([](_Ty _Val) _STATIC_CALL_OPERATOR { return _Countr_zero_tzcnt(_Val); });
}
#endif // ^^^ _HAS_TZCNT_BSF_INTRINSICS && _HAS_CXX20 ^^^
// C++17 constexpr gcd() calls this function, so it should be constexpr unless we detect runtime evaluation.
return _Callback([](_Ty _Val) _STATIC_LAMBDA { return _Countr_zero_fallback(_Val); });
return _Callback([](_Ty _Val) _STATIC_CALL_OPERATOR { return _Countr_zero_fallback(_Val); });
}

template <class _Ty>
Expand Down Expand Up @@ -394,13 +385,13 @@ _CONSTEXPR20 decltype(auto) _Select_popcount_impl(_Fn _Callback) {
#if !_POPCNT_INTRINSICS_ALWAYS_AVAILABLE
const bool _Definitely_have_popcnt = __isa_available >= _Stl_isa_available_sse42;
if (!_Definitely_have_popcnt) {
return _Callback([](_Ty _Val) _STATIC_LAMBDA { return _Popcount_fallback(_Val); });
return _Callback([](_Ty _Val) _STATIC_CALL_OPERATOR { return _Popcount_fallback(_Val); });
}
#endif // ^^^ !_POPCNT_INTRINSICS_ALWAYS_AVAILABLE ^^^
return _Callback([](_Ty _Val) _STATIC_LAMBDA { return _Unchecked_popcount(_Val); });
return _Callback([](_Ty _Val) _STATIC_CALL_OPERATOR { return _Unchecked_popcount(_Val); });
}
#endif // ^^^ _HAS_POPCNT_INTRINSICS ^^^
return _Callback([](_Ty _Val) _STATIC_LAMBDA { return _Popcount_fallback(_Val); });
return _Callback([](_Ty _Val) _STATIC_CALL_OPERATOR { return _Popcount_fallback(_Val); });
}

#undef _HAS_TZCNT_BSF_INTRINSICS
Expand Down
8 changes: 4 additions & 4 deletions stl/inc/__msvc_chrono.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,7 @@ namespace chrono {
_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();
static_assert(period::num == 1, "This assumes period::num == 1.");
_STL_INTERNAL_STATIC_ASSERT(period::num == 1);
// The compiler recognizes the constants for frequency and time period and uses shifts and
// multiplies instead of divides to calculate the nanosecond value.
constexpr long long _TenMHz = 10'000'000;
Expand All @@ -686,7 +686,7 @@ namespace chrono {
// 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.");
_STL_INTERNAL_STATIC_ASSERT(period::den % _TenMHz == 0);
constexpr long long _Multiplier = period::den / _TenMHz;
return time_point(duration(_Ctr * _Multiplier));
} else if (_Freq == _TwentyFourMHz) {
Expand All @@ -695,8 +695,8 @@ namespace chrono {
using _Multiplier_part = ratio<period::den % _TwentyFourMHz, _TwentyFourMHz>;
constexpr long long _Multiplier_num = _Multiplier_part::num;
constexpr long long _Multiplier_den = _Multiplier_part::den;
static_assert(
_Multiplier_num <= _Multiplier_whole, "This assumes that _Ctr * _Multiplier_num doesn't overflow.");
// This assumes that _Ctr * _Multiplier_num doesn't overflow.
_STL_INTERNAL_STATIC_ASSERT(_Multiplier_num <= _Multiplier_whole);
const long long _Whole = _Ctr * _Multiplier_whole;
const long long _Part = _Ctr * _Multiplier_num / _Multiplier_den;
return time_point(duration(_Whole + _Part));
Expand Down
1 change: 1 addition & 0 deletions stl/inc/__msvc_formatter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
#include <cstddef>
#include <cstdint>
#include <type_traits>

#if _HAS_CXX23
#include <xutility>
#endif // _HAS_CXX23
Expand Down
4 changes: 2 additions & 2 deletions stl/inc/__msvc_ranges_to.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -632,7 +632,7 @@ namespace ranges {
} else if constexpr (_Strat == _St::_Own) {
return owning_view{_STD forward<_Rng>(_Range)};
} else {
_STL_INTERNAL_STATIC_ASSERT(false); // unexpected strategy
static_assert(false); // unexpected strategy
}
}
};
Expand Down Expand Up @@ -1146,7 +1146,7 @@ namespace ranges {
"the default-constructed object. (N5014 [range.utility.conv.to]/2.1.5)");
}
} else if constexpr (input_range<range_reference_t<_Rng>>) {
const auto _Xform = [](auto&& _Elem) _STATIC_LAMBDA {
const auto _Xform = [](auto&& _Elem) _STATIC_CALL_OPERATOR {
return _RANGES to<range_value_t<_Container>>(_STD forward<decltype(_Elem)>(_Elem));
};
return _RANGES to<_Container>(views::transform(ref_view{_Range}, _Xform), _STD forward<_Types>(_Args)...);
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 @@ -426,7 +426,7 @@ auto _Format_arg_traits<_Context>::_Type_eraser() {
return basic_string_view<_Char_type>{};
} else if constexpr (_Is_any_of_v<decay_t<_Td>, _Char_type*, const _Char_type*>) {
return static_cast<const _Char_type*>(nullptr);
} else if constexpr (is_void_v<remove_pointer_t<_Td>> || is_same_v<_Td, nullptr_t>) {
} else if constexpr (is_void_v<remove_pointer_t<_Td>> || is_null_pointer_v<_Td>) {
return static_cast<const void*>(nullptr);
} else {
int _Dummy{};
Expand Down
14 changes: 6 additions & 8 deletions stl/inc/__msvc_string_view.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ size_t _Find_first_of_pos_vectorized(const _Ty1* const _Haystack, const size_t _
} else if constexpr (sizeof(_Ty1) == 8) {
return ::__std_find_first_of_trivial_pos_8(_Haystack, _Haystack_length, _Needle, _Needle_length);
} else {
_STL_INTERNAL_STATIC_ASSERT(false); // unexpected size
static_assert(false, "unexpected size");
}
}
#endif // ^^^ _VECTORIZED_FIND_FIRST_OF ^^^
Expand All @@ -111,7 +111,7 @@ size_t _Find_last_of_pos_vectorized(const _Ty1* const _Haystack, const size_t _H
} else if constexpr (sizeof(_Ty1) == 2) {
return ::__std_find_last_of_trivial_pos_2(_Haystack, _Haystack_length, _Needle, _Needle_length);
} else {
_STL_INTERNAL_STATIC_ASSERT(false); // unexpected size
static_assert(false, "unexpected size");
}
}
#endif // ^^^ _VECTORIZED_FIND_LAST_OF ^^^
Expand All @@ -128,7 +128,7 @@ const _Ty* _Find_not_ch_vectorized(const _Ty* const _First, const _Ty* const _La
} else if constexpr (sizeof(_Ty) == 8) {
return static_cast<const _Ty*>(::__std_find_not_ch_8(_First, _Last, static_cast<uint64_t>(_Ch)));
} else {
_STL_INTERNAL_STATIC_ASSERT(false); // unexpected size
static_assert(false, "unexpected size");
}
}
#endif // ^^^ _VECTORIZED_FIND ^^^
Expand All @@ -145,7 +145,7 @@ size_t _Find_last_not_ch_pos_vectorized(const _Ty* const _First, const _Ty* cons
} else if constexpr (sizeof(_Ty) == 8) {
return ::__std_find_last_not_ch_pos_8(_First, _Last, static_cast<uint64_t>(_Ch));
} else {
_STL_INTERNAL_STATIC_ASSERT(false); // unexpected size
static_assert(false, "unexpected size");
}
}
#endif // ^^^ _VECTORIZED_FIND_LAST ^^^
Expand All @@ -160,7 +160,7 @@ size_t _Find_first_not_of_pos_vectorized(const _Ty1* const _Haystack, const size
} else if constexpr (sizeof(_Ty1) == 2) {
return ::__std_find_first_not_of_trivial_pos_2(_Haystack, _Haystack_length, _Needle, _Needle_length);
} else {
_STL_INTERNAL_STATIC_ASSERT(false); // unexpected size
static_assert(false, "unexpected size");
}
}
#endif // ^^^ _VECTORIZED_FIND_FIRST_OF ^^^
Expand All @@ -175,7 +175,7 @@ size_t _Find_last_not_of_pos_vectorized(const _Ty1* const _Haystack, const size_
} else if constexpr (sizeof(_Ty1) == 2) {
return ::__std_find_last_not_of_trivial_pos_2(_Haystack, _Haystack_length, _Needle, _Needle_length);
} else {
_STL_INTERNAL_STATIC_ASSERT(false); // unexpected size
static_assert(false, "unexpected size");
}
}
#endif // ^^^ _VECTORIZED_FIND_LAST_OF ^^^
Expand Down Expand Up @@ -1961,9 +1961,7 @@ namespace ranges {
template <class _Elem, class _Traits>
constexpr bool enable_borrowed_range<basic_string_view<_Elem, _Traits>> = true;
} // namespace ranges
#endif // _HAS_CXX20

#if _HAS_CXX20
_EXPORT_STD template <class _Elem, class _Traits>
_NODISCARD constexpr bool operator==(const basic_string_view<_Elem, _Traits> _Lhs,
const type_identity_t<basic_string_view<_Elem, _Traits>> _Rhs) noexcept {
Expand Down
Loading