Skip to content

Commit 08a49e8

Browse files
pirama-arumuga-nainarandrom3da
authored andcommitted
[libcxx] avoid the "_l" calls on musl platforms
Since 363bfd6 ([libc++] Use the new locale base API on Linux (#128007), 2025-02-24), musl targets will fail to build with errors like the below: In file included from /[b/f/w/src/git/out/stage2/include/c++/v1/__locale:14](https://cs.corp.google.com/piper///depot/google3/b/f/w/src/git/out/stage2/include/c%2B%2B/v1/__locale?l=14): In file included from /[b/f/w/src/git/out/stage2/include/c++/v1/__locale_dir/locale_base_api.h:123](https://cs.corp.google.com/piper///depot/google3/b/f/w/src/git/out/stage2/include/c%2B%2B/v1/__locale_dir/locale_base_api.h?l=123): /[b/f/w/src/git/out/stage2/include/c++/v1/__locale_dir/support/linux.h:98](https://cs.corp.google.com/piper///depot/google3/b/f/w/src/git/out/stage2/include/c%2B%2B/v1/__locale_dir/support/linux.h?l=98):12: error: no member named 'strtoll_l' in the global namespace 98 | return ::strtoll_l(__nptr, __endptr, __base, __loc); | ~~^ /[b/f/w/src/git/out/stage2/include/c++/v1/__locale_dir/support/linux.h:103](https://cs.corp.google.com/piper///depot/google3/b/f/w/src/git/out/stage2/include/c%2B%2B/v1/__locale_dir/support/linux.h?l=103):10: error: no member named 'strtoull_l' in the global namespace; did you mean '__strtoull'? 103 | return ::strtoull_l(__nptr, __endptr, __base, __loc); | ^~~~~~~~~~~~ | __strtoull /[b/f/w/src/git/out/stage2/include/c++/v1/__locale_dir/support/linux.h:102](https://cs.corp.google.com/piper///depot/google3/b/f/w/src/git/out/stage2/include/c%2B%2B/v1/__locale_dir/support/linux.h?l=102):1: note: '__strtoull' declared here 102 | __strtoull(const char* __nptr, char** __endptr, int __base, __locale_t __loc) { | ^ 2 errors generated.
1 parent cfdeca3 commit 08a49e8

File tree

1 file changed

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

1 file changed

+8
-0
lines changed

libcxx/include/__locale_dir/support/linux.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,12 +95,20 @@ 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 !defined(_LIBCPP_HAS_MUSL_LIBC)
9899
return ::strtoll_l(__nptr, __endptr, __base, __loc);
100+
#else
101+
return ::strtoll(__nptr, __endptr, __base);
102+
#endif
99103
}
100104

101105
inline _LIBCPP_HIDE_FROM_ABI unsigned long long
102106
__strtoull(const char* __nptr, char** __endptr, int __base, __locale_t __loc) {
107+
#if !defined(_LIBCPP_HAS_MUSL_LIBC)
103108
return ::strtoull_l(__nptr, __endptr, __base, __loc);
109+
#else
110+
return ::strtoull(__nptr, __endptr, __base:);
111+
#endif
104112
}
105113

106114
//

0 commit comments

Comments
 (0)