[PATCH] D139266: Headers: tweak inclusion condition for stdatomic.h
Mark de Wever via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Dec 6 10:34:36 PST 2022
Mordante accepted this revision.
Mordante added a comment.
LGTM after addressing @aaron.ballman's comments.
================
Comment at: clang/lib/Headers/stdatomic.h:21
+#if __STDC_HOSTED__ && __has_include_next(<stdatomic.h>) \
+ && !(defined(_MSC_VER) && __cplusplus-0 < 202002l)
# include_next <stdatomic.h>
----------------
compnerd wrote:
> Mordante wrote:
> > Is `__cplusplus-0` intentional? If so please add some comments how this differs from `__cplusplus`.
> > Since this is a C header we should test whether the macro exists before querying its value.
> Yes, that is intentional. The `-0` is a trick! That avoids the need to check for the definition, because it will be evaluated to as the value of `__cplusplus` or be `0` due to the expansion to CPP rules and `-0`.
Ah yes of course. I really prefer the current version without the trick.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D139266/new/
https://reviews.llvm.org/D139266
More information about the cfe-commits
mailing list