Skip to content

P2186R2 Removing Garbage Collection Support #4661

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

Merged
merged 1 commit into from
Jun 15, 2021
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
97 changes: 0 additions & 97 deletions source/basic.tex
Original file line number Diff line number Diff line change
Expand Up @@ -4009,103 +4009,6 @@
deallocation function shall deallocate the storage referenced by the
pointer, ending the duration of the region of storage.

\rSec4[basic.stc.dynamic.safety]{Safely-derived pointers}

\pnum
\indextext{pointer!safely-derived|(}%
\indextext{pointer!to traceable object}%
A \defn{traceable pointer object} is
\begin{itemize}
\item an object of an object pointer
type\iref{basic.compound}, or
\item an object of an integral type that is at least as large as \tcode{std::intptr_t},
or
\item a sequence of elements in an array of narrow character
type\iref{basic.fundamental}, where the size and alignment of the sequence
match those of some object pointer type.
\end{itemize}

\pnum
A pointer value is a \defnadj{safely-derived}{pointer} to an object with dynamic storage duration
only if the pointer value has an object pointer type
and is one of the following:
\begin{itemize}
\item the value returned by a call to the \Cpp{} standard library implementation of
\tcode{::\keyword{operator} \keyword{new}(std::\brk{}size_t)} or
\tcode{::\keyword{operator} \keyword{new}(std::size_t, std::align_val_t)}%
;%
\begin{footnote}
This subclause does not impose restrictions
on indirection through pointers to memory not allocated by \tcode{::\keyword{operator} \keyword{new}}. This
maintains the ability of many \Cpp{} implementations to use binary libraries and
components written in other languages. In particular, this applies to C binaries,
because indirection through pointers to memory allocated by \tcode{std::malloc} is not restricted.
\end{footnote}

\item the result of taking the address of an object (or one of its
subobjects) designated by an lvalue resulting from indirection
through a safely-derived pointer value;

\item the result of well-defined pointer arithmetic\iref{expr.add} using a safely-derived pointer
value;

\item the result of a well-defined pointer
conversion~(\ref{conv.ptr}, \ref{expr.type.conv}, \ref{expr.static.cast},
\ref{expr.cast}) of a safely-derived pointer value;

\item the result of a \keyword{reinterpret_cast} of a safely-derived pointer value;

\item the result of a \keyword{reinterpret_cast} of an integer representation of a
safely-derived pointer value;

\item the value of an object whose value was copied from a traceable pointer object,
where at the time of the copy the source object contained a copy of a safely-derived
pointer value.
\end{itemize}

\pnum
\indextext{integer representation}%
\indextext{pointer!integer representation of safely-derived}%
An integer value is an \defnx{integer representation of a safely-derived pointer}{safely-derived pointer!integer representation}
only if its type is at least as large as \tcode{std::intptr_t} and it is one of the
following:
\begin{itemize}
\item the result of a \keyword{reinterpret_cast} of a safely-derived pointer value;

\item the result of a valid conversion of an integer representation of a safely-derived
pointer value;

\item the value of an object whose value was copied from a traceable pointer object,
where at the time of the copy the source object contained an integer representation of a
safely-derived pointer value;

\item the result of an additive or bitwise operation, one of whose operands is an
integer representation of a safely-derived pointer value \tcode{P}, if that result
converted by \tcode{reinterpret_cast<void*>} would compare equal to a safely-derived
pointer computable from \tcode{\keyword{reinterpret_cast}<\keyword{void}*>(P)}.
\end{itemize}

\pnum
An implementation may have \defn{relaxed pointer safety}, in which case the
validity of a pointer value does not depend on whether it is a safely-derived
pointer value. Alternatively, an implementation may have \defn{strict pointer
safety}, in which case a pointer value referring to an object with dynamic
storage duration that is not a safely-derived pointer
value is an invalid pointer value unless
the referenced complete object has previously been declared
reachable\iref{util.dynamic.safety}.
\begin{note}
The effect of using an invalid pointer value (including passing it to a
deallocation function) is undefined, see~\ref{basic.stc}.
This is true even if the unsafely-derived pointer value would compare equal to
some safely-derived pointer value.
\end{note}
It is
\impldef{whether an implementation has relaxed or strict pointer
safety} whether an implementation has relaxed or strict pointer safety.%
\indextext{pointer!safely-derived|)}%
\indextext{storage duration!dynamic|)}

\rSec3[basic.stc.inherit]{Duration of subobjects}

\pnum
Expand Down
10 changes: 0 additions & 10 deletions source/compatibility.tex
Original file line number Diff line number Diff line change
Expand Up @@ -1556,16 +1556,6 @@

\rSec2[diff.cpp03.utilities]{\ref{utilities}: general utilities library}

\diffref{util.dynamic.safety}
\change
Minimal support for garbage-collected regions.
\rationale
Required by new feature.
\effect
Valid \CppIII{} code, compiled without traceable pointer support,
that interacts with newer \Cpp{} code using regions declared reachable may
have different runtime behavior.

\diffref{refwrap,arithmetic.operations,comparisons,logical.operations,bitwise.operations}
\change
Standard function object types no longer derived from
Expand Down
7 changes: 1 addition & 6 deletions source/expressions.tex
Original file line number Diff line number Diff line change
Expand Up @@ -662,8 +662,7 @@
the glvalue.

\item Otherwise, if the object to which the glvalue refers contains an invalid
pointer value~(\ref{basic.stc.dynamic.deallocation},
\ref{basic.stc.dynamic.safety}), the behavior is
pointer value~(\ref{basic.stc.dynamic.deallocation}), the behavior is
\impldef{lvalue-to-rvalue conversion of an invalid pointer value}.

\item Otherwise, the object indicated by the glvalue is read\iref{defns.access},
Expand Down Expand Up @@ -4010,10 +4009,6 @@
\indextext{conversion!implementation-defined pointer integer}%
mappings between pointers and integers are otherwise
\impldef{conversions between pointers and integers}.
\begin{note}
Except as described in \ref{basic.stc.dynamic.safety}, the result of
such a conversion will not be a safely-derived pointer value.
\end{note}

\pnum
\indextext{cast!reinterpret!pointer-to-function}%
Expand Down
22 changes: 10 additions & 12 deletions source/lib-intro.tex
Original file line number Diff line number Diff line change
Expand Up @@ -2364,6 +2364,9 @@
\item \indexlibraryzombie{const_mem_fun1_t} \tcode{const_mem_fun1_t},
\item \indexlibraryzombie{const_mem_fun_ref_t} \tcode{const_mem_fun_ref_t},
\item \indexlibraryzombie{const_mem_fun_t} \tcode{const_mem_fun_t},
\item \indexlibraryzombie{declare_no_pointers} \tcode{declare_no_pointers},
\item \indexlibraryzombie{declare_reachable} \tcode{declare_reachable},
\item \indexlibraryzombie{get_pointer_safety} \tcode{get_pointer_safety},
\item \indexlibraryzombie{get_temporary_buffer} \tcode{get_temporary_buffer},
\item \indexlibraryzombie{get_unexpected} \tcode{get_unexpected},
\item \indexlibraryzombie{gets} \tcode{gets},
Expand All @@ -2377,6 +2380,7 @@
\item \indexlibraryzombie{mem_fun} \tcode{mem_fun},
\item \indexlibraryzombie{not1} \tcode{not1},
\item \indexlibraryzombie{not2} \tcode{not2},
\item \indexlibraryzombie{pointer_safety} \tcode{pointer_safety},
\item \indexlibraryzombie{pointer_to_binary_function} \tcode{pointer_to_binary_function},
\item \indexlibraryzombie{pointer_to_unary_function} \tcode{pointer_to_unary_function},
\item \indexlibraryzombie{ptr_fun} \tcode{ptr_fun},
Expand All @@ -2389,22 +2393,25 @@
\item \indexlibraryzombie{unary_function} \tcode{unary_function},
\item \indexlibraryzombie{unary_negate} \tcode{unary_negate},
\item \indexlibraryzombie{uncaught_exception} \tcode{uncaught_exception},
\item \indexlibraryzombie{undeclare_no_pointers} \tcode{undeclare_no_pointers},
\item \indexlibraryzombie{undeclare_reachable} \tcode{undeclare_reachable},
\item \indexlibraryzombie{unexpected} \tcode{unexpected},
and
\item \indexlibraryzombie{unexpected_handler} \tcode{unexpected_handler}.
\end{itemize}

\pnum
The following names are reserved as member types for previous standardization,
The following names are reserved as members for previous standardization,
and may not be used as a name for object-like macros in portable code:
\begin{itemize}
\item \indexlibraryzombie{argument_type} \tcode{argument_type},
\item \indexlibraryzombie{first_argument_type} \tcode{first_argument_type},
\item \indexlibraryzombie{io_state} \tcode{io_state},
\item \indexlibraryzombie{open_mode} \tcode{open_mode},
\item \indexlibraryzombie{preferred} \tcode{preferred},
\item \indexlibraryzombie{second_argument_type} \tcode{second_argument_type},
and
\item \indexlibraryzombie{seek_dir} \tcode{seek_dir}.
\item \indexlibraryzombie{seek_dir} \tcode{seek_dir}, and.
\item \indexlibraryzombie{strict} \tcode{strict}.
\end{itemize}

\pnum
Expand Down Expand Up @@ -3135,15 +3142,6 @@
for a non-virtual function
by adding a non-throwing exception specification.

\rSec3[res.on.pointer.storage]{Restrictions on storage of pointers}

\pnum
\indextext{traceable pointer object}%
\indextext{pointer!to traceable object}%
Objects constructed by the standard library that may hold a user-supplied pointer value
or an integer of type \tcode{std::intptr_t} shall store such values in a traceable
pointer location\iref{basic.stc.dynamic.safety}.

\rSec3[value.error.codes]{Value of error codes}

\pnum
Expand Down
6 changes: 0 additions & 6 deletions source/preprocessor.tex
Original file line number Diff line number Diff line change
Expand Up @@ -1850,12 +1850,6 @@
the characters that are defined by ISO/IEC 10646, along with
all amendments and technical corrigenda as of the specified year and month.

\item
\indextext{__stdcpp_strict_pointer_safety__@\mname{STDCPP_STRICT_POINTER_SAFETY}}%
\mname{STDCPP_STRICT_POINTER_SAFETY}\\
Defined, and has the value integer literal 1, if and only if the implementation
has strict pointer safety\iref{basic.stc.dynamic.safety}.

\item
\indextext{__stdcpp_threads__@\mname{STDCPP_THREADS}}%
\mname{STDCPP_THREADS}\\
Expand Down
26 changes: 0 additions & 26 deletions source/support.tex
Original file line number Diff line number Diff line change
Expand Up @@ -2381,10 +2381,6 @@
which has not been invalidated by an intervening call to
\tcode{operator delete}.

\pnum
If an implementation has strict pointer safety\iref{basic.stc.dynamic.safety}
then \tcode{ptr} is a safely-derived pointer.

\pnum
If the \tcode{alignment} parameter is not present,
\tcode{ptr} was returned by an allocation function
Expand Down Expand Up @@ -2481,10 +2477,6 @@
which has not been invalidated by an intervening call to
\tcode{operator delete}.

\pnum
If an implementation has strict pointer safety\iref{basic.stc.dynamic.safety}
then \tcode{ptr} is a safely-derived pointer.

\pnum
If the \tcode{alignment} parameter is not present,
\tcode{ptr} was returned by an allocation function
Expand Down Expand Up @@ -2632,10 +2624,6 @@
which has not been invalidated by an intervening call to
\tcode{operator delete[]}.

\pnum
If an implementation has strict pointer safety\iref{basic.stc.dynamic.safety}
then \tcode{ptr} is a safely-derived pointer.

\pnum
If the \tcode{alignment} parameter is not present,
\tcode{ptr} was returned by an allocation function
Expand Down Expand Up @@ -2712,10 +2700,6 @@
which has not been invalidated by an intervening call to
\tcode{operator delete[]}.

\pnum
If an implementation has strict pointer safety\iref{basic.stc.dynamic.safety}
then \tcode{ptr} is a safely-derived pointer.

\pnum
If the \tcode{alignment} parameter is not present,
\tcode{ptr} was returned by an allocation function
Expand Down Expand Up @@ -2798,11 +2782,6 @@
\end{itemdecl}

\begin{itemdescr}
\pnum
\expects
If an implementation has strict pointer safety\iref{basic.stc.dynamic.safety}
then \tcode{ptr} is a safely-derived pointer.

\pnum
\effects
Intentionally performs no action.
Expand All @@ -2821,11 +2800,6 @@
\end{itemdecl}

\begin{itemdescr}
\pnum
\expects
If an implementation has strict pointer safety\iref{basic.stc.dynamic.safety}
then \tcode{ptr} is a safely-derived pointer.

\pnum
\effects
Intentionally performs no action.
Expand Down
Loading