[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
Fri Sep 11 03:15:19 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:

Yes, that's the goal — but _LIBCPP_GET_C_LOCALE is defined in get_c_locale.h, which itself pulls in locale_base_api.h (and through it, the platform headers). So when a platform header tries to use _LIBCPP_GET_C_LOCALE directly instead of taking it as an argument, it isn't visible yet at that point. This will need some restructuring if we want to remove the locale argument.

https://github.com/llvm/llvm-project/pull/222081


More information about the libcxx-commits mailing list