Skip to content

P2334R1 Add support for preprocessing directives elifdef and elifndef #4992

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 15, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 16 additions & 11 deletions source/preprocessor.tex
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,9 @@

\begin{bnf}\obeyspaces
\nontermdef{elif-group}\br
\terminal{\# elif } constant-expression new-line \opt{group}
\terminal{\# elif } constant-expression new-line \opt{group}\br
\terminal{\# elifdef } constant-expression new-line \opt{group}\br
\terminal{\# elifndef} constant-expression new-line \opt{group}
\end{bnf}

\begin{bnf}\obeyspaces
Expand Down Expand Up @@ -399,7 +401,9 @@
\end{floattable}

\pnum
The \tcode{\#ifdef} and \tcode{\#ifndef} directives, and
The
\tcode{\#ifdef}, \tcode{\#ifndef}, \tcode{\#elifdef}, and \tcode{\#elifndef}
directives, and
the \tcode{defined} conditional inclusion operator,
shall treat \xname{has_include} and \xname{has_cpp_attribute}
as if they were the names of defined macros.
Expand Down Expand Up @@ -491,20 +495,21 @@
\pnum
Preprocessing directives of the forms
\begin{ncsimplebnf}\obeyspaces
\terminal{\# ifdef } identifier new-line \opt{group}\br
\terminal{\# ifdef } identifier new-line \opt{group}\br
\indextext{\idxcode{\#ifdef}}%
\terminal{\# ifndef } identifier new-line \opt{group}
\terminal{\# ifndef } identifier new-line \opt{group}\br
\indextext{\idxcode{\#ifndef}}%
\terminal{\# elifdef } identifier new-line \opt{group}\br
\indextext{\idxcode{\#elifdef}}%
\terminal{\# elifndef} identifier new-line \opt{group}
\indextext{\idxcode{\#elifndef}}%
\end{ncsimplebnf}
check whether the identifier is or is not currently defined as a macro name.
Their conditions are equivalent to
\tcode{\#if}
\tcode{defined}
\grammarterm{identifier}
and
\tcode{\#if}
\tcode{!defined}
\grammarterm{identifier}
\tcode{\#if} \tcode{defined} \grammarterm{identifier},
\tcode{\#if} \tcode{!defined} \grammarterm{identifier},
\tcode{\#elif} \tcode{defined} \grammarterm{identifier}, and
\tcode{\#elif} \tcode{!defined} \grammarterm{identifier},
respectively.

\pnum
Expand Down