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

Aaron Ballman via libcxx-commits libcxx-commits at lists.llvm.org
Wed Mar 6 08:35:24 PST 2024


AaronBallman wrote:

> I get the idea, but it doesn't work in practice. The (at least IMO) moral equivalents `-Werror=pedantic` or `-pedantic -Werror` don't change how `__has_extension` behaves, which means that the behaviour doesn't help you. It's only surprising that your code breaks when someone passes `-pedantic-errors`.

Sure, I think `-pedantic-errors`, `-pedantic -Werror`, and `-Werror=pedantic` should probably all be equivalent in terms of behavior because they're different ways of spelling the exact same thing. However, it's also worth noting, GCC has the same behavior as Clang: https://godbolt.org/z/57ExMncPh

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


More information about the libcxx-commits mailing list