Libstdc++: Fix <optional> for freestanding [PR125450]
The <optional> header is modified to avoid defining range_format when building in a freestanding environment.
This commit fixes an issue in libstdc++ where the range_format functionality within the <optional> header caused problems in freestanding environments. By conditionally excluding the definition of range_format in such environments, this change ensures that <optional> can be used in environments where standard library features are limited.
In Details
<optional> provides a way to represent optional values. "Freestanding" environments, where only a minimal subset of the standard library is available, require conditional compilation to avoid dependencies on unavailable features.
For Context
The C++ standard library offers various tools and data structures. Freestanding environments are those where only a small part of the standard library is available, for example when building a bootloader or an operating system kernel. This commit ensures that the <optional> header can be used in such environments by avoiding dependencies on parts of the library not present there.