)]}'
{
  "commit": "2fe59d5259ec921668d87d111be55db0b047aa68",
  "tree": "695fbe2275dc754388a11a35f1a4d81e7eec0457",
  "parents": [
    "a07aba5d44204a7ca0d891a3da05af9960081e4c"
  ],
  "author": {
    "name": "Robin Caloudis",
    "email": "robin.caloudis@gmx.de",
    "time": "Fri Aug 16 17:18:49 2024 +0200"
  },
  "committer": {
    "name": "GitHub",
    "email": "noreply@github.com",
    "time": "Fri Aug 16 11:18:49 2024 -0400"
  },
  "message": "[libc++][math] Fix acceptance of convertible types in `std::isnan()` and `std::isinf()` (#98952)\n\nFollowing up on https://github.com/llvm/llvm-project/pull/98841.\r\n\r\nChanges:\r\n- Properly test convertible types for `std::isnan()` and `std::inf()`\r\n- Tighten conditional in `cmath.pass.cpp` (Find insights on `_LIBCPP_PREFERRED_OVERLOAD` below)\r\n- Tighten preprocessor guard in `traits.h`\r\n\r\nInsights into why `_LIBCPP_PREFERRED_OVERLOAD` is needed:\r\n\r\n(i) When libc++ is layered on top of glibc on Linux, glibc\u0027s `math.h` is\r\n    included. When compiling with `-std\u003dc++03`, this header brings the\r\n    function declaration of `isinf(double)` [1] and `isnan(double)` [2]\r\n    into scope. This differs from the C99 Standard as only the macros\r\n    `#define isnan(arg)` and `#define isinf(arg)` are expected.\r\n\r\n    Therefore, libc++ needs to respect the presense of the `double` overload\r\n    and cannot redefine it as it will conflict with the declaration already\r\n    in scope. For `-std\u003dc++11` and beyond this issue is fixed, as glibc\r\n    guards both the `isinf` and `isnan` by preprocessor macros.\r\n\r\n(ii) When libc++ is layered on top of Bionic\u0027s libc, `math.h` exposes a\r\n     function prototype for `isinf(double)` with return type `int`. This\r\n     function prototype in Bionic\u0027s libc is not guarded by any preprocessor\r\n     macros [3].\r\n\r\n`_LIBCPP_PREFERRED_OVERLOAD` specifies that a given overload is a better match\r\nthan an otherwise equally good function declaration. This is implemented in\r\nmodern versions of Clang via `__attribute__((__enable_if__))`, and not elsewhere.\r\nSee [4] for details. We use `_LIBCPP_PREFERRED_OVERLOAD` to define overloads in\r\nthe global namespace that displace the overloads provided by the C\r\nlibraries mentioned above.\r\n\r\n[1]: https://github.com/bminor/glibc/blob/fe9408087583fd7a6f61bb0dbcf2fd4e83186afa/math/bits/mathcalls.h#L185-L194\r\n[2]: https://github.com/bminor/glibc/blob/fe9408087583fd7a6f61bb0dbcf2fd4e83186afa/math/bits/mathcalls.h#L222-L231\r\n[3]: https://cs.android.com/android/platform/superproject/+/master:bionic/libc/include/math.h;l\u003d322-323;drc\u003dmaster?hl\u003dfr-BE%22https:%2F%2Fsupport.google.com%2Fmerchants%2Fanswer%2F188494%5C%22%22https:%2F%2Fsupport.google.com%2Fmerchants%2Fanswer%2F188494%5C%22\r\n[4]: https://github.com/llvm/llvm-project/commit/5fd17ab1b093f6b59aabb27f6c2c2278e65c2707\r\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "27ec52ecef022e9a8cc81788b323034ce51a1a8d",
      "old_mode": 33188,
      "old_path": "libcxx/include/__math/traits.h",
      "new_id": "35c283cc9e21cef71af4be11dc47fe8132836959",
      "new_mode": 33188,
      "new_path": "libcxx/include/__math/traits.h"
    },
    {
      "type": "modify",
      "old_id": "6028aa5a21103428901b8e47247a7a98c4b7fac5",
      "old_mode": 33188,
      "old_path": "libcxx/test/std/numerics/c.math/cmath.pass.cpp",
      "new_id": "34c30fb998f474606b59f9199cc6dd9bd52b3ab2",
      "new_mode": 33188,
      "new_path": "libcxx/test/std/numerics/c.math/cmath.pass.cpp"
    },
    {
      "type": "modify",
      "old_id": "e935b53187fe6ce109d9f3e3c4a02b1b89264d1e",
      "old_mode": 33188,
      "old_path": "libcxx/test/std/numerics/c.math/isinf.pass.cpp",
      "new_id": "e5169e8056c2ea1b66e9fcd740b2df4d9bcae906",
      "new_mode": 33188,
      "new_path": "libcxx/test/std/numerics/c.math/isinf.pass.cpp"
    },
    {
      "type": "modify",
      "old_id": "fffb12464586292edcab803c0fa0f3e322e1cac1",
      "old_mode": 33188,
      "old_path": "libcxx/test/std/numerics/c.math/isnan.pass.cpp",
      "new_id": "e4ccab1243e5678271196a05669f8864532b6f7f",
      "new_mode": 33188,
      "new_path": "libcxx/test/std/numerics/c.math/isnan.pass.cpp"
    }
  ]
}
