libstdc++: Replace assert with __glibcxx_assert to reduce overhead.
Replaces `assert` with `__glibcxx_assert` in libstdc++ to reduce runtime overhead in release builds.
This commit replaces instances of the standard C assert macro with the libstdc++-specific __glibcxx_assert macro in ryu and debug.cc. Unlike assert, __glibcxx_assert is disabled in release builds, which avoids unnecessary runtime checks and reduces binary size. To avoid modifying third-party headers, the patch redefines assert to __glibcxx_assert when including ryu headers.
In Details
The libstdc++ uses __glibcxx_assert which are guarded by _GLIBCXX_ASSERTIONS and enabled only in Debug builds. This commit replaces direct uses of assert in src/c++11/debug.cc and src/c++17/floating_to_chars.cc, including a redefinition of assert when including the ryu headers. This change avoids the introduction of __FILE__ into the final library and avoids unconditional assertion checking.
For Context
The C standard library provides the assert macro for debugging. Assertions check for conditions that should always be true, and halt the program if one fails. However, assert can add overhead to release builds, either by always being enabled, or by dragging in file-name information. This patch replaces the standard assert with a custom macro that can be completely disabled in release builds, avoiding any performance impact.