[clang] [C2y] Implement WG14 N3369 and N3469 (_Countof) (PR #133125)
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Thu Mar 27 05:20:16 PDT 2025
AaronBallman wrote:
> > There is weak consensus to add `stdcountof.h` which supplies a `countof` macro. However, there's no changes to the standard which add one (yet), so I figured that can be done in a follow-up.
>
> Then I'd really like a feature. We already have a bunch, It makes sense to add one for that imo
>
> ```
> include/clang/Basic/Features.def:FEATURE(c_alignas, LangOpts.C11)
> include/clang/Basic/Features.def:FEATURE(c_alignof, LangOpts.C11)
> include/clang/Basic/Features.def:FEATURE(c_atomic, LangOpts.C11)
> include/clang/Basic/Features.def:FEATURE(c_generic_selections, LangOpts.C11)
> include/clang/Basic/Features.def:FEATURE(c_static_assert, LangOpts.C11)
> include/clang/Basic/Features.def:FEATURE(c_thread_local, LangOpts.C11 &&PP.getTargetInfo().isTLSSupported())
> include/clang/Basic/Features.def:FEATURE(c_fixed_enum, LangOpts.C23)
> ```
So you want this to be a `FEATURE` in C2y and an `EXTENSION` in older language modes? And when we get the `countof` macro in a few months, this becomes unnecessary?
https://github.com/llvm/llvm-project/pull/133125
More information about the cfe-commits
mailing list