Skip to content

Commit 39c6c8b

Browse files
[libc++] Fix the locale base API on Linux with musl (#128936)
Since `363bfd6090b0 ([libc++] Use the new locale base API on Linux (#128007), 2025-02-24)`, musl targets will fail to build with errors due to missing strtoll_l functions. Co-authored-by: Pirama Arumuga Nainar <[email protected]>
1 parent 0b5bb12 commit 39c6c8b

File tree

1 file changed

+10
-0
lines changed
  • libcxx/include/__locale_dir/support

1 file changed

+10
-0
lines changed

libcxx/include/__locale_dir/support/linux.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,12 +95,22 @@ inline _LIBCPP_HIDE_FROM_ABI long double __strtold(const char* __nptr, char** __
9595
}
9696

9797
inline _LIBCPP_HIDE_FROM_ABI long long __strtoll(const char* __nptr, char** __endptr, int __base, __locale_t __loc) {
98+
#if !_LIBCPP_HAS_MUSL_LIBC
9899
return ::strtoll_l(__nptr, __endptr, __base, __loc);
100+
#else
101+
(void)__loc;
102+
return ::strtoll(__nptr, __endptr, __base);
103+
#endif
99104
}
100105

101106
inline _LIBCPP_HIDE_FROM_ABI unsigned long long
102107
__strtoull(const char* __nptr, char** __endptr, int __base, __locale_t __loc) {
108+
#if !_LIBCPP_HAS_MUSL_LIBC
103109
return ::strtoull_l(__nptr, __endptr, __base, __loc);
110+
#else
111+
(void)__loc;
112+
return ::strtoull(__nptr, __endptr, __base);
113+
#endif
104114
}
105115

106116
//

0 commit comments

Comments
 (0)