Skip to content

Commit d1c81d5

Browse files
jensmaurertkoeppe
authored andcommitted
P2186R2 Removing Garbage Collection Support
Additional removals: - cross-reference in [conv.lval] - entry in [diff.cpp03.utilities] - [res.on.pointer.storage] Restrictions on storage of pointers
1 parent 35f6932 commit d1c81d5

File tree

8 files changed

+16
-332
lines changed

8 files changed

+16
-332
lines changed

source/basic.tex

Lines changed: 0 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -4009,103 +4009,6 @@
40094009
deallocation function shall deallocate the storage referenced by the
40104010
pointer, ending the duration of the region of storage.
40114011

4012-
\rSec4[basic.stc.dynamic.safety]{Safely-derived pointers}
4013-
4014-
\pnum
4015-
\indextext{pointer!safely-derived|(}%
4016-
\indextext{pointer!to traceable object}%
4017-
A \defn{traceable pointer object} is
4018-
\begin{itemize}
4019-
\item an object of an object pointer
4020-
type\iref{basic.compound}, or
4021-
\item an object of an integral type that is at least as large as \tcode{std::intptr_t},
4022-
or
4023-
\item a sequence of elements in an array of narrow character
4024-
type\iref{basic.fundamental}, where the size and alignment of the sequence
4025-
match those of some object pointer type.
4026-
\end{itemize}
4027-
4028-
\pnum
4029-
A pointer value is a \defnadj{safely-derived}{pointer} to an object with dynamic storage duration
4030-
only if the pointer value has an object pointer type
4031-
and is one of the following:
4032-
\begin{itemize}
4033-
\item the value returned by a call to the \Cpp{} standard library implementation of
4034-
\tcode{::\keyword{operator} \keyword{new}(std::\brk{}size_t)} or
4035-
\tcode{::\keyword{operator} \keyword{new}(std::size_t, std::align_val_t)}%
4036-
;%
4037-
\begin{footnote}
4038-
This subclause does not impose restrictions
4039-
on indirection through pointers to memory not allocated by \tcode{::\keyword{operator} \keyword{new}}. This
4040-
maintains the ability of many \Cpp{} implementations to use binary libraries and
4041-
components written in other languages. In particular, this applies to C binaries,
4042-
because indirection through pointers to memory allocated by \tcode{std::malloc} is not restricted.
4043-
\end{footnote}
4044-
4045-
\item the result of taking the address of an object (or one of its
4046-
subobjects) designated by an lvalue resulting from indirection
4047-
through a safely-derived pointer value;
4048-
4049-
\item the result of well-defined pointer arithmetic\iref{expr.add} using a safely-derived pointer
4050-
value;
4051-
4052-
\item the result of a well-defined pointer
4053-
conversion~(\ref{conv.ptr}, \ref{expr.type.conv}, \ref{expr.static.cast},
4054-
\ref{expr.cast}) of a safely-derived pointer value;
4055-
4056-
\item the result of a \keyword{reinterpret_cast} of a safely-derived pointer value;
4057-
4058-
\item the result of a \keyword{reinterpret_cast} of an integer representation of a
4059-
safely-derived pointer value;
4060-
4061-
\item the value of an object whose value was copied from a traceable pointer object,
4062-
where at the time of the copy the source object contained a copy of a safely-derived
4063-
pointer value.
4064-
\end{itemize}
4065-
4066-
\pnum
4067-
\indextext{integer representation}%
4068-
\indextext{pointer!integer representation of safely-derived}%
4069-
An integer value is an \defnx{integer representation of a safely-derived pointer}{safely-derived pointer!integer representation}
4070-
only if its type is at least as large as \tcode{std::intptr_t} and it is one of the
4071-
following:
4072-
\begin{itemize}
4073-
\item the result of a \keyword{reinterpret_cast} of a safely-derived pointer value;
4074-
4075-
\item the result of a valid conversion of an integer representation of a safely-derived
4076-
pointer value;
4077-
4078-
\item the value of an object whose value was copied from a traceable pointer object,
4079-
where at the time of the copy the source object contained an integer representation of a
4080-
safely-derived pointer value;
4081-
4082-
\item the result of an additive or bitwise operation, one of whose operands is an
4083-
integer representation of a safely-derived pointer value \tcode{P}, if that result
4084-
converted by \tcode{reinterpret_cast<void*>} would compare equal to a safely-derived
4085-
pointer computable from \tcode{\keyword{reinterpret_cast}<\keyword{void}*>(P)}.
4086-
\end{itemize}
4087-
4088-
\pnum
4089-
An implementation may have \defn{relaxed pointer safety}, in which case the
4090-
validity of a pointer value does not depend on whether it is a safely-derived
4091-
pointer value. Alternatively, an implementation may have \defn{strict pointer
4092-
safety}, in which case a pointer value referring to an object with dynamic
4093-
storage duration that is not a safely-derived pointer
4094-
value is an invalid pointer value unless
4095-
the referenced complete object has previously been declared
4096-
reachable\iref{util.dynamic.safety}.
4097-
\begin{note}
4098-
The effect of using an invalid pointer value (including passing it to a
4099-
deallocation function) is undefined, see~\ref{basic.stc}.
4100-
This is true even if the unsafely-derived pointer value would compare equal to
4101-
some safely-derived pointer value.
4102-
\end{note}
4103-
It is
4104-
\impldef{whether an implementation has relaxed or strict pointer
4105-
safety} whether an implementation has relaxed or strict pointer safety.%
4106-
\indextext{pointer!safely-derived|)}%
4107-
\indextext{storage duration!dynamic|)}
4108-
41094012
\rSec3[basic.stc.inherit]{Duration of subobjects}
41104013

41114014
\pnum

source/compatibility.tex

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1556,16 +1556,6 @@
15561556

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

1559-
\diffref{util.dynamic.safety}
1560-
\change
1561-
Minimal support for garbage-collected regions.
1562-
\rationale
1563-
Required by new feature.
1564-
\effect
1565-
Valid \CppIII{} code, compiled without traceable pointer support,
1566-
that interacts with newer \Cpp{} code using regions declared reachable may
1567-
have different runtime behavior.
1568-
15691559
\diffref{refwrap,arithmetic.operations,comparisons,logical.operations,bitwise.operations}
15701560
\change
15711561
Standard function object types no longer derived from

source/expressions.tex

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -662,8 +662,7 @@
662662
the glvalue.
663663

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

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

40184013
\pnum
40194014
\indextext{cast!reinterpret!pointer-to-function}%

source/lib-intro.tex

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2364,6 +2364,9 @@
23642364
\item \indexlibraryzombie{const_mem_fun1_t} \tcode{const_mem_fun1_t},
23652365
\item \indexlibraryzombie{const_mem_fun_ref_t} \tcode{const_mem_fun_ref_t},
23662366
\item \indexlibraryzombie{const_mem_fun_t} \tcode{const_mem_fun_t},
2367+
\item \indexlibraryzombie{declare_no_pointers} \tcode{declare_no_pointers},
2368+
\item \indexlibraryzombie{declare_reachable} \tcode{declare_reachable},
2369+
\item \indexlibraryzombie{get_pointer_safety} \tcode{get_pointer_safety},
23672370
\item \indexlibraryzombie{get_temporary_buffer} \tcode{get_temporary_buffer},
23682371
\item \indexlibraryzombie{get_unexpected} \tcode{get_unexpected},
23692372
\item \indexlibraryzombie{gets} \tcode{gets},
@@ -2377,6 +2380,7 @@
23772380
\item \indexlibraryzombie{mem_fun} \tcode{mem_fun},
23782381
\item \indexlibraryzombie{not1} \tcode{not1},
23792382
\item \indexlibraryzombie{not2} \tcode{not2},
2383+
\item \indexlibraryzombie{pointer_safety} \tcode{pointer_safety},
23802384
\item \indexlibraryzombie{pointer_to_binary_function} \tcode{pointer_to_binary_function},
23812385
\item \indexlibraryzombie{pointer_to_unary_function} \tcode{pointer_to_unary_function},
23822386
\item \indexlibraryzombie{ptr_fun} \tcode{ptr_fun},
@@ -2389,22 +2393,25 @@
23892393
\item \indexlibraryzombie{unary_function} \tcode{unary_function},
23902394
\item \indexlibraryzombie{unary_negate} \tcode{unary_negate},
23912395
\item \indexlibraryzombie{uncaught_exception} \tcode{uncaught_exception},
2396+
\item \indexlibraryzombie{undeclare_no_pointers} \tcode{undeclare_no_pointers},
2397+
\item \indexlibraryzombie{undeclare_reachable} \tcode{undeclare_reachable},
23922398
\item \indexlibraryzombie{unexpected} \tcode{unexpected},
23932399
and
23942400
\item \indexlibraryzombie{unexpected_handler} \tcode{unexpected_handler}.
23952401
\end{itemize}
23962402

23972403
\pnum
2398-
The following names are reserved as member types for previous standardization,
2404+
The following names are reserved as members for previous standardization,
23992405
and may not be used as a name for object-like macros in portable code:
24002406
\begin{itemize}
24012407
\item \indexlibraryzombie{argument_type} \tcode{argument_type},
24022408
\item \indexlibraryzombie{first_argument_type} \tcode{first_argument_type},
24032409
\item \indexlibraryzombie{io_state} \tcode{io_state},
24042410
\item \indexlibraryzombie{open_mode} \tcode{open_mode},
2411+
\item \indexlibraryzombie{preferred} \tcode{preferred},
24052412
\item \indexlibraryzombie{second_argument_type} \tcode{second_argument_type},
2406-
and
2407-
\item \indexlibraryzombie{seek_dir} \tcode{seek_dir}.
2413+
\item \indexlibraryzombie{seek_dir} \tcode{seek_dir}, and.
2414+
\item \indexlibraryzombie{strict} \tcode{strict}.
24082415
\end{itemize}
24092416

24102417
\pnum
@@ -3135,15 +3142,6 @@
31353142
for a non-virtual function
31363143
by adding a non-throwing exception specification.
31373144

3138-
\rSec3[res.on.pointer.storage]{Restrictions on storage of pointers}
3139-
3140-
\pnum
3141-
\indextext{traceable pointer object}%
3142-
\indextext{pointer!to traceable object}%
3143-
Objects constructed by the standard library that may hold a user-supplied pointer value
3144-
or an integer of type \tcode{std::intptr_t} shall store such values in a traceable
3145-
pointer location\iref{basic.stc.dynamic.safety}.
3146-
31473145
\rSec3[value.error.codes]{Value of error codes}
31483146

31493147
\pnum

source/preprocessor.tex

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1850,12 +1850,6 @@
18501850
the characters that are defined by ISO/IEC 10646, along with
18511851
all amendments and technical corrigenda as of the specified year and month.
18521852

1853-
\item
1854-
\indextext{__stdcpp_strict_pointer_safety__@\mname{STDCPP_STRICT_POINTER_SAFETY}}%
1855-
\mname{STDCPP_STRICT_POINTER_SAFETY}\\
1856-
Defined, and has the value integer literal 1, if and only if the implementation
1857-
has strict pointer safety\iref{basic.stc.dynamic.safety}.
1858-
18591853
\item
18601854
\indextext{__stdcpp_threads__@\mname{STDCPP_THREADS}}%
18611855
\mname{STDCPP_THREADS}\\

source/support.tex

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2381,10 +2381,6 @@
23812381
which has not been invalidated by an intervening call to
23822382
\tcode{operator delete}.
23832383

2384-
\pnum
2385-
If an implementation has strict pointer safety\iref{basic.stc.dynamic.safety}
2386-
then \tcode{ptr} is a safely-derived pointer.
2387-
23882384
\pnum
23892385
If the \tcode{alignment} parameter is not present,
23902386
\tcode{ptr} was returned by an allocation function
@@ -2481,10 +2477,6 @@
24812477
which has not been invalidated by an intervening call to
24822478
\tcode{operator delete}.
24832479

2484-
\pnum
2485-
If an implementation has strict pointer safety\iref{basic.stc.dynamic.safety}
2486-
then \tcode{ptr} is a safely-derived pointer.
2487-
24882480
\pnum
24892481
If the \tcode{alignment} parameter is not present,
24902482
\tcode{ptr} was returned by an allocation function
@@ -2632,10 +2624,6 @@
26322624
which has not been invalidated by an intervening call to
26332625
\tcode{operator delete[]}.
26342626

2635-
\pnum
2636-
If an implementation has strict pointer safety\iref{basic.stc.dynamic.safety}
2637-
then \tcode{ptr} is a safely-derived pointer.
2638-
26392627
\pnum
26402628
If the \tcode{alignment} parameter is not present,
26412629
\tcode{ptr} was returned by an allocation function
@@ -2712,10 +2700,6 @@
27122700
which has not been invalidated by an intervening call to
27132701
\tcode{operator delete[]}.
27142702

2715-
\pnum
2716-
If an implementation has strict pointer safety\iref{basic.stc.dynamic.safety}
2717-
then \tcode{ptr} is a safely-derived pointer.
2718-
27192703
\pnum
27202704
If the \tcode{alignment} parameter is not present,
27212705
\tcode{ptr} was returned by an allocation function
@@ -2798,11 +2782,6 @@
27982782
\end{itemdecl}
27992783

28002784
\begin{itemdescr}
2801-
\pnum
2802-
\expects
2803-
If an implementation has strict pointer safety\iref{basic.stc.dynamic.safety}
2804-
then \tcode{ptr} is a safely-derived pointer.
2805-
28062785
\pnum
28072786
\effects
28082787
Intentionally performs no action.
@@ -2821,11 +2800,6 @@
28212800
\end{itemdecl}
28222801

28232802
\begin{itemdescr}
2824-
\pnum
2825-
\expects
2826-
If an implementation has strict pointer safety\iref{basic.stc.dynamic.safety}
2827-
then \tcode{ptr} is a safely-derived pointer.
2828-
28292803
\pnum
28302804
\effects
28312805
Intentionally performs no action.

0 commit comments

Comments
 (0)