Skip to content

Commit 8805a5e

Browse files
committed
[cpp.pragma.op] Colocate the two pragma specifications
1 parent 00e12be commit 8805a5e

File tree

1 file changed

+37
-37
lines changed

1 file changed

+37
-37
lines changed

source/preprocessor.tex

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -2161,6 +2161,43 @@
21612161
the resulting program to behave in a non-conforming manner.
21622162
Any pragma that is not recognized by the implementation is ignored.
21632163

2164+
\rSec1[cpp.pragma.op]{Pragma operator}%
2165+
\indextext{macro!pragma operator}%
2166+
\indextext{operator!pragma|see{macro, pragma operator}}
2167+
2168+
\pnum
2169+
A unary operator expression of the form:
2170+
\begin{ncbnf}
2171+
\terminal{_Pragma} \terminal{(} string-literal \terminal{)}
2172+
\end{ncbnf}
2173+
is processed as follows: The \grammarterm{string-literal} is \defnx{destringized}{destringization}
2174+
by deleting the \tcode{L} prefix, if present, deleting the leading and trailing
2175+
double-quotes, replacing each escape sequence \tcode{\textbackslash"} by a double-quote, and
2176+
replacing each escape sequence \tcode{\textbackslash\textbackslash} by a single
2177+
backslash. The resulting sequence of characters is processed through translation phase 3
2178+
to produce preprocessing tokens that are executed as if they were the
2179+
\grammarterm{pp-tokens} in a pragma directive. The original four preprocessing
2180+
tokens in the unary operator expression are removed.
2181+
2182+
\pnum
2183+
\begin{example}
2184+
\begin{codeblock}
2185+
#pragma listing on "..\listing.dir"
2186+
\end{codeblock}
2187+
can also be expressed as:
2188+
\begin{codeblock}
2189+
_Pragma ( "listing on \"..\\listing.dir\"" )
2190+
\end{codeblock}
2191+
The latter form is processed in the same way whether it appears literally
2192+
as shown, or results from macro replacement, as in:
2193+
\begin{codeblock}
2194+
#define LISTING(x) PRAGMA(listing on #x)
2195+
#define PRAGMA(x) _Pragma(#x)
2196+
2197+
LISTING( ..\listing.dir )
2198+
\end{codeblock}
2199+
\end{example}
2200+
21642201
\rSec1[cpp.null]{Null directive}%
21652202
\indextext{preprocessing directive!null}
21662203

@@ -2469,41 +2506,4 @@
24692506
Any other predefined macro names shall begin with a
24702507
leading underscore followed by an uppercase letter or a second
24712508
underscore.
2472-
2473-
\rSec1[cpp.pragma.op]{Pragma operator}%
2474-
\indextext{macro!pragma operator}%
2475-
\indextext{operator!pragma|see{macro, pragma operator}}
2476-
2477-
\pnum
2478-
A unary operator expression of the form:
2479-
\begin{ncbnf}
2480-
\terminal{_Pragma} \terminal{(} string-literal \terminal{)}
2481-
\end{ncbnf}
2482-
is processed as follows: The \grammarterm{string-literal} is \defnx{destringized}{destringization}
2483-
by deleting the \tcode{L} prefix, if present, deleting the leading and trailing
2484-
double-quotes, replacing each escape sequence \tcode{\textbackslash"} by a double-quote, and
2485-
replacing each escape sequence \tcode{\textbackslash\textbackslash} by a single
2486-
backslash. The resulting sequence of characters is processed through translation phase 3
2487-
to produce preprocessing tokens that are executed as if they were the
2488-
\grammarterm{pp-tokens} in a pragma directive. The original four preprocessing
2489-
tokens in the unary operator expression are removed.
2490-
2491-
\pnum
2492-
\begin{example}
2493-
\begin{codeblock}
2494-
#pragma listing on "..\listing.dir"
2495-
\end{codeblock}
2496-
can also be expressed as:
2497-
\begin{codeblock}
2498-
_Pragma ( "listing on \"..\\listing.dir\"" )
2499-
\end{codeblock}
2500-
The latter form is processed in the same way whether it appears literally
2501-
as shown, or results from macro replacement, as in:
2502-
\begin{codeblock}
2503-
#define LISTING(x) PRAGMA(listing on #x)
2504-
#define PRAGMA(x) _Pragma(#x)
2505-
2506-
LISTING( ..\listing.dir )
2507-
\end{codeblock}
2508-
\end{example}
25092509
\indextext{preprocessing directive|)}

0 commit comments

Comments
 (0)