[libcxx-commits] [libcxx] [libcxx][locale] Refactor strtonum functions using __str_to_float_c_locale<FloatT> (PR #222081)
via libcxx-commits
libcxx-commits at lists.llvm.org
Sun Sep 20 02:43:55 PDT 2026
================
@@ -307,17 +307,17 @@ _LIBCPP_HIDE_FROM_ABI _Tp __do_strtod(const char* __a, char** __p2);
template <>
inline _LIBCPP_HIDE_FROM_ABI float __do_strtod<float>(const char* __a, char** __p2) {
- return __locale::__strtof(__a, __p2, _LIBCPP_GET_C_LOCALE);
+ return __locale::__str_to_float_c_locale<float>(__a, __p2, _LIBCPP_GET_C_LOCALE);
----------------
Himadhith wrote:
I tried to remove it and was instantly hit with this.
```
/home/himadhit/llvm/community/llvm-project/build/aix/include/c++/v1/__locale_dir/support/aix.h:105:28: error: use of undeclared identifier '__get_c_locale'
105 | __locale_guard __current(__get_c_locale());
```
To fix this we can either use inline `__locale_t __get_c_locale();` or we split the namespace right before strToNum functions as:
```
#endif // _LIBCPP_BUILDING_LIBRARY
} // namespace __locale
_LIBCPP_END_NAMESPACE_STD
#include <__locale_dir/support/default/get_c_locale.h>
//
// Strtonum functions
//
_LIBCPP_BEGIN_NAMESPACE_STD
namespace __locale {
template <class _FloatT>
```
https://github.com/llvm/llvm-project/pull/222081
More information about the libcxx-commits
mailing list