Skip to content

Commit dbf8971

Browse files
committed
Merge 2017-03 CWG Motion 9
2 parents e5be945 + d8686e7 commit dbf8971

File tree

3 files changed

+95
-24
lines changed

3 files changed

+95
-24
lines changed

source/strings.tex

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5858,6 +5858,11 @@
58585858
The functions \tcode{strerror} and \tcode{strtok} are not required to avoid data
58595859
races~(\ref{res.on.data.races}).
58605860

5861+
\pnum
5862+
\indextext{signal-safe!\idxcode{memcpy}}%
5863+
\indextext{signal-safe!\idxcode{memmove}}%
5864+
The functions \tcode{memcpy} and \tcode{memmove} are signal-safe~(\ref{csignal.syn}).
5865+
58615866
\pnum
58625867
\begin{note}
58635868
The functions

source/support.tex

Lines changed: 82 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -725,6 +725,10 @@
725725

726726
\rSec3[numeric.limits.members]{\tcode{numeric_limits} members}
727727

728+
\pnum
729+
\indextext{signal-safe!\idxcode{numeric_limits} members}%
730+
Each member function defined in this subclause is signal-safe~(\ref{csignal.syn}).
731+
728732
\indexlibrarymember{min}{numeric_limits}%
729733
\begin{itemdecl}
730734
static constexpr T min() noexcept;
@@ -1620,6 +1624,8 @@
16201624
The program is terminated without executing destructors for objects of automatic,
16211625
thread, or static storage duration and without calling functions passed to
16221626
\tcode{atexit()}~(\ref{basic.start.term}).
1627+
\indextext{signal-safe!\idxcode{_Exit}}%
1628+
The function \tcode{_Exit} is signal-safe~(\ref{csignal.syn}).
16231629
\end{itemdescr}
16241630

16251631
\indexlibrary{\idxcode{abort}}%
@@ -1638,8 +1644,8 @@
16381644
automatic, thread, or static storage
16391645
duration and without calling functions passed to
16401646
\tcode{atexit()}~(\ref{basic.start.term}).
1641-
%
1642-
\indexlibrary{\idxcode{atexit}}%
1647+
\indextext{signal-safe!\idxcode{abort}}%
1648+
The function \tcode{abort} is signal-safe~(\ref{csignal.syn}).
16431649
\end{itemdescr}
16441650

16451651
\indexlibrary{\idxcode{atexit}}%
@@ -1788,6 +1794,11 @@
17881794
The standard file buffers are not flushed.
17891795
\end{note}
17901796

1797+
\pnum
1798+
\remarks
1799+
\indextext{signal-safe!\idxcode{quick_exit}}%
1800+
The function \tcode{quick_exit} is signal-safe~(\ref{csignal.syn})
1801+
when the functions registered with \tcode{at_quick_exit} are.
17911802
\end{itemdescr}
17921803

17931804
\xref~\ref{basic.start}, \ref{basic.start.term},
@@ -3578,6 +3589,8 @@
35783589
\pnum
35793590
The header \tcode{<initializer_list>} defines a class template and several
35803591
support functions related to list-initialization~(see \ref{dcl.init.list}).
3592+
\indextext{signal-safe!\idxcode{initializer_list} functions}%
3593+
All functions specified in this subclause are signal-safe~(\ref{csignal.syn}).
35813594

35823595
\rSec2[initializer_list.syn]{Header \tcode{<initializer_list>} synopsis}
35833596
\indexlibrary{\idxcode{initializer_list}}%
@@ -3889,6 +3902,7 @@
38893902
namespace std {
38903903
using sig_atomic_t = @\seebelow@;
38913904

3905+
// \ref{support.signal}, signal handlers
38923906
extern "C" using @\placeholdernc{signal-handler}@ = void(int); // \expos
38933907
@\placeholder{signal-handler}@* signal(int sig, @\placeholder{signal-handler}@* func);
38943908

@@ -3912,32 +3926,76 @@
39123926
The contents of the header \tcode{<csignal>} are the same as the C
39133927
standard library header \tcode{<signal.h>}.
39143928

3929+
\rSec2[support.signal]{Signal handlers}
3930+
39153931
\pnum
39163932
A call to the function \tcode{signal} synchronizes with any resulting
39173933
invocation of the signal handler so installed.
39183934

39193935
\pnum
3920-
The common subset of the C and \Cpp languages consists of all declarations,
3921-
definitions, and expressions that may appear in a well formed \Cpp program
3922-
and also in a conforming C program.
3923-
A
3924-
\indextext{POF}%
3925-
\indextext{function!plain old}%
3926-
POF (``plain old function'') is a function that uses only features from
3927-
this common subset, and that does not directly or indirectly use any
3928-
function that is not a POF, except that it may use
3929-
plain lock-free atomic operations.
3930-
A \term{plain lock-free atomic operation} is an invocation of a function
3931-
\placeholder{f} from Clause~\ref{atomics}, such that \placeholder{f} is not a
3932-
member function, and either \placeholder{f} is the function
3933-
\tcode{atomic_is_lock_free}, or for every atomic argument \tcode{A} passed to
3934-
\placeholder{f}, \tcode{atomic_is_lock_free(A)} yields \tcode{true}.
3935-
All signal handlers shall have C linkage.
3936-
The behavior of any function other than a POF used as a signal handler in a
3937-
\Cpp program is \impldef{use of non-POF function as signal handler}.\footnote{In
3938-
particular, a signal handler using exception handling is very likely to
3939-
have problems. Also, invoking \tcode{std::exit} may cause destruction of objects,
3940-
including those of the standard library implementation, which, in general, yields
3941-
undefined behavior in a signal handler (see~\ref{intro.execution}).}
3936+
A \defn{plain lock-free atomic operation} is
3937+
an invocation of a function \tcode{f} from Clause~\ref{atomics},
3938+
such that:
3939+
3940+
\begin{itemize}
3941+
\item
3942+
\tcode{f} is the function \tcode{atomic_is_lock_free()}, or
3943+
3944+
\item
3945+
\tcode{f} is the member function \tcode{is_lock_free()}, or
3946+
3947+
\item
3948+
\tcode{f} is a non-static member function invoked on an object \tcode{A},
3949+
such that \tcode{A.is_lock_free()} yields \tcode{true}, or
3950+
3951+
\item
3952+
\tcode{f} is a non-member function, and
3953+
for every pointer-to-atomic argument \tcode{A} passed to \tcode{f},
3954+
\tcode{atomic_is_lock_free(A)} yields \tcode{true}.
3955+
\end{itemize}
3956+
3957+
\pnum
3958+
\indextext{signal-safe!evaluation|see{evaluation, signal-safe}}%
3959+
An evaluation is \defnx{signal-safe}{evaluation!signal-safe} unless it includes one of the following:
3960+
3961+
\begin{itemize}
3962+
\item
3963+
a call to any standard library function,
3964+
except for plain lock-free atomic operations and
3965+
functions explicitly identified as signal-safe.
3966+
\begin{note}
3967+
This implicitly excludes the use of \tcode{new} and \tcode{delete} expressions
3968+
that rely on a library-provided memory allocator.
3969+
\end{note}
3970+
3971+
\item
3972+
an access to an object with thread storage duration;
3973+
3974+
\item
3975+
a \tcode{dynamic_cast} expression;
3976+
3977+
\item
3978+
throwing of an exception;
3979+
3980+
\item
3981+
control entering a \grammarterm{try-block} or \grammarterm{function-try-block};
3982+
3983+
\item
3984+
initialization of a variable with static storage duration
3985+
requiring dynamic initialization~(\ref{basic.start.dynamic}, \ref{stmt.dcl})%
3986+
\footnote{Such initialization might occur because it is the first odr-use~(\ref{basic.def.odr}) of that variable.}; or
3987+
3988+
\item
3989+
waiting for the completion of the initialization of a variable with static storage duration~(\ref{stmt.dcl}).
3990+
\end{itemize}
3991+
3992+
A signal handler invocation has undefined behavior if it includes
3993+
an evaluation that is not signal-safe.
3994+
3995+
\pnum
3996+
\indextext{signal-safe!\idxcode{signal}}%
3997+
The function \tcode{signal} is signal-safe if it is invoked
3998+
with the first argument equal to the signal number
3999+
corresponding to the signal that caused the invocation of the handler.
39424000

39434001
\xref ISO C~7.14.

source/utilities.tex

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -415,6 +415,10 @@
415415
The library provides templated helper functions to simplify
416416
applying move semantics to an lvalue and to simplify the implementation
417417
of forwarding functions.
418+
\indextext{signal-safe!\idxcode{forward}}%
419+
\indextext{signal-safe!\idxcode{move}}%
420+
\indextext{signal-safe!\idxcode{move_if_noexcept}}%
421+
All functions specified in this subclause are signal-safe~(\ref{csignal.syn}).
418422

419423
\indexlibrary{\idxcode{forward}}%
420424
\begin{itemdecl}
@@ -15130,6 +15134,10 @@
1513015134
characteristics of types or of combinations of types to be inspected. The
1513115135
type transformations allow certain properties of types to be manipulated.
1513215136

15137+
\pnum
15138+
\indextext{signal-safe!type traits}%
15139+
All functions specified in this subclause are signal-safe~(\ref{csignal.syn}).
15140+
1513315141
\rSec2[meta.rqmts]{Requirements}
1513415142

1513515143
\pnum

0 commit comments

Comments
 (0)