Skip to content

P3697R1 Minor additions to C++26 standard library hardening #8001

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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 source/diagnostics.tex
Original file line number Diff line number Diff line change
Expand Up @@ -2034,7 +2034,7 @@
Let \tcode{n} be \tcode{t.size()}.

\pnum
\expects
\hardexpects
\tcode{skip <= skip + max_depth} is \tcode{true}.

\pnum
Expand Down Expand Up @@ -2213,7 +2213,7 @@

\begin{itemdescr}
\pnum
\expects
\hardexpects
\tcode{frame_no < size()} is \tcode{true}.

\pnum
Expand Down
52 changes: 26 additions & 26 deletions source/iterators.tex
Original file line number Diff line number Diff line change
Expand Up @@ -5574,7 +5574,7 @@

\begin{itemdescr}
\pnum
\expects
\hardexpects
\tcode{x.v_.valueless_by_exception()} is \tcode{false}.

\pnum
Expand All @@ -5594,7 +5594,7 @@

\begin{itemdescr}
\pnum
\expects
\hardexpects
\tcode{x.v_.valueless_by_exception()} is \tcode{false}.

\pnum
Expand Down Expand Up @@ -5624,7 +5624,7 @@

\begin{itemdescr}
\pnum
\expects
\hardexpects
\tcode{holds_alternative<I>(v_)} is \tcode{true}.

\pnum
Expand All @@ -5649,7 +5649,7 @@
\end{codeblock}

\pnum
\expects
\hardexpects
\tcode{holds_alternative<I>(v_)} is \tcode{true}.

\pnum
Expand Down Expand Up @@ -5694,7 +5694,7 @@

\begin{itemdescr}
\pnum
\expects
\hardexpects
\tcode{holds_alternative<I>(v_)} is \tcode{true}.

\pnum
Expand All @@ -5713,7 +5713,7 @@

\begin{itemdescr}
\pnum
\expects
\hardexpects
\tcode{holds_alternative<I>(v_)} is \tcode{true}.

\pnum
Expand Down Expand Up @@ -5768,7 +5768,7 @@

\begin{itemdescr}
\pnum
\expects
\hardexpects
\tcode{x.v_.valueless_by_exception()} and \tcode{y.v_.valueless_by_exception()}
are each \tcode{false}.

Expand All @@ -5789,7 +5789,7 @@

\begin{itemdescr}
\pnum
\expects
\hardexpects
\tcode{x.v_.valueless_by_exception()} and \tcode{y.v_.valueless_by_exception()}
are each \tcode{false}.

Expand All @@ -5810,7 +5810,7 @@

\begin{itemdescr}
\pnum
\expects
\hardexpects
\tcode{x.v_.valueless_by_exception()} and \tcode{y.v_.valueless_by_exception()}
are each \tcode{false}.

Expand All @@ -5832,7 +5832,7 @@

\begin{itemdescr}
\pnum
\expects
\hardexpects
\tcode{holds_alternative<I>(i.v_)} is \tcode{true}.

\pnum
Expand All @@ -5849,7 +5849,7 @@

\begin{itemdescr}
\pnum
\expects
\hardexpects
\tcode{holds_alternative<I>(x.v_)} and \tcode{holds_alternative<I2>(y.v_)}
are each \tcode{true}.

Expand Down Expand Up @@ -6014,8 +6014,8 @@

\begin{itemdescr}
\pnum
\expects
\tcode{n >= 0}.
\hardexpects
\tcode{n >= 0} is \tcode{true}.

\pnum
\effects
Expand Down Expand Up @@ -6101,7 +6101,7 @@

\begin{itemdescr}
\pnum
\expects
\hardexpects
\tcode{length > 0} is \tcode{true}.

\pnum
Expand Down Expand Up @@ -6129,8 +6129,8 @@

\begin{itemdescr}
\pnum
\expects
\tcode{n < length}.
\hardexpects
\tcode{n < length} is \tcode{true}.

\pnum
\effects
Expand All @@ -6146,8 +6146,8 @@

\begin{itemdescr}
\pnum
\expects
\tcode{length > 0}.
\hardexpects
\tcode{length > 0} is \tcode{true}.

\pnum
\effects
Expand All @@ -6166,8 +6166,8 @@

\begin{itemdescr}
\pnum
\expects
\tcode{length > 0}.
\hardexpects
\tcode{length > 0} is \tcode{true}.

\pnum
\effects
Expand Down Expand Up @@ -6263,8 +6263,8 @@

\begin{itemdescr}
\pnum
\expects
\tcode{n <= length}.
\hardexpects
\tcode{n <= length} is \tcode{true}.

\pnum
\effects
Expand Down Expand Up @@ -6339,8 +6339,8 @@

\begin{itemdescr}
\pnum
\expects
\tcode{-n <= length}.
\hardexpects
\tcode{-n <= length} is \tcode{true}.

\pnum
\effects
Expand Down Expand Up @@ -6420,7 +6420,7 @@

\begin{itemdescr}
\pnum
\expects
\hardexpects
\tcode{i.length > 0} is \tcode{true}.

\pnum
Expand All @@ -6438,7 +6438,7 @@

\begin{itemdescr}
\pnum
\expects
\hardexpects
Both \tcode{x.length > 0} and \tcode{y.length > 0} are \tcode{true}.

\pnum
Expand Down
7 changes: 5 additions & 2 deletions source/memory.tex
Original file line number Diff line number Diff line change
Expand Up @@ -3952,8 +3952,11 @@
\begin{itemdescr}
\pnum
\expects
\tcode{get() != nullptr \&\& i >= 0}.
If \tcode{T} is \tcode{U[N]}, \tcode{i < N}.
\tcode{get() != nullptr} is \tcode{true}.

\pnum
\hardexpects
$\tcode{i} \ge 0$. If \tcode{T} is \tcode{U[N]}, $\tcode{i} < \tcode{N}$.

\pnum
\returns
Expand Down
4 changes: 2 additions & 2 deletions source/ranges.tex
Original file line number Diff line number Diff line change
Expand Up @@ -1868,7 +1868,7 @@

\begin{itemdescr}
\pnum
\expects
\hardexpects
\tcode{!empty()} is \tcode{true}.

\pnum
Expand All @@ -1885,7 +1885,7 @@

\begin{itemdescr}
\pnum
\expects
\hardexpects
\tcode{!empty()} is \tcode{true}.

\pnum
Expand Down
5 changes: 5 additions & 0 deletions source/support.tex
Original file line number Diff line number Diff line change
Expand Up @@ -855,19 +855,24 @@
Additionally, each of the following macros is defined in a hardened implementation:
\begin{codeblock}
#define @\defnlibxname{cpp_lib_hardened_array}@ 202502L // also in \libheader{array}
#define @\defnlibxname{cpp_lib_hardened_basic_stacktrace}@ 202506L // also in \libheader{stacktrace}
#define @\defnlibxname{cpp_lib_hardened_basic_string}@ 202502L // also in \libheader{string}
#define @\defnlibxname{cpp_lib_hardened_basic_string_view}@ 202502L // also in \libheader{string_view}
#define @\defnlibxname{cpp_lib_hardened_bitset}@ 202502L // also in \libheader{bitset}
#define @\defnlibxname{cpp_lib_hardened_common_iterator}@ 202506L // also in \libheader{iterator}
#define @\defnlibxname{cpp_lib_hardened_counted_iterator}@ 202506L // also in \libheader{iterator}
#define @\defnlibxname{cpp_lib_hardened_deque}@ 202502L // also in \libheader{deque}
#define @\defnlibxname{cpp_lib_hardened_expected}@ 202502L // also in \libheader{expected}
#define @\defnlibxname{cpp_lib_hardened_forward_list}@ 202502L // also in \libheader{forward_list}
#define @\defnlibxname{cpp_lib_hardened_inplace_vector}@ 202502L // also in \libheader{inplace_vector}
#define @\defnlibxname{cpp_lib_hardened_list}@ 202502L // also in \libheader{list}
#define @\defnlibxname{cpp_lib_hardened_mdspan}@ 202502L // also in \libheader{mdspan}
#define @\defnlibxname{cpp_lib_hardened_optional}@ 202502L // also in \libheader{optional}
#define @\defnlibxname{cpp_lib_hardened_shared_ptr_array}@ 202506L // also in \libheader{memory}
#define @\defnlibxname{cpp_lib_hardened_span}@ 202502L // also in \libheader{span}
#define @\defnlibxname{cpp_lib_hardened_valarray}@ 202502L // also in \libheader{valarray}
#define @\defnlibxname{cpp_lib_hardened_vector}@ 202502L // also in \libheader{vector}
#define @\defnlibxname{cpp_lib_hardened_view_interface}@ 202506L // also in \libheader{memory}
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
#define @\defnlibxname{cpp_lib_hardened_view_interface}@ 202506L // also in \libheader{memory}
#define @\defnlibxname{cpp_lib_hardened_view_interface}@ 202506L // also in \libheader{ranges}

\end{codeblock}

\pnum
Expand Down