[PATCH] D143430: [C2x] Implement the `unreachable` macro for WG14 N2826
Erich Keane via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Feb 15 06:43:14 PST 2023
erichkeane accepted this revision.
erichkeane added inline comments.
This revision is now accepted and ready to land.
================
Comment at: clang/lib/Headers/stddef.h:108
+ __STDC_VERSION__ >= 202000L
+#define unreachable() __builtin_unreachable()
+#endif /* defined(__need_STDDEF_H_misc) && >= C23 */
----------------
aaron.ballman wrote:
> erichkeane wrote:
> > Is this REALLY required to be a macro by standard? Is it so they don't have to steal the word/can do #undef? This is going to result in a worse diagnostic here any time we diagnose on this line.
> Yes, it's required to be a macro by the C standard. According to my personal notes:
>
> This led us up to a preference poll, does WG14 prefer the syntax variant over the macro variant in N2826? 3/12/5 (no consensus). Does WG14 prefer to put the macro into <stddef.h> as in N2826 in C23? 11/2/7 (consensus). Does WG14 want to adopt the unreachable feature Change 5 & 6 with stddef.h in place of HEADER.h into C23? 13/2/6 (consensus).
>
> I don't think the diagnostic behavior here will be any different than for `offsetof` (defined a few lines below), right?
`offsetof` is what made me ask this question :D I guess we do the whole 'macro-like' escape in other places, but everything here is already crap, so I guess this is no different.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D143430/new/
https://reviews.llvm.org/D143430
More information about the cfe-commits
mailing list