[libcxx-commits] [PATCH] D143033: [libc++] Disable some tests in `math_nodiscard_extensions`.

Konstantin Varlamov via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Jan 31 23:12:51 PST 2023


var-const added a comment.

In D143033#4095259 <https://reviews.llvm.org/D143033#4095259>, @philnik wrote:

> It's not exactly documentation, but you can look at `clang/include/clang/Basic/Builtins.def` to see what attributes are applied to builtins and what builtins there are.

Thanks. If I'm reading this correctly, though, this applies to `__builtin_foo` functions only, right? If that's the case, it's not what I'm concerned about. A platform could define e.g. `double fabs(double)` that would override our implementation (by design). Clang will create `__builtin_fabs` and mark it as `const`, but it won't change the platform's definition of `fabs` (I presume -- but if it did, it seems there would be no need for us to add the attribute in the first place). But since the platform's `fabs` overrides our `fabs`, it doesn't necessarily delegate to `__builtin_fabs`, and in any case, we don't control its definition.

Taking a step back, I also don't think we should be testing compiler behavior or relying on what is essentially an implementation detail of Clang and presumably GCC.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D143033/new/

https://reviews.llvm.org/D143033



More information about the libcxx-commits mailing list