Skip to content

Commit e38da22

Browse files
committed
P2334R1 Add support for preprocessing directives elifdef and elifndef
1 parent 2360a59 commit e38da22

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.
@@ -511,20 +515,21 @@
511515
\pnum
512516
Preprocessing directives of the forms
513517
\begin{ncsimplebnf}\obeyspaces
514-
\terminal{\# ifdef } identifier new-line \opt{group}\br
518+
\terminal{\# ifdef } identifier new-line \opt{group}\br
515519
\indextext{\idxcode{\#ifdef}}%
516-
\terminal{\# ifndef } identifier new-line \opt{group}
520+
\terminal{\# ifndef } identifier new-line \opt{group}\br
517521
\indextext{\idxcode{\#ifndef}}%
522+
\terminal{\# elifdef } identifier new-line \opt{group}\br
523+
\indextext{\idxcode{\#elifdef}}%
524+
\terminal{\# elifndef} identifier new-line \opt{group}
525+
\indextext{\idxcode{\#elifndef}}%
518526
\end{ncsimplebnf}
519527
check whether the identifier is or is not currently defined as a macro name.
520528
Their conditions are equivalent to
521-
\tcode{\#if}
522-
\tcode{defined}
523-
\grammarterm{identifier}
524-
and
525-
\tcode{\#if}
526-
\tcode{!defined}
527-
\grammarterm{identifier}
529+
\tcode{\#if} \tcode{defined} \grammarterm{identifier},
530+
\tcode{\#if} \tcode{!defined} \grammarterm{identifier},
531+
\tcode{\#elif} \tcode{defined} \grammarterm{identifier}, and
532+
\tcode{\#elif} \tcode{!defined} \grammarterm{identifier},
528533
respectively.
529534

530535
\pnum

0 commit comments

Comments
 (0)