Skip to content

Commit b081544

Browse files
jensmaurertkoeppe
authored andcommitted
P2334R1 Add support for preprocessing directives elifdef and elifndef
1 parent 59c54c7 commit b081544

File tree

1 file changed

+16
-11
lines changed

1 file changed

+16
-11
lines changed

source/preprocessor.tex

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,9 @@
8080

8181
\begin{bnf}\obeyspaces
8282
\nontermdef{elif-group}\br
83-
\terminal{\# elif } constant-expression new-line \opt{group}
83+
\terminal{\# elif } constant-expression new-line \opt{group}\br
84+
\terminal{\# elifdef } constant-expression new-line \opt{group}\br
85+
\terminal{\# elifndef} constant-expression new-line \opt{group}
8486
\end{bnf}
8587

8688
\begin{bnf}\obeyspaces
@@ -399,7 +401,9 @@
399401
\end{floattable}
400402

401403
\pnum
402-
The \tcode{\#ifdef} and \tcode{\#ifndef} directives, and
404+
The
405+
\tcode{\#ifdef}, \tcode{\#ifndef}, \tcode{\#elifdef}, and \tcode{\#elifndef}
406+
directives, and
403407
the \tcode{defined} conditional inclusion operator,
404408
shall treat \xname{has_include} and \xname{has_cpp_attribute}
405409
as if they were the names of defined macros.
@@ -491,20 +495,21 @@
491495
\pnum
492496
Preprocessing directives of the forms
493497
\begin{ncsimplebnf}\obeyspaces
494-
\terminal{\# ifdef } identifier new-line \opt{group}\br
498+
\terminal{\# ifdef } identifier new-line \opt{group}\br
495499
\indextext{\idxcode{\#ifdef}}%
496-
\terminal{\# ifndef } identifier new-line \opt{group}
500+
\terminal{\# ifndef } identifier new-line \opt{group}\br
497501
\indextext{\idxcode{\#ifndef}}%
502+
\terminal{\# elifdef } identifier new-line \opt{group}\br
503+
\indextext{\idxcode{\#elifdef}}%
504+
\terminal{\# elifndef} identifier new-line \opt{group}
505+
\indextext{\idxcode{\#elifndef}}%
498506
\end{ncsimplebnf}
499507
check whether the identifier is or is not currently defined as a macro name.
500508
Their conditions are equivalent to
501-
\tcode{\#if}
502-
\tcode{defined}
503-
\grammarterm{identifier}
504-
and
505-
\tcode{\#if}
506-
\tcode{!defined}
507-
\grammarterm{identifier}
509+
\tcode{\#if} \tcode{defined} \grammarterm{identifier},
510+
\tcode{\#if} \tcode{!defined} \grammarterm{identifier},
511+
\tcode{\#elif} \tcode{defined} \grammarterm{identifier}, and
512+
\tcode{\#elif} \tcode{!defined} \grammarterm{identifier},
508513
respectively.
509514

510515
\pnum

0 commit comments

Comments
 (0)