[PATCH] D101192: Add support for #elifdef and #elifndef
Richard Smith - zygoloid via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Oct 21 11:40:29 PDT 2021
rsmith added a comment.
> In this version of the patch, I am supporting the feature in all C and C++ modes. This seems like more useful functionality than diagnosing an unknown preprocessor directive in older language modes, and is a conforming extension in those modes anyway as use of an unknown directive is undefined behavior.
Is this really true? I think:
#define X
#if 0
#elifdef X
#error
#endif
... is a valid translation unit in C++ and is strictly conforming in C11 and earlier; any //conditionally-supported-directive// (using the C++ terminology) within a //group// is ignored when skipping that //group//.
That said... applying this to all language modes does seem like the right choice, even though it may be technically non-conforming.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D101192/new/
https://reviews.llvm.org/D101192
More information about the cfe-commits
mailing list