[libcxx-commits] [libcxx] [libc++] Enable availability based on the compiler instead of __has_extension (PR #84065)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Thu Mar 7 10:35:07 PST 2024


ldionne wrote:

> I still think all of the various feature testing macros should behave the same way, but now I'm leaning towards making them all behave more like `__has_cpp_attribute` instead of more like the current `__has_extension` behavior. That said, I'm still worried about breaking changes because `__has_extension` has been around for a _long_ time, is documented to behave this way, and sees relatively heavy use. I think we'd have to find some way to warn users about the change in behavior, give a grace period for them to update their code (perhaps a fix-it or clang-tidy check could help?), and then later change behavior. I don't see that transition going quickly, either.

Yeah, I think that's fair. We could (and should) also try it out on large code bases -- I can certainly help doing that over here if someone provides a Clang patch.

I would like to still move forward with this libc++ change independently though, since it is correct and will fix this issue immediately, which is important for anyone using libc++ with `-pedantic-errors` and availability markup. Does that sound reasonable?


https://github.com/llvm/llvm-project/pull/84065


More information about the libcxx-commits mailing list