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

Improve debug checks (prelude to STL Hardening) #5270

Merged
merged 35 commits into from
Feb 11, 2025
Merged
Changes from 1 commit
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
0962eb1
Remove CDL preprocessor comments after a single line.
StephanTLavavej Jan 27, 2025
acc4f34
Remove CDL preprocessor comments after a single `_STL_VERIFY` over mu…
StephanTLavavej Jan 27, 2025
c20b369
docs/import_library.md: Don't mention CDL - it doesn't affect ABI, an…
StephanTLavavej Jan 27, 2025
2cb3a35
Improve debug messages: "array<T, 0> subscript invalid"
StephanTLavavej Jan 31, 2025
06a1361
Improve debug messages: "MEOW subscript out of range"
StephanTLavavej Jan 31, 2025
97d2acb
Improve debug messages: "MEOW() called on empty WOOF"
StephanTLavavej Jan 31, 2025
a7ce525
Improve debug messages: Clarify span's first<Count>(), last<Count>(),…
StephanTLavavej Jan 31, 2025
f325132
Improve debug messages: Clarify string_view remove_prefix(), remove_s…
StephanTLavavej Jan 31, 2025
a3de284
Improve debug messages: std::expected.
StephanTLavavej Jan 31, 2025
a5ab1f5
Improve debug messages: Grammar.
StephanTLavavej Feb 4, 2025
eca9c57
Test cleanup: Remove CDL definitions from some `<ranges>` tests.
StephanTLavavej Jan 28, 2025
fd0c6f1
Test cleanup: Drop CDL from `<format>` test, properly test negative d…
StephanTLavavej Jan 28, 2025
2007c12
Test cleanup: Remove VSO-847348 workarounds.
StephanTLavavej Feb 5, 2025
ed90fb1
Test cleanup: Use `if constexpr` instead of tag dispatch and plain `if`.
StephanTLavavej Feb 5, 2025
6554e97
Code cleanups: Add const, unwrap "strengthened".
StephanTLavavej Feb 5, 2025
a78ff8d
Code cleanup: Conditional `_STL_REPORT_ERROR` => `_STL_VERIFY` or `_S…
StephanTLavavej Feb 1, 2025
88a59ba
Code cleanup: `_STL_VERIFY(false)` => `_STL_REPORT_ERROR`
StephanTLavavej Feb 1, 2025
71dcd4f
Code cleanup: Consistently order `case` before `default`.
StephanTLavavej Feb 4, 2025
25960e5
Code cleanup: Fuse _Check_alignment into atomic_ref ctor.
StephanTLavavej Feb 4, 2025
85f29dc
Code cleanup: Collapse _ATOMIC_REF_CHECK_ALIGNMENT into _STL_ASSERT.
StephanTLavavej Feb 4, 2025
57e3cca
Code cleanup: Avoid duplicating _Off and _Count. Add const to _Moved.
StephanTLavavej Feb 4, 2025
22a4cbb
Code cleanup: Avoid duplicating _STD copy() call.
StephanTLavavej Feb 4, 2025
59512b9
Code cleanup: Avoid more duplication.
StephanTLavavej Feb 4, 2025
62ce28d
Code cleanup: IDL == 2 implies debug, so _STL_ASSERT should be _STL_V…
StephanTLavavej Feb 4, 2025
8c69d19
Code cleanup: Extract _Can_memcpy for clarity, simplifying following …
StephanTLavavej Feb 4, 2025
451c7ba
Enhancement (for CoE): Adjust uninitialized_meow's logic.
StephanTLavavej Feb 4, 2025
33df586
Enhancement (for CoE): After _INVALID_MEMORY_ORDER, consistently fall…
StephanTLavavej Feb 4, 2025
81776a0
Enhancement: _STL_ASSERT => _STL_VERIFY for checks within IDL >= 1.
StephanTLavavej Feb 4, 2025
0f562b8
Enhancement: Replace _STL_ASSERT with _STL_INTERNAL_STATIC_ASSERT.
StephanTLavavej Feb 4, 2025
925cd6a
Enhancement: Remove IDL=2 null asserts from auto_ptr deref/arrow.
StephanTLavavej Feb 4, 2025
a6ea00a
Enhancement: _Span_iterator::operator-= was unconditionally checking.
StephanTLavavej Feb 4, 2025
b1f76b8
Enhancement: Improve `_STL_REPORT_ERROR`, `_STL_VERIFY` codegen.
StephanTLavavej Feb 5, 2025
05fdc63
Code cleanup: Use `_Check_MEOW_memory_order` to avoid some `_FALLTHRO…
StephanTLavavej Feb 5, 2025
7f6b11b
Improve debug messages: "stores" => "contains"
StephanTLavavej Feb 6, 2025
5fee29e
Code review feedback: Improve debug messages and whitespace.
StephanTLavavej Feb 7, 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
18 changes: 9 additions & 9 deletions stl/inc/span
Original file line number Diff line number Diff line change
Expand Up @@ -351,11 +351,11 @@ public:
template <size_t _Count>
_NODISCARD constexpr auto first() const noexcept /* strengthened */ {
if constexpr (_Extent != dynamic_extent) {
static_assert(_Count <= _Extent, "Count out of range in span::first()");
static_assert(_Count <= _Extent, "Count out of range in span::first<Count>()");
StephanTLavavej marked this conversation as resolved.
Show resolved Hide resolved
}
#if _CONTAINER_DEBUG_LEVEL > 0
else {
_STL_VERIFY(_Count <= _Mysize, "Count out of range in span::first()");
_STL_VERIFY(_Count <= _Mysize, "Count out of range in span::first<Count>()");
}
#endif // _CONTAINER_DEBUG_LEVEL > 0
return span<element_type, _Count>{_Mydata, _Count};
Expand All @@ -372,11 +372,11 @@ public:
template <size_t _Count>
_NODISCARD constexpr auto last() const noexcept /* strengthened */ {
if constexpr (_Extent != dynamic_extent) {
static_assert(_Count <= _Extent, "Count out of range in span::last()");
static_assert(_Count <= _Extent, "Count out of range in span::last<Count>()");
}
#if _CONTAINER_DEBUG_LEVEL > 0
else {
_STL_VERIFY(_Count <= _Mysize, "Count out of range in span::last()");
_STL_VERIFY(_Count <= _Mysize, "Count out of range in span::last<Count>()");
}
#endif // _CONTAINER_DEBUG_LEVEL > 0
return span<element_type, _Count>{_Mydata + (_Mysize - _Count), _Count};
Expand All @@ -392,16 +392,16 @@ public:
template <size_t _Offset, size_t _Count = dynamic_extent>
_NODISCARD constexpr auto subspan() const noexcept /* strengthened */ {
if constexpr (_Extent != dynamic_extent) {
static_assert(_Offset <= _Extent, "Offset out of range in span::subspan()");
static_assert(
_Count == dynamic_extent || _Count <= _Extent - _Offset, "Count out of range in span::subspan()");
static_assert(_Offset <= _Extent, "Offset out of range in span::subspan<Offset, Count>()");
static_assert(_Count == dynamic_extent || _Count <= _Extent - _Offset,
"Count out of range in span::subspan<Offset, Count>()");
}
#if _CONTAINER_DEBUG_LEVEL > 0
else {
_STL_VERIFY(_Offset <= _Mysize, "Offset out of range in span::subspan()");
_STL_VERIFY(_Offset <= _Mysize, "Offset out of range in span::subspan<Offset, Count>()");

if constexpr (_Count != dynamic_extent) {
_STL_VERIFY(_Count <= _Mysize - _Offset, "Count out of range in span::subspan()");
_STL_VERIFY(_Count <= _Mysize - _Offset, "Count out of range in span::subspan<Offset, Count>()");
}
}
#endif // _CONTAINER_DEBUG_LEVEL > 0
Expand Down