https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125228
--- Comment #18 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Jonathan Wakely <[email protected]>: https://gcc.gnu.org/g:fe3c9c98bf52e1a01f903c3d685930019a57ce61 commit r17-553-gfe3c9c98bf52e1a01f903c3d685930019a57ce61 Author: Dragon Archer <[email protected]> Date: Fri May 8 18:16:15 2026 +0000 libstdc++: replace assert with __glibcxx_assert [PR125228] Unlike `__glibcxx_assert` which is guarded by `_GLIBCXX_ASSERTIONS` and enabled only in Debug build of libstdc++, `assert` is either always enabled, or always disabled if manually defining `NDEBUG` before `#include <cassert>` or `#include <assert.h>`. This not only makes `assert` inflexible, but also introduces extra runtime overhead and/or increased binary size in Release builds. Uses of `assert` without `NDEBUG` introduces `__FILE__` into the final library, and unconditionally checks the assertions. This patch replaces the uses of `assert` in ryu and debug.cc with `__glibcxx_assert`, and removed their direct dependency on `<cassert>`. To avoid modifying the third-party ryu headers, this patch redefines `assert` to `__glibcxx_assert` when including the ryu headers. libstdc++-v3/ChangeLog: PR libstdc++/125228 * src/c++11/debug.cc: Replace assert with __glibcxx_assert, and remove the include of <cassert>. * src/c++17/floating_to_chars.cc: Likewise, but redefine assert as __glibcxx_assert. Reviewed-by: Patrick Palka <[email protected]> Reviewed-by: Jonathan Wakely <[email protected]>
