-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[libc++] Use the __strtoNUM functions from __locale instead of the old API #118029
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…d API The commit where I switched from using the old locale base API to the new functions defined inside the __locale namespace forgot to update references to the strtoNUM functions. This patch fixes that.
|
@llvm/pr-subscribers-libcxx Author: Louis Dionne (ldionne) ChangesThe commit where I switched from using the old locale base API to the new functions defined inside the __locale namespace forgot to update references to the strtoNUM functions. This patch fixes that. Full diff: https://github.com/llvm/llvm-project/pull/118029.diff 1 Files Affected:
diff --git a/libcxx/include/locale b/libcxx/include/locale
index 65f5c6ba52f736..aa6733427d2d08 100644
--- a/libcxx/include/locale
+++ b/libcxx/include/locale
@@ -722,7 +722,7 @@ __num_get_signed_integral(const char* __a, const char* __a_end, ios_base::iostat
__libcpp_remove_reference_t<decltype(errno)> __save_errno = errno;
errno = 0;
char* __p2;
- long long __ll = strtoll_l(__a, &__p2, __base, _LIBCPP_GET_C_LOCALE);
+ long long __ll = __locale::__strtoll(__a, &__p2, __base, _LIBCPP_GET_C_LOCALE);
__libcpp_remove_reference_t<decltype(errno)> __current_errno = errno;
if (__current_errno == 0)
errno = __save_errno;
@@ -754,7 +754,7 @@ __num_get_unsigned_integral(const char* __a, const char* __a_end, ios_base::iost
__libcpp_remove_reference_t<decltype(errno)> __save_errno = errno;
errno = 0;
char* __p2;
- unsigned long long __ll = strtoull_l(__a, &__p2, __base, _LIBCPP_GET_C_LOCALE);
+ unsigned long long __ll = __locale::__strtoull(__a, &__p2, __base, _LIBCPP_GET_C_LOCALE);
__libcpp_remove_reference_t<decltype(errno)> __current_errno = errno;
if (__current_errno == 0)
errno = __save_errno;
@@ -779,17 +779,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 strtof_l(__a, __p2, _LIBCPP_GET_C_LOCALE);
+ return __locale::__strtof(__a, __p2, _LIBCPP_GET_C_LOCALE);
}
template <>
inline _LIBCPP_HIDE_FROM_ABI double __do_strtod<double>(const char* __a, char** __p2) {
- return strtod_l(__a, __p2, _LIBCPP_GET_C_LOCALE);
+ return __locale::__strtod(__a, __p2, _LIBCPP_GET_C_LOCALE);
}
template <>
inline _LIBCPP_HIDE_FROM_ABI long double __do_strtod<long double>(const char* __a, char** __p2) {
- return strtold_l(__a, __p2, _LIBCPP_GET_C_LOCALE);
+ return __locale::__strtold(__a, __p2, _LIBCPP_GET_C_LOCALE);
}
template <class _Tp>
|
philnik777
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
FYI these were the functions I think we should be able to replace with from_chars.
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/66/builds/6853 Here is the relevant piece of the build log for the reference |
The commit where I switched from using the old locale base API to the new functions defined inside the __locale namespace forgot to update references to the strtoNUM functions. This patch fixes that.