[libcxx-commits] [libcxx] [libc++] Fix ABI tag on __str_to_float_c_locale exported specialisations on MinGW (PR #229456)
via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Oct 7 21:57:16 PDT 2026
https://github.com/Himadhith updated https://github.com/llvm/llvm-project/pull/229456
>From 63000e0de9cdfade694b3f4c134e0ebe3c06e556 Mon Sep 17 00:00:00 2001
From: himadhith <himadhith.v at ibm.com>
Date: Tue, 6 Oct 2026 11:18:24 -0400
Subject: [PATCH 1/2] [libc++] Fix ABI tag on __str_to_float_c_locale exported
specialisations on MinGW
---
libcxx/include/__locale_dir/support/windows.h | 20 +++++++++++++------
1 file changed, 14 insertions(+), 6 deletions(-)
diff --git a/libcxx/include/__locale_dir/support/windows.h b/libcxx/include/__locale_dir/support/windows.h
index e4a030c72e701..2d264c8665571 100644
--- a/libcxx/include/__locale_dir/support/windows.h
+++ b/libcxx/include/__locale_dir/support/windows.h
@@ -175,32 +175,40 @@ _LIBCPP_EXPORTED_FROM_ABI const char* __get_locale_encoding(__locale_t __loc);
//
// the *_l functions are prefixed on Windows, only available for msvcr80+, VS2005+
+#if defined(_LIBCPP_MSVCRT)
template <class _FloatT>
_LIBCPP_HIDE_FROM_ABI _FloatT __str_to_float_c_locale(const char* __nptr, char** __endptr);
-#if defined(_LIBCPP_MSVCRT)
template <>
inline _LIBCPP_HIDE_FROM_ABI float __str_to_float_c_locale<float>(const char* __nptr, char** __endptr) {
return ::_strtof_l(__nptr, __endptr, __get_c_locale());
}
+template <>
+inline _LIBCPP_HIDE_FROM_ABI double __str_to_float_c_locale<double>(const char* __nptr, char** __endptr) {
+ return ::_strtod_l(__nptr, __endptr, __get_c_locale());
+}
+
template <>
inline _LIBCPP_HIDE_FROM_ABI long double __str_to_float_c_locale<long double>(const char* __nptr, char** __endptr) {
return ::_strtold_l(__nptr, __endptr, __get_c_locale());
}
#else
-template <>
-_LIBCPP_EXPORTED_FROM_ABI float __str_to_float_c_locale<float>(const char*, char**);
+template <class _FloatT>
+_FloatT __str_to_float_c_locale(const char* __nptr, char** __endptr);
template <>
-_LIBCPP_EXPORTED_FROM_ABI long double __str_to_float_c_locale<long double>(const char*, char**);
-#endif
+_LIBCPP_EXPORTED_FROM_ABI float __str_to_float_c_locale<float>(const char*, char**);
template <>
-inline _LIBCPP_HIDE_FROM_ABI double __str_to_float_c_locale<double>(const char* __nptr, char** __endptr) {
+_LIBCPP_HIDDEN inline double __str_to_float_c_locale<double>(const char* __nptr, char** __endptr) {
return ::_strtod_l(__nptr, __endptr, __get_c_locale());
}
+template <>
+_LIBCPP_EXPORTED_FROM_ABI long double __str_to_float_c_locale<long double>(const char*, char**);
+#endif
+
//
// Character manipulation functions
//
>From e8734033c320198f86d8ef2255750e7606b73a76 Mon Sep 17 00:00:00 2001
From: himadhith <himadhith.v at ibm.com>
Date: Thu, 8 Oct 2026 00:56:29 -0400
Subject: [PATCH 2/2] Add comments with concise explanations
---
libcxx/include/__locale_dir/support/windows.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/libcxx/include/__locale_dir/support/windows.h b/libcxx/include/__locale_dir/support/windows.h
index 2d264c8665571..2920fab3f8472 100644
--- a/libcxx/include/__locale_dir/support/windows.h
+++ b/libcxx/include/__locale_dir/support/windows.h
@@ -194,12 +194,14 @@ inline _LIBCPP_HIDE_FROM_ABI long double __str_to_float_c_locale<long double>(co
return ::_strtold_l(__nptr, __endptr, __get_c_locale());
}
#else
+// No _LIBCPP_HIDE_FROM_ABI as exported specialisations must not inherit abi_tag.
template <class _FloatT>
_FloatT __str_to_float_c_locale(const char* __nptr, char** __endptr);
template <>
_LIBCPP_EXPORTED_FROM_ABI float __str_to_float_c_locale<float>(const char*, char**);
+// _LIBCPP_HIDDEN not _LIBCPP_HIDE_FROM_ABI, can't add abi_tag when primary has none.
template <>
_LIBCPP_HIDDEN inline double __str_to_float_c_locale<double>(const char* __nptr, char** __endptr) {
return ::_strtod_l(__nptr, __endptr, __get_c_locale());
More information about the libcxx-commits
mailing list