Skip to content

Commit

Permalink
Merge 2021-10 LWG Motion 17
Browse files Browse the repository at this point in the history
P2340R1 Clarifying the status of the "C headers"
  • Loading branch information
tkoeppe committed Oct 20, 2021
2 parents a8669d8 + 347ea54 commit 682525f
Show file tree
Hide file tree
Showing 5 changed files with 232 additions and 195 deletions.
12 changes: 6 additions & 6 deletions source/compatibility.tex
Original file line number Diff line number Diff line change
Expand Up @@ -2166,7 +2166,7 @@
\effect
A valid ISO C expression utilizing the decrement operator on
a \tcode{bool} lvalue
(for instance, via the C typedef in \libdeprheaderref{stdbool.h})
(for instance, via the C typedef in \libheaderref{stdbool.h})
is ill-formed in \Cpp{}.

\diffref{expr.sizeof,expr.cast}
Expand Down Expand Up @@ -2794,7 +2794,7 @@
\pnum
For compatibility with the C standard library\indextext{library!C standard},
the \Cpp{} standard library provides the C headers enumerated
in~\ref{depr.c.headers}, but their use is deprecated in \Cpp{}.
in~\ref{support.c.headers}.

\pnum
There are no \Cpp{} headers for the C standard library's headers
Expand Down Expand Up @@ -2857,15 +2857,15 @@
\tcode{xor_eq}
are keywords in \Cpp{}\iref{lex.key},
and are not introduced as macros
by \libdeprheaderref{iso646.h}.
by \libheaderref{iso646.h}.

\rSec3[diff.header.stdalign.h]{Header \tcode{<stdalign.h>}}
\indexhdr{stdalign.h}%

\pnum
The token \tcode{alignas} is a keyword in \Cpp{}\iref{lex.key},
and is not introduced as a macro
by \libdeprheaderref{stdalign.h}.
by \libheaderref{stdalign.h}.

\rSec3[diff.header.stdbool.h]{Header \tcode{<stdbool.h>}}
\indexhdr{stdbool.h}%
Expand All @@ -2874,7 +2874,7 @@
The tokens \tcode{bool}, \tcode{true}, and \tcode{false}
are keywords in \Cpp{}\iref{lex.key},
and are not introduced as macros
by \libdeprheaderref{stdbool.h}.
by \libheaderref{stdbool.h}.

\rSec3[diff.null]{Macro \tcode{NULL}}

Expand Down Expand Up @@ -2927,7 +2927,7 @@
declares the names \tcode{nullptr_t}, \tcode{byte}, and \tcode{to_integer},
and the operators and operator templates in \iref{support.types.byteops},
in addition to the names declared in
\libheaderrefx{stddef.h}{depr.c.headers} in the C standard library.
\libheaderrefx{stddef.h}{support.c.headers} in the C standard library.

\rSec2[diff.mods.to.behavior]{Modifications to behavior}

Expand Down
185 changes: 0 additions & 185 deletions source/future.tex
Original file line number Diff line number Diff line change
Expand Up @@ -196,191 +196,6 @@
before the qualified name of a class or alias template
without a template argument list is deprecated.

\rSec1[depr.c.headers]{C headers}

\rSec2[depr.c.headers.general]{General}

\pnum
For compatibility with the
\indextext{library!C standard}%
C standard library, the \Cpp{} standard library provides
the \defnx{C headers}{headers!C library} shown in \tref{depr.c.headers}.

\begin{multicolfloattable}{C headers}{depr.c.headers}
{lllll}
\libheaderdef{assert.h} \\
\libheader{complex.h} \\
\libheaderdef{ctype.h} \\
\libheaderdef{errno.h} \\
\libheaderdef{fenv.h} \\
\libheaderdef{float.h} \\
\columnbreak
\libheaderdef{inttypes.h} \\
\libheader{iso646.h} \\
\libheaderdef{limits.h} \\
\libheaderdef{locale.h} \\
\libheaderdef{math.h} \\
\libheaderdef{setjmp.h} \\
\columnbreak
\libheaderdef{signal.h} \\
\libheader{stdalign.h} \\
\libheaderdef{stdarg.h} \\
\libheader{stdatomic.h} \\
\libheader{stdbool.h} \\
\libheaderdef{stddef.h} \\
\columnbreak
\libheaderdef{stdint.h} \\
\libheaderdef{stdio.h} \\
\libheaderdef{stdlib.h} \\
\libheaderdef{string.h} \\
\libheader{tgmath.h} \\
\libheaderdef{time.h} \\
\columnbreak
\libheaderdef{uchar.h} \\
\libheaderdef{wchar.h} \\
\libheaderdef{wctype.h} \\
\end{multicolfloattable}

\rSec2[depr.complex.h.syn]{Header \tcode{<complex.h>} synopsis}

\indexheader{complex.h}%
\begin{codeblock}
#include <complex>
\end{codeblock}

\pnum
The header \libheader{complex.h}
behaves as if it simply includes the header
\libheaderref{complex}.

\pnum
\begin{note}
Names introduced by \libheader{complex} in namespace \tcode{std}
are not placed into the global namespace scope by \libheader{complex.h}.
\end{note}

\rSec2[depr.iso646.h.syn]{Header \tcode{<iso646.h>} synopsis}

\indexheader{iso646.h}%
\pnum
The \Cpp{} header \libheader{iso646.h} is empty.
\begin{note}
\tcode{and},
\tcode{and_eq},
\tcode{bitand},
\tcode{bitor},
\tcode{compl},
\tcode{not_eq},
\tcode{not},
\tcode{or},
\tcode{or_eq},
\tcode{xor}, and
\tcode{xor_eq}
are keywords in \Cpp{}\iref{lex.key}.
\end{note}

\rSec2[depr.stdalign.h.syn]{Header \tcode{<stdalign.h>} synopsis}

\indexheader{stdalign.h}%
\indexlibraryglobal{__alignas_is_defined}%
\begin{codeblock}
#define @\xname{alignas_is_defined}@ 1
\end{codeblock}

\pnum
The contents of the \Cpp{} header \libheader{stdalign.h} are the same as the C
standard library header \libheader{stdalign.h}, with the following changes:
The header \libheader{stdalign.h} does not
define a macro named \tcode{alignas}.

\xrefc{7.15}

\rSec2[depr.stdbool.h.syn]{Header \tcode{<stdbool.h>} synopsis}

\indexheader{stdbool.h}%
\indexhdr{stdbool.h}%
\indexlibraryglobal{__bool_true_false_are_defined}%
\begin{codeblock}
#define @\xname{bool_true_false_are_defined}@ 1
\end{codeblock}

\pnum
The contents of the \Cpp{} header \libheader{stdbool.h} are the same as the C
standard library header \libheader{stdbool.h}, with the following changes:
The header \libheader{stdbool.h} does not
define macros named \tcode{bool}, \tcode{true}, or \tcode{false}.

\xrefc{7.18}

\rSec2[depr.tgmath.h.syn]{Header \tcode{<tgmath.h>} synopsis}

\indexheader{tgmath.h}%
\begin{codeblock}
#include <cmath>
#include <complex>
\end{codeblock}

\pnum
The header \libheader{tgmath.h}
behaves as if it simply includes the headers
\libheaderref{cmath} and
\libheaderref{complex}.

\pnum
\begin{note}
The overloads provided in C by type-generic macros
are already provided in \libheader{complex} and \libheader{cmath}
by ``sufficient'' additional overloads.
\end{note}

\pnum
\begin{note}
Names introduced by \libheader{cmath} or \libheader{complex}
in namespace \tcode{std}
are not placed into the global namespace scope by \libheader{tgmath.h}.
\end{note}

\rSec2[depr.c.headers.other]{Other C headers}

\pnum
Every C header
other than
\libdeprheaderref{complex.h},
\libdeprheaderref{iso646.h},
\libdeprheaderref{stdalign.h},\newline
\libheaderref{stdatomic.h},
\libdeprheaderref{stdbool.h}, and
\libdeprheaderref{tgmath.h},
each of
which has a name of the form
\indextext{header!C}%
\tcode{<\placeholder{name}.h>},
behaves as if each name placed in the standard library namespace by
the corresponding
\tcode{<c\placeholder{name}>}
header is placed within
the global namespace scope,
except for the functions described in \ref{sf.cmath},
the declaration of \tcode{std::byte}\iref{cstddef.syn}, and
the functions and function templates described in \ref{support.types.byteops}.
It is unspecified whether these names are first declared or defined within
namespace scope\iref{basic.scope.namespace} of the namespace
\tcode{std} and are then injected into the global namespace scope by
explicit \grammarterm{using-declaration}{s}\iref{namespace.udecl}.

\pnum
\begin{example}
The header \libheader{cstdlib} assuredly
provides its declarations and definitions within the namespace
\tcode{std}. It may also provide these names within the
global namespace.
The header \libheader{stdlib.h}
assuredly provides the same declarations and definitions within
the global namespace,
much as in the C Standard. It may also provide these names within
the namespace \tcode{std}.
\end{example}

\rSec1[depr.res.on.required]{Requires paragraph}

\pnum
Expand Down
8 changes: 4 additions & 4 deletions source/lib-intro.tex
Original file line number Diff line number Diff line change
Expand Up @@ -913,7 +913,7 @@
or namespaces nested within namespace
\tcode{std}.
\begin{footnote}
The C standard library headers\iref{depr.c.headers} also define
The C standard library headers\iref{support.c.headers} also define
names within the global namespace, while the \Cpp{} headers for C library
facilities\iref{headers} can also define names within the global namespace.
\end{footnote}
Expand Down Expand Up @@ -1150,7 +1150,7 @@
\end{footnote}

\pnum
\ref{depr.c.headers}, C standard library headers, describes the effects of using
\ref{support.c.headers}, C standard library headers, describes the effects of using
the \tcode{\placeholder{name}.h} (C header) form in a \Cpp{} program.
\begin{footnote}
The
Expand Down Expand Up @@ -1358,7 +1358,7 @@
\indextext{unit!translation}%
Each may be included more than once, with no effect different from
being included exactly once, except that the effect of including either
\libheaderref{cassert} or \libheaderrefx{assert.h}{depr.c.headers}
\libheaderref{cassert} or \libheaderrefx{assert.h}{support.c.headers}
depends each time on the lexically current definition of
\indextext{\idxcode{NDEBUG}}%
\indexlibraryglobal{NDEBUG}%
Expand Down Expand Up @@ -2898,7 +2898,7 @@
included after any other header that also defines it\iref{basic.def.odr}.

\pnum
The C standard library headers\iref{depr.c.headers}
The C standard library headers\iref{support.c.headers}
shall include only their corresponding \Cpp{} standard library header,
as described in~\ref{headers}.

Expand Down

0 comments on commit 682525f

Please sign in to comment.